Class BluetoothToken
- java.lang.Object
-
- ptolemy.data.Token
-
- ptolemy.domains.wireless.lib.bluetooth.BluetoothToken
-
- Direct Known Subclasses:
BluetoothResponseToken,BluetoothStatusToken
public abstract class BluetoothToken extends Token
This abstract class defines the parent class for all Bluetooth Token classes, and defines which operations are legal and illegal from the base class Token.This class basically disallows the performing of any arithmatic or algebraic operations on Bluetooth Tokens, as these operations would make no sense on the Bluetooth Token family
- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Phillip Azar
- See Also:
BluetoothResponseToken,BluetoothStatusToken
-
-
Constructor Summary
Constructors Constructor Description BluetoothToken()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tokenadd(Token rightArgument)Return a new token whose value is the sum of this token and the argument.TokenaddReverse(Token leftArgument)Return a new token whose value is the sum of this token and the argument.Tokendivide(Token rightArgument)Return a new token whose value is the value of this token divided by the value of the argument token.TokendivideReverse(Token leftArgument)Return a new token whose value is the value of the argument token divided by the value of this token.BooleanTokenisCloseTo(Token token, double epsilon)Test that the value of this Token is close to the first argument, where "close" means that the distance between them is less than or equal to the second argument.Tokenmodulo(Token rightArgument)Return a new token whose value is the value of this token modulo the value of the argument token.TokenmoduloReverse(Token leftArgument)Return a new token whose value is the value of the argument token modulo the value of this token.Tokenmultiply(Token rightArgument)Return a new token whose value is the value of this token multiplied by the value of the argument token.TokenmultiplyReverse(Token leftArgument)Return a new token whose value is the value of the argument token multiplied by the value of this token.Tokenpow(int times)Return a new token computed as follows:
For positive times arguments, the result represents the product of this token multiplied by itself the number of times given by the argument.Tokensubtract(Token rightArgument)Return a new token whose value is the value of the argument token subtracted from the value of this token.TokensubtractReverse(Token leftArgument)Return a new token whose value is the value of this token subtracted from the value of the argument token.-
Methods inherited from class ptolemy.data.Token
getType, isCloseTo, isEqualTo, isNil, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, notSupportedNullNilStringMessage, one, toString, zero, zeroReturnType
-
-
-
-
Method Detail
-
isCloseTo
public BooleanToken isCloseTo(Token token, double epsilon) throws IllegalActionException
Description copied from class:TokenTest that the value of this Token is close to the first argument, where "close" means that the distance between them is less than or equal to the second argument. This method only makes sense for tokens where the distance between them is reasonably represented as a double.- Overrides:
isCloseToin classToken- Parameters:
token- The token to test closeness of this token with.epsilon- The value that we use to determine whether two tokens are close.- Returns:
- A boolean token that contains the value true if the value of this token are close to those of the argument token. If either this token or the argument token is a nil token, then a boolean token that contains the value false is returned.
- Throws:
IllegalActionException- If the argument token is not of a type that can be compared with this token.
-
add
public Token add(Token rightArgument) throws IllegalActionException
Description copied from class:TokenReturn a new token whose value is the sum of this token and the argument.- Overrides:
addin classToken- Parameters:
rightArgument- The token to add to this token.- Returns:
- A new token containing the result.
If either this token or the argument token is a nil token, then
Token.NILis returned. - Throws:
IllegalActionException- If the argument token and this token are of incomparable types, or the operation does not make sense for the given types.
-
addReverse
public Token addReverse(Token leftArgument) throws IllegalActionException
Description copied from class:TokenReturn a new token whose value is the sum of this token and the argument.- Overrides:
addReversein classToken- Parameters:
leftArgument- The token to add this token to.- Returns:
- A new token containing the result.
If either this token or the argument token is a nil token, then
Token.NILis returned. - Throws:
IllegalActionException- If the argument token and this token are of incomparable types, or the operation does not make sense for the given types.
-
divide
public Token divide(Token rightArgument) throws IllegalActionException
Description copied from class:TokenReturn a new token whose value is the value of this token divided by the value of the argument token.- Overrides:
dividein classToken- Parameters:
rightArgument- The token to divide into this token.- Returns:
- A new token containing the result.
If either this token or the argument token is a nil token, then
Token.NILis returned. - Throws:
IllegalActionException- If the argument token and this token are of incomparable types, or the operation does not make sense for the given types.
-
divideReverse
public Token divideReverse(Token leftArgument) throws IllegalActionException
Description copied from class:TokenReturn a new token whose value is the value of the argument token divided by the value of this token.- Overrides:
divideReversein classToken- Parameters:
leftArgument- The token to be divided by the value of this token.- Returns:
- A new token containing the result.
- Throws:
IllegalActionException- If the argument token and this token are of incomparable types, or the operation does not make sense for the given types.
-
modulo
public Token modulo(Token rightArgument) throws IllegalActionException
Description copied from class:TokenReturn a new token whose value is the value of this token modulo the value of the argument token.- Overrides:
moduloin classToken- Parameters:
rightArgument- The token to divide into this token.- Returns:
- A new token containing the result.
If either this token or the argument token is a nil token, then
Token.NILis returned. - Throws:
IllegalActionException- If the argument token and this token are of incomparable types, or the operation does not make sense for the given types.
-
moduloReverse
public Token moduloReverse(Token leftArgument) throws IllegalActionException
Description copied from class:TokenReturn a new token whose value is the value of the argument token modulo the value of this token.- Overrides:
moduloReversein classToken- Parameters:
leftArgument- The token to apply modulo to by the value of this token. If either this token or the argument token is a nil token, thenToken.NILis returned.- Returns:
- A new token containing the result.
- Throws:
IllegalActionException- If the argument token and this token are of incomparable types, or the operation does not make sense for the given types.
-
multiply
public Token multiply(Token rightArgument) throws IllegalActionException
Description copied from class:TokenReturn a new token whose value is the value of this token multiplied by the value of the argument token.- Overrides:
multiplyin classToken- Parameters:
rightArgument- The token to multiply this token by.- Returns:
- A new token containing the result.
If either this token or the argument token is a nil token, then
Token.NILis returned. - Throws:
IllegalActionException- If the argument token and this token are of incomparable types, or the operation does not make sense for the given types.
-
multiplyReverse
public Token multiplyReverse(Token leftArgument) throws IllegalActionException
Description copied from class:TokenReturn a new token whose value is the value of the argument token multiplied by the value of this token.- Overrides:
multiplyReversein classToken- Parameters:
leftArgument- The token to be multiplied by the value of this token.- Returns:
- A new token containing the result.
- Throws:
IllegalActionException- If the argument token and this token are of incomparable types, or the operation does not make sense for the given types.
-
pow
public Token pow(int times) throws IllegalActionException
Description copied from class:TokenReturn a new token computed as follows:
For positive times arguments, the result represents the product of this token multiplied by itself the number of times given by the argument.
For negative times arguments, the result represents the multiplicative inverse of the product of this token multiplied by itself the number of times given by the absolute value of the argument.
More succinctly: one().divide(pow(-times))
If the argument is zero, then the result is defined to be the result of applying the one() method to this token.The token type returned by this method is the same as the type of this token. Note that the method is different from java.lang.Math.pow(), since it returns an integer given an integer token type, and is also well defined for matrix types.
- Overrides:
powin classToken- Parameters:
times- The number of times to multiply.- Returns:
- The power.
If this token is a nil token, then
Token.NILis returned. - Throws:
IllegalActionException- If the token is not compatible for this operation. Specifically, if the Token type does not support division (for example matrices) then using a negative times argument may throw an exception.
-
subtract
public Token subtract(Token rightArgument) throws IllegalActionException
Description copied from class:TokenReturn a new token whose value is the value of the argument token subtracted from the value of this token.- Overrides:
subtractin classToken- Parameters:
rightArgument- The token to subtract from this token.- Returns:
- A new token containing the result.
If either this token or the argument token is a nil token, then
Token.NILis returned. - Throws:
IllegalActionException- If the argument token and this token are of incomparable types, or the operation does not make sense for the given types.
-
subtractReverse
public Token subtractReverse(Token leftArgument) throws IllegalActionException
Description copied from class:TokenReturn a new token whose value is the value of this token subtracted from the value of the argument token.- Overrides:
subtractReversein classToken- Parameters:
leftArgument- The token to subtract this token from.- Returns:
- A new token containing the result.
If either this token or the argument token is a nil token, then
Token.NILis returned. - Throws:
IllegalActionException- If the argument token and this token are of incomparable types, or the operation does not make sense for the given types.
-
-