|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Number
org.openanzo.glitter.util.PolymorphicNumber
public final class PolymorphicNumber
A PolymorphicNumber handles math operations on numeric types that may require type promotion and coercion.
| Field Summary | |
|---|---|
static PolymorphicNumber |
ZERO
Constant 0. |
| Constructor Summary | |
|---|---|
PolymorphicNumber(java.lang.Number n)
Create a PolymorphicNumber from a Java Number. |
|
PolymorphicNumber(TriplePatternComponent tpc)
Create a PolymorphicNumber from the numeric value of a Glitter term. |
|
| Method Summary | |
|---|---|
PolymorphicNumber |
add(PolymorphicNumber other)
Polymorphic addition. |
TypedLiteral |
asTypedLiteral()
Get the value of this number in its narrowest form wrapped as a TypedLiteral |
java.math.BigDecimal |
bigDecimalValue()
|
java.math.BigInteger |
bigIntegerValue()
|
int |
compareTo(PolymorphicNumber other)
|
PolymorphicNumber |
divide(PolymorphicNumber other)
Polymorphic division. |
double |
doubleValue()
|
boolean |
equals(java.lang.Object o)
|
float |
floatValue()
|
int |
hashCode()
|
int |
intValue()
|
long |
longValue()
|
PolymorphicNumber |
mod(PolymorphicNumber other)
Polymorphic remainder operator.. |
PolymorphicNumber |
multiply(PolymorphicNumber other)
Polymorphic multiplication. |
java.lang.Number |
narrowestValue()
Get the value of this number in narrowest (most specific) representation for its type. |
PolymorphicNumber |
negate()
Polymorphic numeric negation. |
PolymorphicNumber |
subtract(PolymorphicNumber other)
Polymorphic subtraction. |
| Methods inherited from class java.lang.Number |
|---|
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static PolymorphicNumber ZERO
| Constructor Detail |
|---|
public PolymorphicNumber(java.lang.Number n)
PolymorphicNumber from a Java Number.
n - Number to create frompublic PolymorphicNumber(TriplePatternComponent tpc)
PolymorphicNumber from the numeric value of a Glitter term.
tpc - TriplePatternComponent to create from| Method Detail |
|---|
public java.lang.Number narrowestValue()
public TypedLiteral asTypedLiteral()
TypedLiteral
TypedLiteral.public PolymorphicNumber add(PolymorphicNumber other)
other - PolymorphicNumber to add to this PolymorphicNumber
public PolymorphicNumber subtract(PolymorphicNumber other)
other - PolymorphicNumber to subtract from this PolymorphicNumber
public PolymorphicNumber multiply(PolymorphicNumber other)
other - PolymorphicNumber to multiply with this PolymorphicNumber
public PolymorphicNumber divide(PolymorphicNumber other)
other - PolymorphicNumber to divide from this PolymorphicNumber
public PolymorphicNumber mod(PolymorphicNumber other)
other - PolymorphicNumber to mod from this PolymorphicNumber
public PolymorphicNumber negate()
public int compareTo(PolymorphicNumber other)
compareTo in interface java.lang.Comparable<PolymorphicNumber>public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.math.BigInteger bigIntegerValue()
BigIntegerpublic java.math.BigDecimal bigDecimalValue()
BigDecimal.public double doubleValue()
doubleValue in class java.lang.Numberpublic float floatValue()
floatValue in class java.lang.Numberpublic int intValue()
intValue in class java.lang.Numberpublic long longValue()
longValue in class java.lang.Number
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||