org.jscience.ml.openmath.codec
Class CDCodec

java.lang.Object
  extended by org.jscience.ml.openmath.codec.CDCodec

public abstract class CDCodec
extends java.lang.Object

A codec that translates (XML-encoded) OpenMath objects as defined in the Content Dictionary it implements to their backengine equivalent and vice-versa.

Note that this kind of Codec always needs a master codec as parent to terminate properly.


Field Summary
protected  Codec mParent
          Stores the parent Codec.
 
Constructor Summary
CDCodec()
          Constructor.
CDCodec(Codec parent)
          Constructor (parameterized).
 
Method Summary
 java.lang.String decode(java.lang.String syntax)
          Decodes the backengine syntax to a XML-encoded OM-object.
 OMObject decodeOMObject(java.lang.String syntax)
          Decodes the backengine-syntax to an OM-object.
 java.lang.String encode(java.lang.String string)
          Encodes the XML-encoded OM-object.
 java.lang.String encodeOMObject(OMObject object)
          Encodes the OM-object to backengine-syntax.
 Codec getParent()
          Gets the parent-object.
 void setParent(Codec parent)
          Sets the parent-object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mParent

protected Codec mParent
Stores the parent Codec.

Constructor Detail

CDCodec

public CDCodec()
Constructor.


CDCodec

public CDCodec(Codec parent)
Constructor (parameterized).

Parameters:
parent - the parent codec.
Method Detail

setParent

public void setParent(Codec parent)
Sets the parent-object.

Parameters:
parent - set the parent codec.

getParent

public Codec getParent()
Gets the parent-object.

Returns:
the parent codec.

encode

public java.lang.String encode(java.lang.String string)
                        throws CodecEncodeException
Encodes the XML-encoded OM-object.

Parameters:
string - encodes the XML-encoded OpenMath object.
Returns:
the string with the encoding.
Throws:
CodecEncodeException - when a problem arises during encoding.

encodeOMObject

public java.lang.String encodeOMObject(OMObject object)
                                throws CodecEncodeException
Encodes the OM-object to backengine-syntax.

Parameters:
object - encodes the OpenMath object.
Returns:
the string with the encoding.
Throws:
CodecEncodeException - when a problem arises during encoding.

decode

public java.lang.String decode(java.lang.String syntax)
                        throws CodecDecodeException
Decodes the backengine syntax to a XML-encoded OM-object.

Parameters:
syntax - decodes the syntax to an OpenMath object.
Returns:
the OpenMath object in XML encoding.
Throws:
CodecDecodeException - when a problem arises during decoding.

decodeOMObject

public OMObject decodeOMObject(java.lang.String syntax)
                        throws CodecDecodeException
Decodes the backengine-syntax to an OM-object.

Parameters:
syntax - decodes the syntax to an OpenMath object.
Returns:
the OpenMath object.
Throws:
CodecDecodeException - when a problem arises during decoding.