1 package fr.ove.openmath.jome.model;
2
3 import java.util.*;
4 import fr.ove.openmath.jome.model.*;
5 import fr.ove.openmath.jome.model.events.ModelEvent;
6
7 /***
8 *
9 * @author © 1999 DIRAT Laurent
10 * @version 2.0 28/06/1999
11 */
12 public class Integral extends KaryOperator {
13
14
15
16
17
18
19
20
21 private boolean gotoVariable = true;
22
23 /***
24 * Inserts the instance in the formula tree structure.<BR>
25 * @param current the position in the formula tree where the operator is to be insert.
26 * @return the new current position int hte formula tree.
27 */
28 public FormulaTreeStructure insert(FormulaTreeStructure current) {
29 current = super.insert(current);
30 super.addElement();
31
32 VariableOrNumber dx = (VariableOrNumber) getChild(1).getChild(0);
33 dx.setValue("d" + dx.getValue());
34 return current;
35 }
36
37 /***
38 * Adds a new element (template) to the end of the list.
39 * Returns the new element.
40 */
41 public FormulaTreeStructure addElement() {
42 if (gotoVariable) {
43 gotoVariable = false;
44 return (FormulaTreeStructure) getChild(1).getChild(0);
45 }
46 else
47 return super.addElement();
48 }
49 }