org.jscience.ml.openmath
Class OMError

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

public class OMError
extends OMObject

Models an OpenMath error object.

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

Field Summary
protected  java.util.Vector elements
          Stores the errors.
protected  OMSymbol symbol
          Stores the symbol.
 
Fields inherited from class org.jscience.ml.openmath.OMObject
attributes
 
Constructor Summary
OMError()
          Constructor.
OMError(OMSymbol newSymbol)
          Constructor.
 
Method Summary
 void addElement(OMObject object)
          Add element.
 java.lang.Object clone()
          Clones the object (shallow copy).
 java.lang.Object copy()
          Copies the object (deep copy).
 OMObject firstElement()
          Get the first element.
 OMObject getElementAt(int index)
          Get element.
 java.util.Vector getElements()
          Get the elements.
 OMSymbol getSymbol()
          Gets the symbol.
 java.lang.String getType()
          Gets the type.
 void insertElementAt(OMObject object, int index)
          Insert element at.
 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.
 OMObject lastElement()
          Get the last element.
 void removeAllElements()
          Remove all elements.
 boolean removeElement(OMObject object)
          Remove element.
 void removeElementAt(int index)
          Remove element at.
 OMObject replace(OMObject source, OMObject dest)
          Replace any occurrence of source to destination.
 void setElementAt(OMObject object, int index)
          Set element.
 void setElements(java.util.Vector newElements)
          Set the elements.
 void setSymbol(OMSymbol newSymbol)
          Set the symbol.
 java.lang.String toString()
          toString.
 
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

symbol

protected OMSymbol symbol
Stores the symbol.


elements

protected java.util.Vector elements
Stores the errors.

Constructor Detail

OMError

public OMError(OMSymbol newSymbol)
Constructor.

Parameters:
newSymbol - the error symbol

OMError

public OMError()
Constructor.

Method Detail

getType

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

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

setSymbol

public void setSymbol(OMSymbol newSymbol)
Set the symbol.

Parameters:
newSymbol - the error symbol to set.

getSymbol

public OMSymbol getSymbol()
Gets the symbol.

Returns:
the error symbol

getElements

public java.util.Vector getElements()
Get the elements.

Returns:
the elements

setElements

public void setElements(java.util.Vector newElements)
Set the elements.

Parameters:
newElements - the elements to set.

getElementAt

public OMObject getElementAt(int index)
Get element.

Parameters:
index - the index of the element to get.
Returns:
the element at the given index.

setElementAt

public void setElementAt(OMObject object,
                         int index)
Set element.

Parameters:
object - the object to set.
index - the index to set at.

insertElementAt

public void insertElementAt(OMObject object,
                            int index)
Insert element at.

Parameters:
object - the object to insert.
index - the index to insert at.

removeElementAt

public void removeElementAt(int index)
Remove element at.

Parameters:
index - the index to remove the object from.

addElement

public void addElement(OMObject object)
Add element.

Parameters:
object - the object to add.

removeElement

public boolean removeElement(OMObject object)
Remove element.

Note: This removes the first occurence of the given element. If you want to remove all the references to the given object, continue remove until this returns false.

Parameters:
object - the object to remove.
Returns:
true if more objects exist, false otherwise.

removeAllElements

public void removeAllElements()
Remove all elements.


firstElement

public OMObject firstElement()
Get the first element.

Returns:
the first element.

lastElement

public OMObject lastElement()
Get the last element.

Returns:
the last element.

toString

public java.lang.String toString()
toString.

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

clone

public java.lang.Object clone()
Clones the object (shallow copy).

Specified by:
clone in class OMObject
Returns:
the shallow copy.

copy

public java.lang.Object copy()
Copies the object (deep copy).

Specified by:
copy in class OMObject
Returns:
the deep copy.

isComposite

public boolean isComposite()
Are we a composite object.

Specified by:
isComposite in class OMObject
Returns:
true because we are a composite object.

isAtom

public boolean isAtom()
Are we an atom object.

Specified by:
isAtom in class OMObject
Returns:
false because we are not an atom object.

isSame

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

Specified by:
isSame in class OMObject
Parameters:
object - the object to check against.
Returns:
true if it is the same object, false otherwise.

isValid

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

Specified by:
isValid in class OMObject
Returns:
true if valid, false otherwise.

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.