fr.ove.openmath.jome.ctrl.amto
Class AbstractMathTreeObject

java.lang.Object
  extended byfr.ove.openmath.jome.ctrl.amto.AbstractMathTreeObject
All Implemented Interfaces:
Parametrable, java.io.Serializable
Direct Known Subclasses:
ComplexCartesian, ComplexPolar, MapsToNAry, MapsToTerminal, MapsToUnary

public abstract class AbstractMathTreeObject
extends java.lang.Object
implements java.io.Serializable, Parametrable

An abstract tree structure of a mathematical object.

Version:
1.0 29/10/1999
Author:
© 1999 DIRAT Laurent
See Also:
Serialized Form

Field Summary
protected  java.lang.String identifier
          The identifier of the mathematical notion represented by the instance.
protected  java.lang.String param
          The parameter
protected  int token
          The token which will identify the instance by the mean of the event sent.
 
Constructor Summary
AbstractMathTreeObject(java.lang.String identifier, int token)
          The constructor.
 
Method Summary
 AbstractMathTreeObject add(java.lang.String identifier, java.lang.Object parameter)
          Adds the object characterised by the specified identifier and parameter.
 void fireLinearParserEvent(LinearParserEvent linearParserEvent)
          Fires the specified event.
abstract  void flush()
          "Flushes" the object as a sequence of events for the building of the model.
protected  void flushChild(AbstractMathTreeObject child, int index)
          "Flushes" the specified child.
 AbstractMathTreeObject getChild(int index)
          Returns the child AbstractMathTreeObject at the specified index.
 java.util.Vector getChildren()
          Returns the AbstractMathTreeObject children of the instance
 LinearParserEventSource getEventSource()
          Returns the event source.
 AbstractMathTreeObject getFather()
          Returns the father of the instance in the tree structure
 int getNbChildren()
          Returns the number of children of the instance
 java.lang.Object getParameter()
          Returns the parameter set before.
 void remove(AbstractMathTreeObject child)
          Removes the specified child from the instance.
 void remove(int index)
          Removes the child at the specified index from the instance.
 void removeAll()
          Removes all the children of the instance.
 void setEventSource(LinearParserEventSource eventSource)
          Sets the event source.
protected  void setFather(AbstractMathTreeObject father)
          Sets the father of the instance.
 void setParameter(java.lang.Object param)
          Sets the specified parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

identifier

protected java.lang.String identifier
The identifier of the mathematical notion represented by the instance.


param

protected java.lang.String param
The parameter


token

protected int token
The token which will identify the instance by the mean of the event sent.

Constructor Detail

AbstractMathTreeObject

public AbstractMathTreeObject(java.lang.String identifier,
                              int token)
The constructor.

Parameters:
identifier - the identifier of the instance.
token - the identifier of the instance by the mean of the event sent.
Method Detail

setEventSource

public void setEventSource(LinearParserEventSource eventSource)
Sets the event source.
The event source is shared by all the instances of AbstractMathTreeObject. So, the event source must be set by the top most AbstractMathTreeObject (in the tree, so lets say the root of the formula) object, and should only be done by this one.

Parameters:
eventSource - the event source.

getEventSource

public LinearParserEventSource getEventSource()
Returns the event source.


fireLinearParserEvent

public void fireLinearParserEvent(LinearParserEvent linearParserEvent)
Fires the specified event.

Parameters:
linearParserEvent - the event to fire.

add

public AbstractMathTreeObject add(java.lang.String identifier,
                                  java.lang.Object parameter)
Adds the object characterised by the specified identifier and parameter.

Parameters:
identifier - the identifier of the object to add.
parameter - the possible parameter of the object to add.

getChild

public AbstractMathTreeObject getChild(int index)
Returns the child AbstractMathTreeObject at the specified index.

Parameters:
index - the specified index.

getChildren

public java.util.Vector getChildren()
Returns the AbstractMathTreeObject children of the instance


getNbChildren

public int getNbChildren()
Returns the number of children of the instance


getFather

public AbstractMathTreeObject getFather()
Returns the father of the instance in the tree structure


setFather

protected void setFather(AbstractMathTreeObject father)
Sets the father of the instance.

Parameters:
father - the father to set to the instance

remove

public void remove(AbstractMathTreeObject child)
Removes the specified child from the instance.

Parameters:
child - the specified child to remove.

remove

public void remove(int index)
Removes the child at the specified index from the instance.

Parameters:
index - the specified index of the child to remove.

removeAll

public void removeAll()
Removes all the children of the instance.


setParameter

public void setParameter(java.lang.Object param)
Sets the specified parameter.

Specified by:
setParameter in interface Parametrable
Parameters:
param - the parameter to set.

getParameter

public java.lang.Object getParameter()
Returns the parameter set before.

Specified by:
getParameter in interface Parametrable

flush

public abstract void flush()
"Flushes" the object as a sequence of events for the building of the model.


flushChild

protected void flushChild(AbstractMathTreeObject child,
                          int index)
"Flushes" the specified child.
According to their father, some children need to be between parenthesis to respect correctness of the expression. So, when needed, the specified child is "flushed" as if it was between parenthesis.

Parameters:
child - the child to "flush"
index - the child index in the list of children of the instance.


Copyright © 1999-2007 Universit?© de Nice Sophia-Antipolis, I3S, Ove SARL, DFKI and Universit?§t des Saarlandes. All Rights Reserved.