|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.data.Token
ptolemy.data.ScalarToken
ptolemy.data.FixToken
public class FixToken
A token that contains an instance of FixPoint.
Token
,
FixPoint
,
FixPointQuantization
,
Precision
,
Quantization
,
Serialized Form
Yellow (kienhuis) |
Yellow (kienhuis) |
Field Summary | |
---|---|
private FixPoint |
_value
The FixPoint value contained in this FixToken. |
Fields inherited from class ptolemy.data.ScalarToken |
---|
_unitCategoryExponents |
Fields inherited from class ptolemy.data.Token |
---|
NIL |
Constructor Summary | |
---|---|
FixToken()
Construct a token with integer 0. |
|
FixToken(double value,
int numberOfBits,
int integerBits)
Construct a FixToken representing the specified value with the specified precision. |
|
FixToken(double value,
Precision precision)
Construct a FixToken representing the specified value with the specified precision. |
|
FixToken(FixPoint value)
Construct a FixToken with the supplied FixPoint value. |
|
FixToken(java.lang.String init)
Construct a FixToken from the specified string. |
Method Summary | |
---|---|
protected ScalarToken |
_absolute()
Return a ScalarToken containing the absolute value of the value of this token. |
protected ScalarToken |
_add(ScalarToken rightArgument)
Return a new token whose value is the value of the argument Token added to the value of this Token. |
protected ScalarToken |
_bitwiseAnd(ScalarToken rightArgument)
Returns a token representing the bitwise AND of this token and the given token. |
protected ScalarToken |
_bitwiseNot()
Returns a token representing the bitwise NOT of this token. |
protected ScalarToken |
_bitwiseOr(ScalarToken rightArgument)
Returns a token representing the bitwise OR of this token and the given token. |
protected ScalarToken |
_bitwiseXor(ScalarToken rightArgument)
Returns a token representing the bitwise XOR of this token and the given token. |
protected ScalarToken |
_divide(ScalarToken rightArgument)
Return a new token whose value is the value of this token divided by the value of the argument token. |
protected ScalarToken |
_divide(ScalarToken rightArgument,
Quantization quant)
Return a new token whose value is the value of this token divided by the value of the argument token. |
protected BooleanToken |
_isCloseTo(ScalarToken rightArgument,
double epsilon)
Test whether the value of this token is close to the first argument, where "close" means that the distance between their values is less than or equal to the second argument. |
protected BooleanToken |
_isLessThan(ScalarToken rightArgument)
Test for ordering of the values of this Token and the argument Token. |
protected ScalarToken |
_modulo(ScalarToken rightArgument)
Return a new token whose value is the value of this token modulo the value of the argument token. |
protected ScalarToken |
_multiply(ScalarToken rightArgument)
Return a new token whose value is the value of this token multiplied by the value of the argument token. |
protected FixToken |
_quantize(Quantization quant)
Return a new token whose value is constrained to comply with a quantization specification. |
protected ScalarToken |
_subtract(ScalarToken rightArgument)
Return a new token whose value is the value of the argument token subtracted from the value of this token. |
static FixToken |
convert(Token token)
Convert the specified token into an instance of FixToken. |
double |
convertToDouble()
Return the fixed point value of this token as a double. |
boolean |
equals(java.lang.Object object)
Return true if the argument's class is IntToken and it has the same values as this token. |
FixPoint |
fixValue()
Return the value of this token as a FixPoint. |
Type |
getType()
Return the type of this token. |
int |
hashCode()
Return a hash code value for this value. |
Token |
one()
Returns a new Token representing the multiplicative identity with the same precision as this FixToken. |
void |
print()
Print the content of this FixToken: This is used for debugging only. |
FixToken |
quantize(Quantization quant)
Return a new token whose value is constrained to comply with a quantization specification. |
java.lang.String |
toString()
Return the value of this token as a string that can be parsed by the expression language to recover a token with the same value. |
Token |
zero()
Return a new token representing the additive identity with the same precision as this FixToken. |
Methods inherited from class ptolemy.data.ScalarToken |
---|
_addCategoryExponents, _areUnitsEqual, _copyOfCategoryExponents, _isEqualTo, _isUnitless, _subtractCategoryExponents, absolute, add, addReverse, bitwiseAnd, bitwiseNot, bitwiseOr, bitwiseXor, byteValue, complexValue, divide, divideReverse, doubleValue, floatValue, intValue, inUnitsOf, isCloseTo, isEqualTo, isGreaterThan, isLessThan, leftShift, logicalRightShift, longValue, modulo, moduloReverse, multiply, multiplyReverse, rightShift, setUnitCategory, shortValue, subtract, subtractReverse, unitsString |
Methods inherited from class ptolemy.data.Token |
---|
isCloseTo, isNil, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, notSupportedNullNilStringMessage, pow, zeroReturnType |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private FixPoint _value
Constructor Detail |
---|
public FixToken()
FixPoint.FixPoint(int)
constructor, so the precision and quantization are the what ever
is defined for that constructor
public FixToken(FixPoint value)
value
- A FixPoint value.public FixToken(double value, Precision precision) throws java.lang.IllegalArgumentException
value
- The value to represent.precision
- The precision to use.
java.lang.IllegalArgumentException
- If the supplied precision
is invalid.public FixToken(double value, int numberOfBits, int integerBits) throws java.lang.IllegalArgumentException
value
- The value to represent.numberOfBits
- The total number of bits.integerBits
- The number of integer bits.
java.lang.IllegalArgumentException
- If the supplied precision
is invalid.public FixToken(java.lang.String init) throws IllegalActionException
init
- A string expression of a fixed point number in Ptolemy II
expression language syntax.
IllegalActionException
- If the string does
not contain a parsable fixed point number.Method Detail |
---|
public static FixToken convert(Token token) throws IllegalActionException
token
- The token to be converted to a FixToken.
IllegalActionException
- If the conversion
cannot be carried out.public double convertToDouble()
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- An instance of Object.
public FixPoint fixValue()
fixValue
in class ScalarToken
public Type getType()
getType
in class ScalarToken
public int hashCode()
hashCode
in class java.lang.Object
public Token one()
one
in class Token
public void print()
public final FixToken quantize(Quantization quant)
quant
- The quantization specification.
public java.lang.String toString()
toString
in class Token
public Token zero()
zero
in class Token
protected ScalarToken _absolute()
_absolute
in class ScalarToken
protected ScalarToken _add(ScalarToken rightArgument)
_add
in class ScalarToken
rightArgument
- The token to add to this token.
protected ScalarToken _bitwiseAnd(ScalarToken rightArgument) throws IllegalActionException
_bitwiseAnd
in class ScalarToken
rightArgument
- The FixToken to bitwise AND with this one.
IllegalActionException
- If the given token is not
compatible for this operation, or the operation does not make
sense for this type.protected ScalarToken _bitwiseNot() throws IllegalActionException
_bitwiseNot
in class ScalarToken
IllegalActionException
- If the given token is not
compatible for this operation, or the operation does not make
sense for this type.protected ScalarToken _bitwiseOr(ScalarToken rightArgument) throws IllegalActionException
_bitwiseOr
in class ScalarToken
rightArgument
- The FixToken to bitwise OR with this one.
IllegalActionException
- If the given token is not
compatible for this operation, or the operation does not make
sense for this type.protected ScalarToken _bitwiseXor(ScalarToken rightArgument) throws IllegalActionException
_bitwiseXor
in class ScalarToken
rightArgument
- The FixToken to bitwise XOR with this one.
IllegalActionException
- If the given token is not
compatible for this operation, or the operation does not make
sense for this type.protected ScalarToken _divide(ScalarToken rightArgument)
_divide
in class ScalarToken
rightArgument
- The token to divide this token by.
protected ScalarToken _divide(ScalarToken rightArgument, Quantization quant)
rightArgument
- The token to divide this token by.quant
- The quantization specification.
protected BooleanToken _isCloseTo(ScalarToken rightArgument, double epsilon)
_isCloseTo
in class ScalarToken
rightArgument
- The token to compare to this token.epsilon
- The value that we use to determine whether two
tokens are close.
protected BooleanToken _isLessThan(ScalarToken rightArgument) throws IllegalActionException
_isLessThan
in class ScalarToken
rightArgument
- The token to add to this token.
IllegalActionException
- If this method is not
supported by the derived class.protected ScalarToken _modulo(ScalarToken rightArgument) throws IllegalActionException
_modulo
in class ScalarToken
rightArgument
- The token to modulo this token by.
IllegalActionException
- If this method is not
supported by the derived class.protected ScalarToken _multiply(ScalarToken rightArgument)
_multiply
in class ScalarToken
rightArgument
- The token to multiply this token by.
protected FixToken _quantize(Quantization quant)
quant
- The quantization specification.
protected ScalarToken _subtract(ScalarToken rightArgument)
_subtract
in class ScalarToken
rightArgument
- The token to subtract from this token.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |