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.Function;
5   
6   /***
7   * The abstract math tree object of operators looking like : <BR>
8   * <OMA> <OMS ..../> <OMBIND>.....</OMBIND> </OMA>.
9   * <P>
10  * Among them we can find integral, differentiation, ....
11  *
12  * @author © 2000 DIRAT Laurent
13  * @version 1.0  23/02/2000
14  */
15  public class MapsToSymbolBind extends Function {
16      /***
17      * The constructor.
18      */
19      public MapsToSymbolBind() {
20          super("maps2SymbolBind");
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          
29          // The opening
30          linearParserEvent.setToken(opening, param);
31          fireLinearParserEvent(linearParserEvent);
32          
33          // the child of the instance should be either a bind or another differentiation
34          AbstractMathTreeObject child = (AbstractMathTreeObject) getChild(0);
35          String childId = child.identifier;
36          if (childId.equals("lambda")) {
37              int nbChildren = child.getNbChildren();
38              int count = nbChildren - 1;
39              flushChild(child.getChild(count), count);
40              for (int i = 0; i < count; i++) {
41                  linearParserEvent.setToken(token, null);
42                  fireLinearParserEvent(linearParserEvent);
43                  flushChild(child.getChild(i), i);
44              }
45          }
46          
47          // The closing
48          linearParserEvent.setToken(closing, null);
49          fireLinearParserEvent(linearParserEvent);
50      }
51  }