View Javadoc

1   package fr.ove.openmath.jome.ctrl.amto;
2   
3   import fr.ove.openmath.jome.ctrl.linear.events.LinearParserEvent;
4   import fr.ove.openmath.jome.ctrl.amto.AbstractMathTreeObject;
5   
6   /***
7   * The abstract math tree object of a terminal element of an expression, such as a variable, an integer or a float,
8   * a specific constant (e.g. pi) which are generally reserved word in the expression.
9   *
10  * @author © 1999 DIRAT Laurent
11  * @version 1.0  29/10/1999
12  */
13  public abstract class MapsToTerminal extends AbstractMathTreeObject {
14      /***
15      * The constructor.
16      * @param identifier the identifier of the instance.
17      * @param token the identifier of the instance by the mean of the event sent.
18      */
19      public MapsToTerminal(String identifier, int token) {
20          super(identifier, token);
21      }
22      
23      /***
24      * "Flushes" the object as a sequence of events for the building of the model
25      */
26      public void flush() {
27          LinearParserEvent linearParserEvent = new LinearParserEvent(getEventSource());
28          linearParserEvent.setToken(token, param);
29          fireLinearParserEvent(linearParserEvent);
30      }
31      
32      /***
33      * "Flushes" the specified child.<BR>
34      * According to their father, some children need to be between parenthesis to respect correctness of the
35      * expression. So, when needed, the specified child is "flushed" as if it was between parenthesis.
36      * @param child the child to "flush"
37      * @param index the child index in the list of children of the instance.
38      */
39      protected void flushChild(AbstractMathTreeObject child, int index){
40          // The instance has no child
41      }
42  }