Class OMAttribution

java.lang.Object
org.episteme.core.mathematics.loaders.openmath.OMObject
org.episteme.core.mathematics.loaders.openmath.OMAttribution
All Implemented Interfaces:
Serializable, Cloneable

public class OMAttribution extends OMObject
Models an OpenMath attribution object.

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

  • Constructor Details

    • OMAttribution

      public OMAttribution()
      Constructor.

    • OMAttribution

      public OMAttribution(Hashtable<OMObject,OMObject> newAttributions, OMObject newConstructor)
      Constructor.

      Parameters:
      newAttributions - the table of attributions.
      newConstructor - the attribution constructor.
  • Method Details

    • getType

      public String getType()
      Gets the type.

      Specified by:
      getType in class OMObject
      Returns:
      the type.
    • getAttributions

      public Hashtable<OMObject,OMObject> getAttributions()
      Get the attributions.

      Returns:
      the hashtable of attributions.
    • setAttributions

      public void setAttributions(Hashtable<OMObject,OMObject> newAttributions)
      Set the attributions.

      Parameters:
      newAttributions - the hashtable of attributions
    • getConstructor

      public OMObject getConstructor()
      Get the attribution constructor.

      Returns:
      the attribution constructor.
    • setConstructor

      public void setConstructor(OMObject newConstructor)
      Set the attribution constructor.

      Parameters:
      newConstructor - the attribution constructor.
    • put

      public void put(OMObject key, OMObject value)
      Puts an attribution.

      Parameters:
      key - the key of the attribution.
      value - the value of the attribution.
    • remove

      public void remove(OMObject key)
      Removes an attribution.

      Parameters:
      key - the attribution to remove by key.
    • get

      public OMObject get(OMObject key)
      Gets the value of the attribution.

      Parameters:
      key - the attribution to look for by key.
      Returns:
      the attribution value found, or null if not found.
    • hasKey

      public boolean hasKey(OMObject key)
      Has symbol.

      Note: this method does NOT do a (cd, name)-pair match. It does the comparison on object level. So an OMSymbol with the same CD and same Name is not necessarily the same object. This is done, because the standard allows multiple attribute-pairs with the same symbol.

      Parameters:
      key - the key to look for.
      Returns:
      true if it contains the given key, false if not.
    • hasValue

      public boolean hasValue(OMObject value)
      Has value.

      Parameters:
      value - the value to look for.
      Returns:
      true if it contains the given value, false otherwise.
    • getKeys

      public Enumeration<OMObject> getKeys()
      Get the symbol (keys).

      Returns:
      an enumeration of the keys.
    • getValues

      public Enumeration<OMObject> getValues()
      Get the values.

      Returns:
      an enumeration of the values.
    • toString

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

      Specified by:
      toString in class OMObject
      Returns:
      the string representation.
    • flatten

      public OMAttribution flatten()
      Flatten the attribution.

      Returns:
      the flattened attribution.
    • strip

      public OMObject strip()
      Strip the attribution.

      Returns:
      the stripped OpenMath object.
    • clone

      public Object clone()
      Clones the object (shallow copy).
      Specified by:
      clone in class OMObject
      Returns:
      a copy of the object.
    • copy

      public Object copy()
      Copies the object (full copy).
      Specified by:
      copy in class OMObject
      Returns:
      a deep copy of the object.
    • isComposite

      public boolean isComposite()
      Are we a composite object.
      Specified by:
      isComposite in class OMObject
      Returns:
      true if it is composite, false if it is not.
    • isAtom

      public boolean isAtom()
      Are we an atom object.
      Specified by:
      isAtom in class OMObject
      Returns:
      true if it is an atom, false if it is not.
    • isSame

      public boolean isSame(OMObject object)
      Determines if this is the same object.

      Specified by:
      isSame in class OMObject
      Parameters:
      object - the object to test against.
      Returns:
      true if it is the same, false if it is not.
    • isValid

      public boolean isValid()
      Determines if this is a valid object.

      Specified by:
      isValid in class OMObject
      Returns:
      true if it is valid, false if it is not.
    • replace

      public OMObject replace(OMObject source, OMObject dest)
      Replace any occurrence of source to destination.

      Parameters:
      source - the source object.
      dest - the destination object.
      Returns:
      the application with the replacing.