public final class IntegerValue extends NumericValue<GenericInteger,IntegerValue> implements Comparable<IntegerValue>
StringParseableValue.Factory<AV extends AttributeValue>
SimpleValue.BaseFactory<AV extends AttributeValue>
value
Constructor and Description |
---|
IntegerValue(GenericInteger val)
Creates instance from integer argument
|
Modifier and Type | Method and Description |
---|---|
IntegerValue |
abs()
Returns the absolute value of
this . |
IntegerValue |
add(Deque<? extends IntegerValue> others)
Adds numbers to this.
|
int |
compareTo(IntegerValue o) |
IntegerValue |
divide(IntegerValue divisor)
Divide
this by some other number. |
double |
doubleValue()
Converts this integer to a double as specified by
BigInteger.doubleValue() |
int |
intValueExact()
Converts this value to an int, checking for lost information.
|
IntegerValue |
multiply(Deque<? extends IntegerValue> others)
Multiply
this by other numbers. |
String |
printXML()
Converts the internal value (accessible via
SimpleValue.getUnderlyingValue() to a valid lexical representation for XML marshalling. |
IntegerValue |
remainder(IntegerValue divisor)
Returns this %
divisor |
IntegerValue |
subtract(IntegerValue subtractedVal)
Subtract a number from this.
|
static IntegerValue |
valueOf(int i)
Returns an
IntegerValue instance representing the specified int value |
static IntegerValue |
valueOf(long l)
Returns an
IntegerValue instance representing the specified long value |
getXmlAttributes
equals, getContent, getUnderlyingValue, hashCode, toString
public IntegerValue(GenericInteger val)
val
- Java representation of xsd:integerpublic static IntegerValue valueOf(int i)
IntegerValue
instance representing the specified int valuei
- integeri
public static IntegerValue valueOf(long l)
IntegerValue
instance representing the specified long valuel
- long integerl
public int compareTo(IntegerValue o)
compareTo
in interface Comparable<IntegerValue>
public IntegerValue abs()
NumericValue
this
. Used by the XACML "abs" functions.abs
in class NumericValue<GenericInteger,IntegerValue>
public IntegerValue add(Deque<? extends IntegerValue> others) throws ArithmeticException
NumericValue
add
in class NumericValue<GenericInteger,IntegerValue>
others
- values to add to this valueArithmeticException
- if the result overflows the value space of N
public IntegerValue multiply(Deque<? extends IntegerValue> others) throws ArithmeticException
NumericValue
this
by other numbers. Used by the XACML "multiply" functions.multiply
in class NumericValue<GenericInteger,IntegerValue>
others
- other values to multiply byArithmeticException
- if the result overflows the value space of N
public IntegerValue divide(IntegerValue divisor) throws ArithmeticException
NumericValue
this
by some other number. Used by XACML *-divide functions.divide
in class NumericValue<GenericInteger,IntegerValue>
divisor
- number by which this
is dividedArithmeticException
- if divisor is zeropublic IntegerValue subtract(IntegerValue subtractedVal) throws ArithmeticException
NumericValue
subtract
in class NumericValue<GenericInteger,IntegerValue>
subtractedVal
- value to be subtracted from this
ArithmeticException
- if the result overflows the value space of N
public String printXML()
SimpleValue
SimpleValue.getUnderlyingValue()
to a valid lexical representation for XML marshalling. Equivalent to the 'printMethod' in JAXB 'javaType' binding
customizations. Implementations of this typically call DatatypeConverter
. This method is called by SimpleValue.getContent()
and its result cached by the same method for later use.
Therefore, no need to cache the result in the implementation.printXML
in class SimpleValue<GenericInteger>
public IntegerValue remainder(IntegerValue divisor) throws ArithmeticException
divisor
divisor
- second argumentBigInteger.remainder(BigInteger)
ArithmeticException
- if divisor is zeropublic double doubleValue() throws IllegalArgumentException
BigInteger.doubleValue()
this
as a doubleIllegalArgumentException
- if this integer is outside the range which can be represented by a doublepublic int intValueExact() throws ArithmeticException
ArithmeticException
- if the value of this will not exactly fit in a int.Copyright © 2012–2020. All rights reserved.