gpt4 book ai didi

org.geotools.resources.XMath.isInteger()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-23 03:55:05 30 4
gpt4 key购买 nike

本文整理了Java中org.geotools.resources.XMath.isInteger()方法的一些代码示例,展示了XMath.isInteger()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMath.isInteger()方法的具体详情如下:
包路径:org.geotools.resources.XMath
类名称:XMath
方法名:isInteger

XMath.isInteger介绍

[英]Returns true if the specified type is one of integer types. Integer types includes Long, Integer, Short and Byte.
[中]如果指定的类型是整数类型之一,则返回true。整数类型包括长、整数、短和字节。

代码示例

代码示例来源:origin: org.geotools/gt2-metadata

/**
 * Formats the specified number.
 */
private String format(final Number value) {
  if (numberFormat == null) {
    numberFormat = NumberFormat.getNumberInstance(locale);
    numberFormat.setMinimumFractionDigits(0);
  }
  int precision = 0;
  if (!XMath.isInteger(value.getClass())) {
    precision = PRECISION;
    final double v = Math.abs(value.doubleValue());
    if (v > 0) {
      final int digits = (int) XMath.log10(v);
      if (Math.abs(digits) >= PRECISION) {
        // TODO: Switch to exponential notation when a convenient API will be available in J2SE.
        return value.toString();
      }
      if (digits >= 0) {
        precision -= digits;
      }
      precision = Math.max(0, PRECISION - precision);
    }
  }
  numberFormat.setMaximumFractionDigits(precision);
  return numberFormat.format(value);
}

代码示例来源:origin: org.geotools/gt2-coverage

/**
 * Returns a string representation of this category.
 * The returned string is implementation dependent.
 * It is usually provided for debugging purposes.
 */
public String toString() {
  final StringBuffer buffer = new StringBuffer(Utilities.getShortClassName(this));
  buffer.append("(\"");
  buffer.append(name);
  buffer.append("\":[");
  if (Double.isNaN(minimum) && Double.isNaN(maximum)) {
    buffer.append("NaN(");
    buffer.append(Math.round(inverse.minimum));
    buffer.append("...");
    buffer.append(Math.round(inverse.maximum));
    buffer.append(')');
  } else {
    if (XMath.isInteger(getRange().getElementClass())) {
      buffer.append(Math.round(minimum));
      buffer.append("...");
      buffer.append(Math.round(maximum)); // Inclusive
    } else {
      buffer.append(minimum);
      buffer.append(" ... ");
      buffer.append(maximum); // Inclusive
    }
  }
  buffer.append("])");
  return buffer.toString();
}

代码示例来源:origin: org.geotools/gt2-widgets-swing

/**
 * Set the type and the range of valid values.
 */
public void setValueRange(Class classe, final Range range) {
  String type    = null;
  String minimum = null;
  String maximum = null;
  if (classe != null) {
    while (classe.isArray()) {
      classe = classe.getComponentType();
    }
    classe = XMath.primitiveToWrapper(classe);
    boolean isInteger = false;
    if (XMath.isReal(classe) || (isInteger=XMath.isInteger(classe))==true) {
      type = Vocabulary.format(isInteger ? VocabularyKeys.SIGNED_INTEGER_$1
                        : VocabularyKeys.REAL_NUMBER_$1,
                  new Integer(XMath.getBitCount(classe)));
    } else {
      type = Utilities.getShortName(classe);
    }
  }
  if (range != null) {
    minimum = format(range.getMinValue());
    maximum = format(range.getMaxValue());
  }
  this.type   .setText(type);
  this.minimum.setText(minimum);
  this.maximum.setText(maximum);
}

代码示例来源:origin: org.geotools/gt-metadata

if (isInteger(type)) {
  return value + amount;

代码示例来源:origin: org.geotools/gt2-metadata

if (isInteger(type)) {
  return value + amount;

代码示例来源:origin: org.geotools/gt2-coverage

final boolean adjustSamples = (XMath.isInteger(sType) && !XMath.isInteger(gType));
if ((adjustSamples ? gMinInc : sMinInc) != 0) {
  int swap = sMinInc;

代码示例来源:origin: org.geotools/gt2-coverage

int upper = (int) max;
if (lower!=min || upper!=max ||
  !XMath.isInteger(category.getRange().getElementClass()))

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com