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.MapsToNAry;
5   
6   /***
7   * The abstract math tree object of a list.
8   *
9   * @author © 1999 DIRAT Laurent
10  * @version 1.0  18/11/1999
11  */
12  public class AList extends MapsToList {
13      /***
14      * The constructor.
15      * @param identifier the identifier of the instance.
16      * @param token the identifier of the instance by the mean of the event sent.
17      */
18      public AList() {
19          super("list", LinearParserEvent.OPEN_CURLY, LinearParserEvent.CLOSE_CURLY);
20      }
21      
22      /***
23      * "Flushes" the object as a sequence of events for the building of the model
24      */
25      public void flush() {
26          if (getNbChildren() > 0) {
27              AbstractMathTreeObject child = getChild(0);
28              // Beurk !!!!
29              // Si on a une list d'entry, on met une liste verticale.
30              // On peut ne tester que sur le premier fils. (sinon objet incorrect, et on affiche 
31              // comme un liste normale (i.e. horizontale avec les accolades))
32              // Pour une liste verticale, c'est la fonction "vlist".
33              if (child.identifier.equals("function") && child.param.equals("entry")) {
34                  opening = LinearParserEvent.FUNCTION;
35                  closing = LinearParserEvent.CLOSE_PAREN;
36                  param = "vlist";
37              }
38              super.flush();
39          }
40      }
41  }