Class NumericValue<N extends Number,NAV extends NumericValue<N,NAV>>
- java.lang.Object
-
- org.ow2.authzforce.core.pdp.api.value.SimpleValue<V>
-
- org.ow2.authzforce.core.pdp.api.value.StringParseableValue<N>
-
- org.ow2.authzforce.core.pdp.api.value.NumericValue<N,NAV>
-
- Type Parameters:
N
- actual Java type of the underlying numeric value (Integer, Double...)NAV
- Concrete numeric AttributeValue type subclass
- All Implemented Interfaces:
AttributeValue
,PrimitiveValue
,Value
- Direct Known Subclasses:
DoubleValue
,IntegerValue
public abstract class NumericValue<N extends Number,NAV extends NumericValue<N,NAV>> extends StringParseableValue<N>
Superclass of all numeric Attribute Values (integer, double...)- Version:
- $Id: $
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ow2.authzforce.core.pdp.api.value.StringParseableValue
StringParseableValue.Factory<AV extends AttributeValue>
-
Nested classes/interfaces inherited from class org.ow2.authzforce.core.pdp.api.value.SimpleValue
SimpleValue.BaseFactory<AV extends AttributeValue>
-
-
Field Summary
-
Fields inherited from class org.ow2.authzforce.core.pdp.api.value.SimpleValue
value
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
NumericValue(N val)
Constructor for NumericValue.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract NAV
abs()
Returns the absolute value ofthis
.abstract NAV
add(Deque<? extends NAV> others)
Adds numbers to this.abstract NAV
divide(NAV divisor)
Dividethis
by some other number.abstract NAV
multiply(Deque<? extends NAV> others)
Multiplythis
by other numbers.abstract NAV
subtract(NAV subtractedVal)
Subtract a number from this.-
Methods inherited from class org.ow2.authzforce.core.pdp.api.value.StringParseableValue
getXmlAttributes
-
Methods inherited from class org.ow2.authzforce.core.pdp.api.value.SimpleValue
equals, getContent, getUnderlyingValue, hashCode, printXML, toString
-
-
-
-
Constructor Detail
-
NumericValue
protected NumericValue(N val) throws IllegalArgumentException, NullPointerException
Constructor for NumericValue.
- Parameters:
val
- a N object.- Throws:
IllegalArgumentException
- ifrawVal == null
NullPointerException
- ifdatatypeId == null
-
-
Method Detail
-
abs
public abstract NAV abs()
Returns the absolute value ofthis
. Used by the XACML "abs" functions.- Returns:
- the absolute value
-
add
public abstract NAV add(Deque<? extends NAV> others) throws ArithmeticException
Adds numbers to this. Used by the XACML numeric *-add functions.- Parameters:
others
- values to add to this value- Returns:
- sum of this and the others.
- Throws:
ArithmeticException
- if the result overflows the value space ofN
-
subtract
public abstract NAV subtract(NAV subtractedVal) throws ArithmeticException
Subtract a number from this. Used by XACML numeric *-subtract functions.- Parameters:
subtractedVal
- value to be subtracted fromthis
- Returns:
- this - subtractedVal
- Throws:
ArithmeticException
- if the result overflows the value space ofN
-
multiply
public abstract NAV multiply(Deque<? extends NAV> others) throws ArithmeticException
Multiplythis
by other numbers. Used by the XACML "multiply" functions.- Parameters:
others
- other values to multiply by- Returns:
- product of this by the others
- Throws:
ArithmeticException
- if the result overflows the value space ofN
-
divide
public abstract NAV divide(NAV divisor) throws ArithmeticException
Dividethis
by some other number. Used by XACML *-divide functions.- Parameters:
divisor
- number by whichthis
is divided- Returns:
- the result quotient
- Throws:
ArithmeticException
- if divisor is zero
-
-