Class OMObject

java.lang.Object
org.episteme.core.mathematics.loaders.openmath.OMObject
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
OMApplication, OMAttribution, OMBinding, OMByteArray, OMError, OMFloat, OMForeign, OMInteger, OMReference, OMRoot, OMString, OMSymbol, OMVariable

public abstract class OMObject extends Object implements Serializable, Cloneable
Models an abstract OpenMath object.

Note: every other OpenMath object inherits from this object. So each OpenMath object will have a hashtable of attributes.

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

  • Constructor Details

    • OMObject

      public OMObject()
      Constructor.

  • Method Details

    • getType

      public abstract String getType()
      Get the type of this element.

      Returns:
      the type.
    • isAtom

      public abstract boolean isAtom()
      Is this an atom.

      Returns:
      true if it is an atom, false if it is not.
    • isComposite

      public abstract boolean isComposite()
      Is this a composite object.

      Returns:
      true if it is composite, false if it is not.
    • isSame

      public abstract boolean isSame(OMObject object)
      Is this the same object.

      Parameters:
      object - the object to test against.
      Returns:
      true if it is the same, false if it is not.
    • isValid

      public abstract boolean isValid()
      Is this a valid object.

      Returns:
      true if it is valid, false if it is not.
    • clone

      public abstract Object clone()
      This will perform a shallow copy of the object.
      Overrides:
      clone in class Object
      Returns:
      a copy of the object.
    • toString

      public abstract String toString()
      Returns a string representation of the object.

      Overrides:
      toString in class Object
      Returns:
      the string representation.
    • copy

      public abstract Object copy()
      Creates a copy of the OMObject.

      Returns:
      a deep copy of the object.
    • getAttributes

      public Hashtable<String,Object> getAttributes()
      Gets the attributes.

      Note: this is an extension to the OpenMath standard 1.0. For the OpenMath standard 2.0 this is needed. So if you want 1.0 compliant code do not use attributes.

      Returns:
      the hashtable with attributes.
    • setAttributes

      public void setAttributes(Hashtable<String,Object> newAttributes)
      Sets the attributes.

      Note: this is an extension to the OpenMath standard 1.0. For the OpenMath standard 2.0 this is needed. So if you want 1.0 compliant code do not use attributes.

      Parameters:
      newAttributes - the attributes to set.
    • getAttribute

      public Object getAttribute(String name)
      Get an attribute.

      Note: this is an extension to the OpenMath standard 1.0. For the OpenMath standard 2.0 this is needed. So if you want 1.0 compliant code do not use attributes.

      Parameters:
      name - the name of the attribute to get.
      Returns:
      the value of the attribute.
    • setAttribute

      public void setAttribute(String name, String value)
      Set an attribute.

      Note: this is an extension to the OpenMath standard 1.0. For the OpenMath standard 2.0 this is needed. So if you want 1.0 compliant code do not use attributes.

      Parameters:
      name - the name of the attribute to set.
      value - the value of the attribute.
    • removeAttribute

      public void removeAttribute(String name)
      Remove an attribute.

      Note: this is an extension to the OpenMath standard 1.0. For the OpenMath standard 2.0 this is needed. So if you want 1.0 compliant code do not use attributes.

      Parameters:
      name - the name of the attribute to remove.