| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthussam.math.operations.Operand
public abstract class Operand
An Operand is an Operator that takes at most two Operations as arguments. Operands are like, + - ^ % > <= etc...
For Example: 5 + 8 8, and 5 are ConstantNumbers, + is an operand. Operand o = new PlusOperand(Operator.PLUS, new ConstantNumber(5), new ConstantNumber(8)); System.out.println(o.result());
Operator, OperatorFactoryDB, Function| Field Summary |
|---|
| Fields inherited from interface hussam.math.operations.Operator |
|---|
COMMA, FUNCTION, INDEFINITE, LOGICAL, MULTIPLY, NOTHING, PLUS, POWER |
| Constructor Summary | |
|---|---|
Operand(int type, java.lang.String name) Construcs an Operand by giving it a name, and a power. | |
Operand(int type, java.lang.String name, Operation previous, Operation next) Construcs an Operation Operand by a Power type, and two operations. | |
| Method Summary | |
|---|---|
protected void | checkReady() Tests if this operand has two arguments, a previous argument and a next argument. |
int | compareTo(Operator p) Compares this operand with another Operator. |
java.lang.String | getName() Returns the name of this Operator. |
Operation | getNext() returns the next operation. |
Operation | getPrevious() the previous operation. |
int | getType() |
void | set(Operation previous, Operation next) Sets the previos and next operation. 5 + 8 5 is the previous operation. 8 is the next operation. |
void | setNext(Operation operation) Sets the next operation. 5 + 8 5 is the previous operation. 8 is the next operation. |
void | setPrevious(Operation operation) Sets the previos operation. 5 + 8 5 is the previous operation. 8 is the next operation. |
java.lang.String | toString() returns a description of this operand. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface hussam.math.operations.Operation |
|---|
result |
| Constructor Detail |
|---|
public Operand(int type,
java.lang.String name,
Operation previous,
Operation next)type - The power of this Operand. for example: Operator.POWERname - the name of this operandprevious - the previous operationnext - the next operations.
public Operand(int type,
java.lang.String name)type - The power of the operand. for example: Operator.PLUSname - the name of the operand.| Method Detail |
|---|
public int getType()
getType in interface Operatorpublic java.lang.String getName()
OperatorgetName in interface Operatorpublic void setPrevious(Operation operation)
Sets the previos operation. 5 + 8 5 is the previous operation. 8 is the next operation.
operation - the operation to be set.public void setNext(Operation operation)
Sets the next operation. 5 + 8 5 is the previous operation. 8 is the next operation.
operation - the operation to be set.public void set(Operation previous, Operation next)
Sets the previos and next operation. 5 + 8 5 is the previous operation. 8 is the next operation.
previous - the previous operation.next - the next operation.public Operation getPrevious()
public Operation getNext()
public java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(Operator p)
compareTo in interface java.lang.Comparable<Operator>p - the Operaotor.
protected void checkReady()
throws OperatorArgumentMissingExceptionOperatorArgumentMissingException - Thrown if this Operand has one argument missing.
| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||