Class 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 Detail

      • BluetoothToken

        public BluetoothToken()
    • Method Detail

      • isCloseTo

        public BooleanToken isCloseTo​(Token token,
                                      double epsilon)
                               throws IllegalActionException
        Description copied from class: Token
        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. This method only makes sense for tokens where the distance between them is reasonably represented as a double.
        Overrides:
        isCloseTo in class Token
        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: Token
        Return a new token whose value is the sum of this token and the argument.
        Overrides:
        add in class Token
        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.NIL is 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: Token
        Return a new token whose value is the sum of this token and the argument.
        Overrides:
        addReverse in class Token
        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.NIL is 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: Token
        Return a new token whose value is the value of this token divided by the value of the argument token.
        Overrides:
        divide in class Token
        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.NIL is 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: Token
        Return a new token whose value is the value of the argument token divided by the value of this token.
        Overrides:
        divideReverse in class Token
        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: Token
        Return a new token whose value is the value of this token modulo the value of the argument token.
        Overrides:
        modulo in class Token
        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.NIL is 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: Token
        Return a new token whose value is the value of the argument token modulo the value of this token.
        Overrides:
        moduloReverse in class Token
        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, then Token.NIL is 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: Token
        Return a new token whose value is the value of this token multiplied by the value of the argument token.
        Overrides:
        multiply in class Token
        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.NIL is 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: Token
        Return a new token whose value is the value of the argument token multiplied by the value of this token.
        Overrides:
        multiplyReverse in class Token
        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: Token
        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.
        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:
        pow in class Token
        Parameters:
        times - The number of times to multiply.
        Returns:
        The power. If this token is a nil token, then Token.NIL is 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: Token
        Return a new token whose value is the value of the argument token subtracted from the value of this token.
        Overrides:
        subtract in class Token
        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.NIL is 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: Token
        Return a new token whose value is the value of this token subtracted from the value of the argument token.
        Overrides:
        subtractReverse in class Token
        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.NIL is 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.