net.sf.saxon.value
public abstract class IntegerValue extends NumericValue
Field Summary | |
---|---|
static Int64Value | MAX_LONG
IntegerValue representing the maximum value for a long |
static Int64Value | MINUS_ONE
IntegerValue representing the value -1 |
static Int64Value | MIN_LONG
IntegerValue representing the minimum value for a long |
static Int64Value | PLUS_ONE
IntegerValue representing the value +1 |
static Int64Value[] | SMALL_INTEGERS
Array of small integer values |
static Int64Value | ZERO
IntegerValue representing the value zero |
Method Summary | |
---|---|
abstract BigInteger | asBigInteger()
Get the value as a BigInteger |
static boolean | checkBigRange(BigInteger big, BuiltInAtomicType type)
Check that a BigInteger is within the required range for a given integer subtype.
|
static boolean | checkRange(long value, BuiltInAtomicType type)
Check that a value is in range for the specified subtype of xs:integer
|
abstract ValidationFailure | convertToSubType(BuiltInAtomicType type, boolean validate)
This class allows subtypes of xs:integer to be held, as well as xs:integer values.
|
abstract NumericValue | div(IntegerValue other)
Divide by another integer |
BuiltInAtomicType | getPrimitiveType()
Determine the primitive type of the value. |
abstract IntegerValue | idiv(IntegerValue other)
Integer divide by another integer |
boolean | isIdentical(Value v)
Determine whether two atomic values are identical, as determined by XML Schema rules. |
boolean | isWholeNumber()
Determine whether the value is a whole number, that is, whether it compares
equal to some integer
|
static IntegerValue | makeIntegerValue(BigInteger value)
Factory method: makes either an Int64Value or a BigIntegerValue depending on the value supplied |
abstract IntegerValue | minus(IntegerValue other)
Subtract another integer |
abstract IntegerValue | mod(IntegerValue other)
Take modulo another integer |
abstract IntegerValue | plus(IntegerValue other)
Add another integer |
protected static int | signum(int i)
Get the signum of an int |
static ConversionResult | stringToInteger(CharSequence s)
Static factory method to convert strings to integers. |
abstract IntegerValue | times(IntegerValue other)
Multiply by another integer |
abstract ValidationFailure | validateAgainstSubType(BuiltInAtomicType type)
This class allows subtypes of xs:integer to be held, as well as xs:integer values.
|
Returns: the value, as a BigInteger
Parameters: big the supplied BigInteger type the derived type (a built-in restriction of xs:integer) to check the value against
Returns: true if the value is within the range for the derived type
Parameters: value the value to be checked type the required item type, a subtype of xs:integer
Returns: true if successful, false if value is out of range for the subtype
Parameters: type the subtype of integer required validate true if validation is required, false if the caller warrants that the value is valid for the subtype
Returns: null if the operation succeeds, or a ValidationException if the value is out of range
Parameters: other the other integer
Returns: the result of the division
Throws: XPathException if the other integer is zero
Parameters: other the other integer
Returns: the result of the integer division
Throws: XPathException if the other integer is zero
Note that even this check ignores the type annotation of the value. The integer 3 and the short 3 are considered identical, even though they are not fully interchangeable. "Identical" means the same point in the value space, regardless of type annotation.
NaN is identical to itself.
Parameters: v the other value to be compared with this one
Returns: true if the two values are identical, false otherwise.
Returns: always true for this implementation
Parameters: value the supplied integer value
Returns: the value as a BigIntegerValue or Int64Value as appropriate
Parameters: other the other integer
Returns: the result of the subtraction
Parameters: other the other integer
Returns: the result of the modulo operation (the remainder)
Throws: XPathException if the other integer is zero
Parameters: other the other integer
Returns: the result of the addition
Parameters: i the int
Returns: -1 if the integer is negative, 0 if it is zero, +1 if it is positive
Parameters: s CharSequence representing the string to be converted
Returns: either an Int64Value or a BigIntegerValue representing the value of the String, or a ValidationFailure encapsulating an Exception if the value cannot be converted.
Parameters: other the other integer
Returns: the result of the multiplication
Parameters: type the subtype of integer required
Returns: null if the operation succeeds, or a ValidationException if the value is out of range