|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.value.Value net.sf.saxon.value.AtomicValue net.sf.saxon.value.NumericValue net.sf.saxon.value.IntegerValue net.sf.saxon.value.Int64Value
public final class Int64Value
An integer value: note this is a subtype of decimal in XML Schema, not a primitive type. This class supports integer values in the range permitted by a Java "long", and also supports the built-in subtypes of xs:integer.
Nested Class Summary | |
---|---|
protected static class |
Int64Value.Int64Comparable
|
Field Summary |
---|
Fields inherited from class net.sf.saxon.value.IntegerValue |
---|
MAX_LONG, MIN_LONG, MINUS_ONE, PLUS_ONE, SMALL_INTEGERS, ZERO |
Fields inherited from class net.sf.saxon.value.AtomicValue |
---|
typeLabel |
Fields inherited from class net.sf.saxon.value.Value |
---|
INDETERMINATE_ORDERING |
Fields inherited from interface net.sf.saxon.om.ValueRepresentation |
---|
EMPTY_VALUE_ARRAY |
Constructor Summary | |
---|---|
Int64Value(long value)
Constructor supplying a long |
|
Int64Value(long val,
BuiltInAtomicType type,
boolean check)
Constructor for a subtype, supplying a long and a type label. |
Method Summary | |
---|---|
NumericValue |
abs()
Get the absolute value as defined by the XPath abs() function |
BigInteger |
asBigInteger()
Get the value as a BigInteger |
NumericValue |
ceiling()
Implement the XPath ceiling() function |
boolean |
checkRange(BuiltInAtomicType type)
This class allows subtypes of xs:integer to be held, as well as xs:integer values. |
int |
compareTo(long other)
Compare the value to a long |
int |
compareTo(Object other)
Compare the value to another numeric value |
ConversionResult |
convertPrimitive(BuiltInAtomicType requiredType,
boolean validate,
XPathContext context)
Convert to target data type |
ValidationFailure |
convertToSubType(BuiltInAtomicType subtype,
boolean validate)
Convert the value to a subtype of xs:integer |
AtomicValue |
copyAsSubType(AtomicType typeLabel)
Create a copy of this atomic value, with a different type label |
NumericValue |
div(IntegerValue other)
Divide by another integer |
boolean |
effectiveBooleanValue()
Return the effective boolean value of this integer |
NumericValue |
floor()
Implement the XPath floor() function |
BigDecimal |
getDecimalValue()
Get the numeric value converted to a decimal |
double |
getDoubleValue()
Get the numeric value as a double |
float |
getFloatValue()
Get the numeric value converted to a float |
String |
getPrimitiveStringValue()
Get the value as a String |
Comparable |
getSchemaComparable()
Get an object that implements XML Schema comparison semantics |
int |
hashCode()
Get the hashCode. |
IntegerValue |
idiv(IntegerValue other)
Integer divide by another integer |
long |
longValue()
Get the value |
static Int64Value |
makeDerived(long val,
AtomicType type)
Factory method to create a derived value, with no checking of the value against the derived type |
static Int64Value |
makeIntegerValue(long value)
Factory method: allows Int64Value objects to be reused. |
IntegerValue |
minus(IntegerValue other)
Subtract another integer |
IntegerValue |
mod(IntegerValue other)
Take modulo another integer |
NumericValue |
negate()
Negate the value |
IntegerValue |
plus(IntegerValue other)
Add another integer |
NumericValue |
round()
Implement the XPath round() function |
NumericValue |
roundHalfToEven(int scale)
Implement the XPath round-to-half-even() function |
void |
setSubType(AtomicType type)
This class allows subtypes of xs:integer to be held, as well as xs:integer values. |
double |
signum()
Determine whether the value is negative, zero, or positive |
static Int64Value |
signum(long val)
Factory method returning the integer -1, 0, or +1 according as the argument is negative, zero, or positive |
IntegerValue |
times(IntegerValue other)
Multiply by another integer |
ValidationFailure |
validateAgainstSubType(BuiltInAtomicType type)
This class allows subtypes of xs:integer to be held, as well as xs:integer values. |
Methods inherited from class net.sf.saxon.value.IntegerValue |
---|
checkBigRange, checkRange, getPrimitiveType, isIdentical, isWholeNumber, makeIntegerValue, signum, stringToInteger |
Methods inherited from class net.sf.saxon.value.NumericValue |
---|
equals, getXPathComparable, isInteger, parseNumber, promote, toString |
Methods inherited from class net.sf.saxon.value.AtomicValue |
---|
asAtomic, checkPermittedContents, convert, convert, getCardinality, getComponent, getItemType, getLength, getStringValue, getStringValueCS, getTypedValue, getTypeLabel, isNaN, itemAt, iterate, process, setTypeLabel, subsequence |
Methods inherited from class net.sf.saxon.value.Value |
---|
asItem, asItem, asIterator, asValue, convertToJava, fromItem, getCanonicalLexicalRepresentation, getIterator, iterate, reduce, stringToNumber |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Int64Value(long value)
value
- the value of the IntegerValuepublic Int64Value(long val, BuiltInAtomicType type, boolean check) throws XPathException
val
- The supplied value, as an integertype
- the required item type, a subtype of xs:integercheck
- Set to true if the method is required to check that the value is in range;
false if the caller can guarantee that the value has already been checked.
XPathException
- if the supplied value is out of range for the
target typeMethod Detail |
---|
public static Int64Value makeIntegerValue(long value)
value
- the integer value
public static Int64Value makeDerived(long val, AtomicType type)
val
- the integer valuetype
- the subtype of xs:integer
public static Int64Value signum(long val)
val
- the value to be tested
public AtomicValue copyAsSubType(AtomicType typeLabel)
copyAsSubType
in class AtomicValue
typeLabel
- the type label of the new copy. The caller is responsible for checking that
the value actually conforms to this type.
public ValidationFailure convertToSubType(BuiltInAtomicType subtype, boolean validate)
convertToSubType
in class IntegerValue
subtype
- the target subtypevalidate
- true if validation is required; false if the caller already knows that the value is valid
public ValidationFailure validateAgainstSubType(BuiltInAtomicType type)
validateAgainstSubType
in class IntegerValue
type
- the subtype of integer required
public void setSubType(AtomicType type)
type
- the type label to be assignedpublic boolean checkRange(BuiltInAtomicType type)
type
- the subtype of integer required
public Comparable getSchemaComparable()
getSchemaComparable
in class AtomicValue
public int hashCode()
hashCode
in class NumericValue
NumericValue.hashCode()
public long longValue()
longValue
in class NumericValue
public boolean effectiveBooleanValue()
effectiveBooleanValue
in class AtomicValue
public int compareTo(Object other)
compareTo
in interface Comparable
compareTo
in class NumericValue
other
- the numeric value to be compared to this value
public int compareTo(long other)
compareTo
in class NumericValue
other
- the value to be compared with
public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
convertPrimitive
in class AtomicValue
requiredType
- an integer identifying the required atomic typecontext
- XPath dynamic evaluation contextvalidate
- true if validation is required. If set to false, the caller guarantees that
the value is valid for the target data type, and that further validation
is therefore not required.
Note that a validation failure may be reported even if validation was not requested.
public String getPrimitiveStringValue()
getPrimitiveStringValue
in class AtomicValue
public double getDoubleValue()
getDoubleValue
in class NumericValue
public float getFloatValue()
getFloatValue
in class NumericValue
public BigDecimal getDecimalValue()
getDecimalValue
in class NumericValue
public NumericValue negate()
negate
in class NumericValue
public NumericValue floor()
floor
in class NumericValue
public NumericValue ceiling()
ceiling
in class NumericValue
public NumericValue round()
round
in class NumericValue
public NumericValue roundHalfToEven(int scale)
roundHalfToEven
in class NumericValue
scale
- number of digits required after the decimal point; the
value -2 (for example) means round to a multiple of 100
public double signum()
signum
in class NumericValue
public NumericValue abs()
abs
in class NumericValue
public IntegerValue plus(IntegerValue other)
plus
in class IntegerValue
other
- the other integer
public IntegerValue minus(IntegerValue other)
minus
in class IntegerValue
other
- the other integer
public IntegerValue times(IntegerValue other)
times
in class IntegerValue
other
- the other integer
public NumericValue div(IntegerValue other) throws XPathException
div
in class IntegerValue
other
- the other integer
XPathException
- if the other integer is zeropublic IntegerValue mod(IntegerValue other) throws XPathException
mod
in class IntegerValue
other
- the other integer
XPathException
- if the other integer is zeropublic IntegerValue idiv(IntegerValue other) throws XPathException
idiv
in class IntegerValue
other
- the other integer
XPathException
- if the other integer is zeropublic BigInteger asBigInteger()
asBigInteger
in class IntegerValue
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |