ptolemy.data
Class XMLToken

java.lang.Object
  extended byptolemy.data.Token
      extended byptolemy.data.XMLToken
All Implemented Interfaces:
java.io.Serializable

public class XMLToken
extends Token

A token that contains a xml document. Currently, no operations between function tokens (add, multiply, etc.) are supported.

Since:
Ptolemy II 4.0
Version:
$Id: XMLToken.java,v 1.9 2004/04/13 05:12:08 cxh Exp $
Author:
Yang Zhao
See Also:
Serialized Form
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (neuendor)

Constructor Summary
XMLToken()
          Construct an empty token.
XMLToken(java.lang.String xmlStr)
          Construct an XmlToken from the specified string.
 
Method Summary
protected  BooleanToken _isCloseTo(Token rightArgument, double epsilon)
          Test for closeness of the values of this Token and the argument Token.
protected  BooleanToken _isEqualTo(Token rightArgument)
          Test for equality of the values of this Token and the argument Token.
static XMLToken convert(Token token)
          Convert the specified token into an instance of XMLToken.
 org.w3c.dom.Document getDomTree()
          Return the dom document parsed from the xml string.
 Type getType()
          Return the type of this token.
 java.lang.String toString()
          Return the value of this Token as a string.
 
Methods inherited from class ptolemy.data.Token
add, addReverse, divide, divideReverse, isCloseTo, isCloseTo, isEqualTo, modulo, moduloReverse, multiply, multiplyReverse, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, one, pow, subtract, subtractReverse, zero, zeroReturnType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLToken

public XMLToken()
Construct an empty token.


XMLToken

public XMLToken(java.lang.String xmlStr)
         throws java.lang.Exception
Construct an XmlToken from the specified string.

Parameters:
xmlStr - A string.
Throws:
IllegalActionException - If the string is not parsable.
java.lang.Exception
Method Detail

convert

public static XMLToken convert(Token token)
                        throws IllegalActionException
Convert the specified token into an instance of XMLToken. If the specified token is not an instance of XMLToken, an exception is thrown.

Parameters:
token - The token to be converted to a XMLToken.
Returns:
A XMLToken.
Throws:
IllegalActionException - If the conversion cannot be carried out.

getDomTree

public org.w3c.dom.Document getDomTree()
Return the dom document parsed from the xml string.

Returns:
A Document.

getType

public Type getType()
Return the type of this token.

Overrides:
getType in class Token
Returns:
BaseType.XMLTOKEN.

toString

public java.lang.String toString()
Return the value of this Token as a string.

Overrides:
toString in class Token
Returns:
A String.

_isCloseTo

protected BooleanToken _isCloseTo(Token rightArgument,
                                  double epsilon)
                           throws IllegalActionException
Test for closeness of the values of this Token and the argument Token. It is assumed that the type of the argument is StringToken.

Parameters:
rightArgument - The token to compare to.
Returns:
A BooleanToken containing the result.
Throws:
IllegalActionException - If this method is not supported by the derived class.

_isEqualTo

protected BooleanToken _isEqualTo(Token rightArgument)
                           throws IllegalActionException
Test for equality of the values of this Token and the argument Token. It is assumed that the type of the argument is StringToken.

Parameters:
rightArgument - The token to compare to.
Returns:
A BooleanToken containing the result.
Throws:
IllegalActionException - If this method is not supported by the derived class.