Class PointerToken


  • public class PointerToken
    extends Token
    A token that contains the memory location of a C object. Used to maintain C objects between JNI calls. Attempts to access the object from Java will raise an IllegalActionException.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Teale Fristoe
    Pt.AcceptedRating:
    Red
    Pt.ProposedRating:
    Red (tbf)
    • Field Detail

      • POINTER

        public static final Type POINTER
        The Pointer type: the least upper bound of all the pointer types.
    • Constructor Detail

      • PointerToken

        public PointerToken()
        Construct an empty token.
      • PointerToken

        public PointerToken​(int pointer)
                     throws IllegalActionException
        Construct a token with the specified memory location.
        Parameters:
        pointer - The specified object referred to by this token.
        Throws:
        IllegalActionException - If the argument is not of the appropriate type (may be thrown by derived classes, but is not thrown here).
    • Method Detail

      • getType

        public Type getType()
        Return the type of this token.
        Overrides:
        getType in class Token
        Returns:
        POINTER, the least upper bound of all the pointer types.
      • getValue

        public int getValue()
        Return the address of the pointer.
        Returns:
        The int that this Token was created with.
      • isEqualTo

        public final BooleanToken isEqualTo​(Token rightArgument)
                                     throws IllegalActionException
        Test for equality of the values of this Token and the argument Token. Two PointerTokens are equal if their addresses are equal.
        Overrides:
        isEqualTo in class Token
        Parameters:
        rightArgument - The Token to test against.
        Returns:
        A boolean token that contains the value true if the addresses are the same.
        Throws:
        IllegalActionException - Not thrown in this base class.
      • toString

        public java.lang.String toString()
        Return a String representation of the PointerToken, including the address.
        Overrides:
        toString in class Token
        Returns:
        A String representation of the PointerToken.