1 package fr.ove.openmath.jome.model;
2
3 /***
4 *
5 * @author © 2000 DIRAT Laurent
6 * @version 2.1 10/01/2000
7 */
8 public class KaryOperator extends NaryOperator2 {
9 /***
10 * The arity of the operator. (in fact the number max of operands the operator must have)
11 */
12 private int operatorArity;
13
14 /***
15 * Sets the operator arity
16 */
17 public void setOperatorArity(int operatorArity) {
18 this.operatorArity = operatorArity;
19 }
20
21 /***
22 * Returns the operator arity
23 */
24 public int getOperatorArity() {
25 return operatorArity;
26 }
27
28 /***
29 * Adds a new element (template) to the end of the list.
30 * Returns the new element.
31 */
32 public FormulaTreeStructure addElement() {
33 if (getNbChildren() < operatorArity)
34 return super.addElement();
35 else
36 return this;
37
38 }
39
40
41
42
43 /***
44 * Sets the value.
45 */
46 public void setValue(String value) {
47 setTheOperator(value + "(");
48 }
49
50 /***
51 * Returns the value.
52 */
53 public String getValue() {
54 return getTheOperator();
55 }
56
57
58
59 }