|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvec_math.Operator<E>
public class Operator<E>
An abstract definition of mathematical operators. Defines an operator symbol, an operator precedence and the number of operands. The precedence runs from higher numbers to lower ones and should if possible, reflect the precedence of the JAVA language specification.
No actions are assigned to these operands, this class acts only as a description for operators.
| Field Summary | |
|---|---|
private int |
number
Number of operands needed for the operator. |
private int |
precedence
Precedence of the operator. |
private E |
symbol
Operator symbol, e.g. |
| Constructor Summary | |
|---|---|
Operator(E sym,
int type,
int priority)
Constructs a new fully qualified operator. |
|
| Method Summary | |
|---|---|
int |
getNumber()
Returns the number of operands needed for this operator. |
int |
getPrecedence()
Gets the precedence of the operator. |
E |
getSource()
Returns the symbol of the operator, e.g. |
boolean |
isBinary()
Returns true if this operator is binary (i.e. |
boolean |
isUnary()
Returns true if this operator is unary (i.e. |
protected void |
setNumber(int num)
Sets the number of operands this operator acts on. |
protected void |
setPrecedence(int priority)
Sets the precedence of this operator. |
protected void |
setSource(E sym)
Sets the symbol of the operator. |
String |
toString()
String representation of the operator |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private E symbol
private int number
private int precedence
| Constructor Detail |
|---|
public Operator(E sym,
int type,
int priority)
sym - The symbol of the operator, e.g. '+'.type - The number of operands, normally 1 or 2.priority - The precedence of the operator, e.g. 12 for '*'.isUnary(),
isBinary()| Method Detail |
|---|
public E getSource()
protected void setSource(E sym)
public boolean isUnary()
public boolean isBinary()
public int getNumber()
isUnary(),
isBinary()protected void setNumber(int num)
public int getPrecedence()
protected void setPrecedence(int priority)
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||