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
26
27
28 linearParserEvent.setToken(opening, param);
29 fireLinearParserEvent(linearParserEvent);
30
31
32 AbstractMathTreeObject interval = (AbstractMathTreeObject) getChild(0);
33 AbstractMathTreeObject lambda = (AbstractMathTreeObject) getChild(1);
34
35
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
43 flushChild(lambda.getChild(0), 0);
44
45 Equal eq = new Equal();
46 eq.setParameter("=");
47
48
49 eq.setEventSource(getEventSource());
50 eq.flush();
51
52
53 flushChild(interval.getChild(0), 0);
54 linearParserEvent.setToken(token, null);
55 fireLinearParserEvent(linearParserEvent);
56 flushChild(interval.getChild(1), 1);
57
58
59 linearParserEvent.setToken(closing, null);
60 fireLinearParserEvent(linearParserEvent);
61 }
62 }