|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.tue.win.riaca.openmath.lang.OMObject
nl.tue.win.riaca.openmath.lang.OMBinding
Models an OpenMath binding object.
Field Summary | |
protected OMObject |
binder
Stores the binder. |
protected OMObject |
body
Stores the body. |
protected java.util.Vector |
variables
Stores the variables. |
Fields inherited from class nl.tue.win.riaca.openmath.lang.OMObject |
attributes |
Constructor Summary | |
OMBinding()
Constructor. |
|
OMBinding(OMObject newBinder,
java.util.Vector newVariables,
OMObject newBody)
Constructor. |
Method Summary | |
void |
addVariable(OMObject object)
Add variable. |
OMObject |
alphaConvert(OMObject source,
OMObject dest)
Perform Alpha conversion on the binding and its children. |
OMObject |
betaReduce(OMObject var,
OMObject reduction)
Performs light-weight Beta reduction. |
java.lang.Object |
clone()
Clones the object (shallow copy). |
java.lang.Object |
copy()
Copies the object (full copy). |
OMObject |
firstVariable()
Get the first variable. |
OMObject |
getBinder()
Get the binder. |
OMObject |
getBody()
Get the body. |
java.lang.String |
getType()
Gets the type. |
OMObject |
getVariableAt(int index)
Get variable at i-place. |
java.util.Vector |
getVariables()
Get the variables. |
void |
insertVariableAt(OMObject object,
int index)
Insert variable at i-place. |
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 |
lastVariable()
Get the last variable. |
void |
removeAllVariables()
Remove all variables. |
boolean |
removeVariable(OMObject object)
Remove variable. |
void |
removeVariableAt(int index)
Remove variable at i-place. |
OMObject |
replace(OMObject source,
OMObject dest)
Replace any occurrence of source to destination. |
void |
setBinder(OMObject newBinder)
Sets the binder. |
void |
setBody(OMObject newBody)
Set the body. |
void |
setVariableAt(OMObject object,
int index)
Set variable at i-place. |
void |
setVariables(java.util.Vector newVariables)
Set the variables. |
java.lang.String |
toString()
Returns a string representation of the object. |
Methods inherited from class nl.tue.win.riaca.openmath.lang.OMObject |
getAttribute, getAttributes, removeAttribute, setAttribute, setAttributes |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected OMObject binder
protected java.util.Vector variables
protected OMObject body
Constructor Detail |
public OMBinding()
public OMBinding(OMObject newBinder, java.util.Vector newVariables, OMObject newBody)
newBinder
- the binder.newVariables
- a Vector with the bound variables.newBody
- the body.Method Detail |
public java.lang.String getType()
getType
in class OMObject
public OMObject getBinder()
public void setBinder(OMObject newBinder)
newBinder
- sets the binder.public java.util.Vector getVariables()
public void setVariables(java.util.Vector newVariables)
newVariables
- the variables.public OMObject getBody()
public void setBody(OMObject newBody)
newBody
- the bodypublic OMObject getVariableAt(int index)
index
- the index of the variable.
public void setVariableAt(OMObject object, int index)
object
- the object to set.index
- the index to set at.public void insertVariableAt(OMObject object, int index)
object
- the object to insert.index
- the index to insert at.public void removeVariableAt(int index)
index
- the index to remove from.public void addVariable(OMObject object)
object
- adds a variable (at the end).public boolean removeVariable(OMObject object)
Note: This removes the first occurence of the given variable. If you want to remove all the references to the given object, continue remove until this returns false.
object
- the variable to remove.
public void removeAllVariables()
public OMObject firstVariable()
public OMObject lastVariable()
public java.lang.String toString()
toString
in class OMObject
public java.lang.Object clone()
clone
in class OMObject
public java.lang.Object copy()
copy
in class OMObject
public boolean isComposite()
isComposite
in class OMObject
public boolean isAtom()
isAtom
in class OMObject
public boolean isSame(OMObject object)
isSame
in class OMObject
object
- the object to test against.
public boolean isValid()
isValid
in class OMObject
public OMObject replace(OMObject source, OMObject dest)
Note: this method will not replace bound variables inside a binding. This will be the responsibility of the alphaConvert method. So if the given source is a bound variable the replacing will NOT occur, use the alphaConvert method instead!
source
- the source object.dest
- the destination object.
public OMObject betaReduce(OMObject var, OMObject reduction)
Note: While reducing name-capturing might occur. This method does NOT do alpha conversion to avoid this problem. So consider this to be light-weight Beta reduction.
var
- the variable to reduce.reduction
- the object to reduce it to.
public OMObject alphaConvert(OMObject source, OMObject dest)
Note: the renaming is done by means of the replace method, this will ensure that any bound variable lower in the tree with the same name as the variable in this binding will not be replaced .
source
- the source objectdest
- the destination object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |