org.jscience.ml.openmath
Class OMAttribution

java.lang.Object
  extended by org.jscience.ml.openmath.OMObject
      extended by org.jscience.ml.openmath.OMAttribution
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class OMAttribution
extends OMObject

Models an OpenMath attribution object.

See Also:
"The OpenMath standard 2.0, 2.1.3", Serialized Form

Field Summary
protected  java.util.Hashtable attributions
          Stores the attributions.
protected  OMObject constructor
          Stores the constructor.
 
Fields inherited from class org.jscience.ml.openmath.OMObject
attributes
 
Constructor Summary
OMAttribution()
          Constructor.
OMAttribution(java.util.Hashtable newAttributions, OMObject newConstructor)
          Constructor.
 
Method Summary
 java.lang.Object clone()
          Clones the object (shallow copy).
 java.lang.Object copy()
          Copies the object (full copy).
 OMAttribution flatten()
          Flatten the attribution.
 OMObject get(OMObject key)
          Gets the value of the attribution.
 java.util.Hashtable getAttributions()
          Get the attributions.
 OMObject getConstructor()
          Get the attribution constructor.
 java.util.Enumeration getKeys()
          Get the symbol (keys).
 java.lang.String getType()
          Gets the type.
 java.util.Enumeration getValues()
          Get the values.
 boolean hasKey(OMObject key)
          Has symbol.
 boolean hasValue(OMObject value)
          Has value.
 boolean isAtom()
          Are we an atom object.
 boolean isComposite()
          Are we a composite object.
 boolean isSame(OMObject object)
          Determines if this is the same object.
 boolean isValid()
          Determines if this is a valid object.
 void put(OMObject key, OMObject value)
          Puts an attribution.
 void remove(OMObject key)
          Removes an attribution.
 OMObject replace(OMObject source, OMObject dest)
          Replace any occurrence of source to destination.
 void setAttributions(java.util.Hashtable newAttributions)
          Set the attributions.
 void setConstructor(OMObject newConstructor)
          Set the attribution constructor.
 OMObject strip()
          Strip the attribution.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class org.jscience.ml.openmath.OMObject
getAttribute, getAttributes, removeAttribute, setAttribute, setAttributes
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

constructor

protected OMObject constructor
Stores the constructor.


attributions

protected java.util.Hashtable attributions
Stores the attributions.

Constructor Detail

OMAttribution

public OMAttribution()
Constructor.


OMAttribution

public OMAttribution(java.util.Hashtable newAttributions,
                     OMObject newConstructor)
Constructor.

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

getType

public java.lang.String getType()
Gets the type.

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

getAttributions

public java.util.Hashtable getAttributions()
Get the attributions.

Returns:
the hashtable of attributions.

setAttributions

public void setAttributions(java.util.Hashtable 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 java.util.Enumeration getKeys()
Get the symbol (keys).

Returns:
an enumeration of the keys.

getValues

public java.util.Enumeration getValues()
Get the values.

Returns:
an enumeration of the values.

toString

public java.lang.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 java.lang.Object clone()
Clones the object (shallow copy).

Specified by:
clone in class OMObject
Returns:
a copy of the object.

copy

public java.lang.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.