|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectptolemy.math.Overflow
The Overflow class provides a type safe enumeration of strategies for handling numeric overflows. Overflows are typically resolved when quantization constraints are applied to a computed result in order to satisfy the requirements of the type to which the result is to be assigned.
The overflow strategies are
A specific strategy may be chosen dynamically by invoking forName() or getName() with one of the above strategy names. Alternatively a strategy may be selected by using one of the static singletons.
The active class functionality is provided by the quantize method which is normally invoked from Quantization.quantize.
Division by zero can trigger the use of the plusInfinity or minusInfinity methods, which return null, except in the case of the to_zero and saturate strategies for which infinity is well-defined.
FixPoint,
Quantization,
Rounding,
Serialized Form
| Red |
| Red (Ed.Willink) |
| Nested Class Summary | |
static class |
Overflow.General
The general overflow strategy at the top of the overflow lattice |
static class |
Overflow.Grow
The grow overflow strategy |
static class |
Overflow.Modulo
The modulo overflow strategy |
static class |
Overflow.Saturate
The saturate overflows strategy |
static class |
Overflow.ToZero
The overflow to zero strategy |
static class |
Overflow.Trap
The trap overflows strategy |
static class |
Overflow.Unknown
The unknown overflow strategy at the bottom of the overflow lattice |
| Field Summary | |
static Overflow.Saturate |
CLIP
|
static Overflow.General |
GENERAL
|
static Overflow.Grow |
GROW
|
static Overflow.Modulo |
MODULO
|
static Overflow.Saturate |
SATURATE
|
static Overflow.Trap |
THROW
|
static Overflow.ToZero |
TO_ZERO
|
static Overflow.Trap |
TRAP
|
static Overflow.Unknown |
UNKNOWN
|
static Overflow.Modulo |
WRAP
|
| Constructor Summary | |
protected |
Overflow(java.lang.String name)
|
| Method Summary | |
java.lang.Object |
clone()
Return this, that is, return the reference to this object. |
boolean |
equals(java.lang.Object object)
Determine if the argument represents the same Overflow as this object. |
static Overflow |
forName(java.lang.String name)
Return an instance of this class with the specified name. |
static Overflow |
getName(java.lang.String name)
Return an instance of this class with the specified name, or null if none exists. |
int |
hashCode()
Return a hash code value for this object. |
java.math.BigInteger |
minusInfinity(Quantization quant)
Return the value of minus infinity, or null if unrepresentable. |
java.math.BigInteger |
plusInfinity(Quantization quant)
Return the value of plus infinity, or null if unrepresentable. |
abstract java.math.BigInteger |
quantize(java.math.BigInteger integerValue,
Quantization quant)
Return the integerValue after applying the overflow constraints of quant. |
java.lang.String |
toString()
Return the string representation of this overflow. |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final Overflow.General GENERAL
public static final Overflow.Grow GROW
public static final Overflow.Modulo MODULO
public static final Overflow.Modulo WRAP
public static final Overflow.Saturate SATURATE
public static final Overflow.Saturate CLIP
public static final Overflow.ToZero TO_ZERO
public static final Overflow.Trap TRAP
public static final Overflow.Trap THROW
public static final Overflow.Unknown UNKNOWN
| Constructor Detail |
protected Overflow(java.lang.String name)
| Method Detail |
public java.lang.Object clone()
public boolean equals(java.lang.Object object)
object - Another object.
public static Overflow forName(java.lang.String name)
public static Overflow getName(java.lang.String name)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - If the string does not
match one of the known strategies.public int hashCode()
public java.math.BigInteger minusInfinity(Quantization quant)
The saturation value is returned for the saturate and to_zero strategies for which infinity is quantizable. Null is returned for other strategies.
quant - The quantization specification.
public java.math.BigInteger plusInfinity(Quantization quant)
The saturation value is returned for the saturate and to_zero strategies for which infinity is quantizable. Null is returned for other strategies.
quant - The quantization specification.
public abstract java.math.BigInteger quantize(java.math.BigInteger integerValue,
Quantization quant)
integerValue - The unbounded integer value.quant - The quantization constraints.
public java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||