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.AbstractMathTreeObject;
5
6 /***
7 * The abstract math tree object of a complex cartesian number.
8 *
9 * @author © 2000 DIRAT Laurent
10 * @version 1.0 25/02/2000
11 */
12 public class ComplexPolar extends AbstractMathTreeObject {
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 ComplexPolar() {
19 super("complex_polar", -1);
20 }
21
22 /***
23 * "Flushes" the object as a sequence of events for the building of the model
24 */
25 public void flush() {
26 LinearParserEvent linearParserEvent = new LinearParserEvent(getEventSource());
27 flushChild(getChild(0), 0);
28 linearParserEvent.setToken(LinearParserEvent.MULTIPLICATION, "*");
29 fireLinearParserEvent(linearParserEvent);
30 linearParserEvent.setToken(LinearParserEvent.RESERVED, "E");
31 fireLinearParserEvent(linearParserEvent);
32 linearParserEvent.setToken(LinearParserEvent.POWER, "^");
33 fireLinearParserEvent(linearParserEvent);
34 linearParserEvent.setToken(LinearParserEvent.OPEN_PAREN, "(");
35 fireLinearParserEvent(linearParserEvent);
36 linearParserEvent.setToken(LinearParserEvent.RESERVED, "I");
37 fireLinearParserEvent(linearParserEvent);
38 linearParserEvent.setToken(LinearParserEvent.MULTIPLICATION, "*");
39 fireLinearParserEvent(linearParserEvent);
40 flushChild(getChild(1), 1);
41 }
42 }