ptolemy.actor.lib.jni
Class PointerToken

java.lang.Object
  extended by ptolemy.data.Token
      extended by ptolemy.actor.lib.jni.PointerToken
All Implemented Interfaces:
java.io.Serializable

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 7.1
Version:
$Id: PointerToken.java,v 1.3 2008/01/26 02:37:34 cxh Exp $
Author:
Teale Fristoe
See Also:
Serialized Form
Accepted Rating:
Red
Proposed Rating:
Red (tbf)

Nested Class Summary
static class PointerToken.PointerType
          The pointer type.
 
Field Summary
static Type POINTER
          The Pointer type: the least upper bound of all the pointer types.
 
Fields inherited from class ptolemy.data.Token
NIL
 
Constructor Summary
PointerToken()
          Construct an empty token.
PointerToken(int pointer)
          Construct a token with the specified memory location.
 
Method Summary
 Type getType()
          Return the type of this token.
 int getValue()
          Return the address of the pointer.
 BooleanToken isEqualTo(Token rightArgument)
          Test for equality of the values of this Token and the argument Token.
 java.lang.String toString()
          Return a String representation of the PointerToken, including the address.
 
Methods inherited from class ptolemy.data.Token
add, addReverse, divide, divideReverse, isCloseTo, isCloseTo, isNil, modulo, moduloReverse, multiply, multiplyReverse, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, notSupportedNullNilStringMessage, one, pow, subtract, subtractReverse, zero, zeroReturnType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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.