View Javadoc

1   package fr.ove.openmath.jome.model;
2   
3   import java.util.*;
4   import fr.ove.openmath.jome.model.FormulaTreeStructure;
5   import fr.ove.openmath.jome.model.events.ModelEvent;
6   
7   /***
8   * The operator "+", which is the unary plus.<BR>
9   *
10  * <CODE>UnaryPlus</CODE> represents a node in the formula tree.<BR>
11  * Its children are the operands of the operation.
12  *
13  * @author © 2000 DIRAT Laurent
14  * @version 2.1 10/01/2000
15  */
16  public class UnaryPlus extends UnaryOperator {
17      /***
18      * The Constructor.
19      */
20      public UnaryPlus() {
21          setResourceIdentifier("UNARYPLUS");
22          setValue("+");
23          setAsOperatorPriority(resourcesManager.getAsOperatorPriority("unaryPlusPriorities"));
24          setAsOperandPriority(resourcesManager.getAsOperandPriority("unaryPlusPriorities"));
25      }
26      
27      /***
28      * Inserts the operator instance in the formula tree, from the current insertion position.
29      * (checks the priorities and goes up in the tree if necessary).
30      *
31      * @param ope the current insertion position.
32      * @return the new insertion position.
33      */
34      public FormulaTreeStructure insert(FormulaTreeStructure current) {
35          // Le seul moment o? l'on fait appel ? cet opÈrateur, c'est pour la saisie d'un
36          // plus unaire, et donc o? l'on a une instance de Addition qui est en fait notre
37          // point d'insertion courant, i.e. current.
38          // On peut ajouter l'instance courante telle qu'elle.
39          current.addChild(this);
40          
41          // On insËre notre template dans le FTS
42          VariableOrNumber template = new VariableOrNumber();
43          addChild(template);
44  
45          // On retourne la refÈrence de notre dernier point d'insertion.
46          return template;
47      }
48  }
49