本文整理了Java中org.apache.sis.util.Numbers.isInteger()
方法的一些代码示例,展示了Numbers.isInteger()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Numbers.isInteger()
方法的具体详情如下:
包路径:org.apache.sis.util.Numbers
类名称:Numbers
方法名:isInteger
[英]true for integer number.
[中]整数为true。
代码示例来源:origin: apache/sis
/**
* Returns the kind of value provided in the extended element.
* This is a generic code that describe the element type.
* For more accurate information, see {@link #getElementType()}.
*/
@Override
public Datatype getDataType() {
if (CharSequence.class.isAssignableFrom(elementType)) return Datatype.CHARACTER_STRING;
if (CodeList .class.isAssignableFrom(elementType)) return Datatype.CODE_LIST;
if (Enum .class.isAssignableFrom(elementType)) return Datatype.ENUMERATION;
if (Numbers.isInteger(elementType)) {
return Datatype.INTEGER;
}
// TODO: check the org.opengis.annotation.Classifier annotation here.
return Datatype.TYPE_CLASS;
}
代码示例来源:origin: org.apache.sis.core/sis-metadata
/**
* Returns the kind of value provided in the extended element.
* This is a generic code that describe the element type.
* For more accurate information, see {@link #getElementType()}.
*/
@Override
public Datatype getDataType() {
if (CharSequence.class.isAssignableFrom(elementType)) return Datatype.CHARACTER_STRING;
if (CodeList .class.isAssignableFrom(elementType)) return Datatype.CODE_LIST;
if (Enum .class.isAssignableFrom(elementType)) return Datatype.ENUMERATION;
if (Numbers.isInteger(elementType)) {
return Datatype.INTEGER;
}
// TODO: check the org.opengis.annotation.Classifier annotation here.
return Datatype.TYPE_CLASS;
}
代码示例来源:origin: org.apache.sis.core/sis-metadata
if (Unit .class.isAssignableFrom(type)) return UNIT;
if (Number.class.isAssignableFrom(type)) {
return Numbers.isInteger(type) ? INTEGER : NUMBER;
代码示例来源:origin: apache/sis
if (Unit .class.isAssignableFrom(type)) return UNIT;
if (Number.class.isAssignableFrom(type)) {
return Numbers.isInteger(type) ? INTEGER : NUMBER;
代码示例来源:origin: org.apache.sis.core/sis-utility
/**
* Returns {@code true} if this vector contains only integer values.
* This method may iterate over all values for performing this verification.
*
* @return {@code true} if this vector contains only integer values.
*/
public boolean isInteger() {
if (!Numbers.isInteger(getElementType())) {
for (int i=size(); --i >= 0;) {
final double v = doubleValue(i);
if (v != Math.floor(v)) {
return false;
}
}
}
return true;
}
代码示例来源:origin: apache/sis
/**
* Returns {@code true} if this vector contains only integer values.
* This method may iterate over all values for performing this verification.
*
* @return {@code true} if this vector contains only integer values.
*/
public boolean isInteger() {
if (!Numbers.isInteger(getElementType())) {
for (int i=size(); --i >= 0;) {
final double v = doubleValue(i);
if (v != Math.floor(v)) {
return false;
}
}
}
return true;
}
代码示例来源:origin: org.apache.sis.core/sis-utility
/**
* Returns the next value for the given type.
*
* @param type the element type.
* @param value the value to increment or decrement.
* @param up {@code true} for incrementing, or {@code false} for decrementing.
* @return the adjacent value.
*/
private static double next(final Class<?> type, double value, final boolean up) {
if (!up) {
value = -value;
}
if (Numbers.isInteger(type)) {
value++;
} else if (type.equals(Float.class)) {
value = Math.nextUp((float) value);
} else if (type.equals(Double.class)) {
value = Math.nextUp(value);
} else {
// Thrown IllegalStateException instead than IllegalArgumentException because
// the 'type' argument given to this method come from a NumberRange field.
throw new IllegalStateException(Errors.format(Errors.Keys.NotAPrimitiveWrapper_1, type));
}
if (!up) {
value = -value;
}
return value;
}
代码示例来源:origin: org.apache.sis.core/sis-utility
name = InternationalString.class.isAssignableFrom(valueClass) ? "FreeText" : "CharacterString";
} else if (Number.class.isAssignableFrom(valueClass)) {
name = Numbers.isInteger(valueClass) ? "Integer" : "Real";
} else {
代码示例来源:origin: apache/sis
name = InternationalString.class.isAssignableFrom(valueClass) ? "FreeText" : "CharacterString";
} else if (Number.class.isAssignableFrom(valueClass)) {
name = Numbers.isInteger(valueClass) ? "Integer" : "Real";
} else {
代码示例来源:origin: org.apache.sis.core/sis-referencing
if (value instanceof Number) {
final Number n = (Number) value;
if (Numbers.isInteger(n.getClass())) {
final int xmlValue = n.intValue();
if (xmlValue >= 0 && xmlValue == n.doubleValue()) {
if (Numbers.isInteger(type)) {
return new IntegerList(value);
代码示例来源:origin: apache/sis
if (value instanceof Number) {
final Number n = (Number) value;
if (Numbers.isInteger(n.getClass())) {
final int xmlValue = n.intValue();
if (xmlValue >= 0 && xmlValue == n.doubleValue()) {
if (Numbers.isInteger(type)) {
return new IntegerList(value);
代码示例来源:origin: apache/sis
/**
* Returns the next value for the given type.
*
* @param type the element type.
* @param value the value to increment or decrement.
* @param up {@code true} for incrementing, or {@code false} for decrementing.
* @return the adjacent value.
*/
private static double next(final Class<?> type, double value, final boolean up) {
if (Numbers.isInteger(type)) {
if (up) value++; else value--;
} else if (type.equals(Float.class)) {
final float fv = (float) value;
value = up ? Math.nextUp(fv) : Math.nextDown(fv);
} else if (type.equals(Double.class)) {
value = up ? Math.nextUp(value) : Math.nextDown(value);
} else {
// Thrown IllegalStateException instead than IllegalArgumentException because
// the 'type' argument given to this method come from a NumberRange field.
throw new IllegalStateException(Errors.format(Errors.Keys.NotAPrimitiveWrapper_1, type));
}
return value;
}
代码示例来源:origin: org.apache.sis.core/sis-metadata
if (Constants.EPSG.equalsIgnoreCase(codeSpace)) try {
final int n;
if (Numbers.isInteger(code.getClass())) {
n = ((Number) code).intValue();
} else {
代码示例来源:origin: apache/sis
if (Constants.EPSG.equalsIgnoreCase(codeSpace)) try {
final int n;
if (Numbers.isInteger(code.getClass())) {
n = ((Number) code).intValue();
} else {
代码示例来源:origin: apache/sis
/**
* Tests {@link Numbers#isInteger(Class)}.
*/
@Test
public void testIsInteger() {
assertTrue (isInteger(Byte .TYPE));
assertTrue (isInteger(Short .TYPE));
assertTrue (isInteger(Integer .TYPE));
assertTrue (isInteger(Long .TYPE));
assertFalse(isInteger(Float .TYPE));
assertFalse(isInteger(Double .TYPE));
assertTrue (isInteger(Byte .class));
assertTrue (isInteger(Short .class));
assertTrue (isInteger(Integer .class));
assertTrue (isInteger(Long .class));
assertFalse(isInteger(Float .class));
assertFalse(isInteger(Double .class));
assertFalse(isInteger(String .class));
assertFalse(isInteger(Character.class));
}
代码示例来源:origin: org.apache.sis.core/sis-metadata
} else if (value instanceof Number) {
final Number number = (Number) value;
if (Numbers.isInteger(number.getClass())) {
append(number.longValue());
} else {
代码示例来源:origin: apache/sis
if (range.isMinIncluded()) noDataValues.add(Numbers.cast(minimum, widestClass));
if (range.isMaxIncluded()) noDataValues.add(Numbers.cast(maximum, widestClass));
if (Numbers.isInteger(range.getElementType())) {
long value = minimum.longValue() + 1; // If value was inclusive, then it has already been added to the set.
long stop = maximum.longValue() - 1;
代码示例来源:origin: apache/sis
final boolean tb = minInc; minInc = maxInc; maxInc = tb;
if (Numbers.isInteger(type)) {
minInc &= (minimum == (minimum = Math.floor(minimum)));
maxInc &= (maximum == (maximum = Math.ceil (maximum)));
代码示例来源:origin: org.apache.sis.core/sis-utility
final boolean tb = minInc; minInc = maxInc; maxInc = tb;
if (Numbers.isInteger(type)) {
minInc &= (minimum == (minimum = Math.floor(minimum)));
maxInc &= (maximum == (maximum = Math.ceil (maximum)));
代码示例来源:origin: apache/sis
if (Numbers.isInteger(samples.getElementType())) {
内容来源于网络,如有侵权,请联系作者删除!