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 like sum, product, etc.
8   *
9   * @author © 2000 DIRAT Laurent
10  * @version 1.0  23/02/2000
11  */
12  public class MapsToSigma extends Function {
13      /***
14      * The constructor.
15      */
16      public MapsToSigma() {
17          super("maps2sigma");
18      }
19      
20      /***
21      * "Flushes" the object as a sequence of events for the building of the model
22      */
23      public void flush() {
24          LinearParserEvent linearParserEvent = new LinearParserEvent(getEventSource());
25          // Le format est un interval, suivit de la lambda expression de la fonction intÈgrÈe
26          
27          // The opening
28          linearParserEvent.setToken(opening, param);
29          fireLinearParserEvent(linearParserEvent);
30          
31          
32          AbstractMathTreeObject interval = (AbstractMathTreeObject) getChild(0);
33          AbstractMathTreeObject lambda = (AbstractMathTreeObject) getChild(1);
34          
35          // On envoie l'objet de la lambda expression, i.e. ce qui est dÈrivÈ
36          int nbChildren = lambda.getNbChildren();
37          int count = nbChildren - 1;
38          flushChild(lambda.getChild(count), count);
39          linearParserEvent.setToken(token, null);
40          fireLinearParserEvent(linearParserEvent);
41          
42          // On envoie la variable liÈe, pour servir de variable d'intÈgration
43          flushChild(lambda.getChild(0), 0);
44          // On envoie un opÈrateur "="
45          Equal eq = new Equal();
46          eq.setParameter("="); // N'est pas obligÈ de mettre le paramËtre, car n'est pas mis dans la construction
47                                // puisqu'il est affectÈ ensuite par lecture du fichier de ressources.
48          // Puisque eventsource n'est plus partagÈ, il faut la mettre ? eq
49          eq.setEventSource(getEventSource());
50          eq.flush();
51          
52          // On envoie maintenant les bornes de l'intervalle
53          flushChild(interval.getChild(0), 0);
54          linearParserEvent.setToken(token, null);
55          fireLinearParserEvent(linearParserEvent);
56          flushChild(interval.getChild(1), 1);
57          
58          // The closing
59          linearParserEvent.setToken(closing, null);
60          fireLinearParserEvent(linearParserEvent);
61      }
62  }