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.MapsToUnary;
5
6 /***
7 * The abstract math tree object of a postfixed unary operator.
8 *
9 * @author © 1999 DIRAT Laurent
10 * @version 1.0 18/11/1999
11 */
12 public abstract class MapsToPostfixedUnary extends MapsToUnary {
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 MapsToPostfixedUnary(String identifier, int token) {
19 super(identifier, token);
20 }
21
22 /***
23 * "Flushes" the object as a sequence of events for the building of the model
24 */
25 public void flush() {
26 AbstractMathTreeObject child = getChild(0);
27 if (!(child instanceof MapsToTerminal)) {
28 LinearParserEvent linearParserEvent = new LinearParserEvent(getEventSource());
29
30 linearParserEvent.setToken(LinearParserEvent.OPEN_PAREN, "(");
31 fireLinearParserEvent(linearParserEvent);
32
33 super.flush();
34
35
36 linearParserEvent.setToken(LinearParserEvent.CLOSE_PAREN, ")");
37 fireLinearParserEvent(linearParserEvent);
38
39 }
40 else
41 super.flush();
42
43 LinearParserEvent linearParserEvent = new LinearParserEvent(getEventSource());
44 linearParserEvent.setToken(token, param);
45 fireLinearParserEvent(linearParserEvent);
46 }
47 }