Class CDCodec

java.lang.Object
org.episteme.core.mathematics.loaders.openmath.codec.CDCodec

public abstract class CDCodec extends 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.

Version:
$Revision: 1.2 $
Author:
Manfred N. Riem (mriem@manorrock.org)
  • Field Details

    • mParent

      protected Codec mParent
      Stores the parent Codec.

  • Constructor Details

    • CDCodec

      public CDCodec()
      Constructor.

    • CDCodec

      public CDCodec(Codec parent)
      Constructor (parameterized).

      Parameters:
      parent - the parent codec.
  • Method Details

    • 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 String encode(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 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 String decode(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(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.