| ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object hussam.math.operations.MyGroup
public class MyGroup
This is an implementation for the OperationGroup
interface.
Constructor Summary | |
---|---|
MyGroup() Construcs a new OperationGroup with 0 operations. | |
MyGroup(java.util.List<? extends Operation> ops) Construcs an OperationGroup giving a List of Operations. |
Method Summary | |
---|---|
void | addOperations(java.util.List<? extends Operation> ops) |
MyGroup | clone(OperatorSourceImpl s) This method clones the operation. |
Operation | getOperation(int i) Returns the operation at the specified index. |
java.util.List<? extends Operation> | getOperations() Returns the list of operations. |
OperationGroup | optimize() This optimizes all the arguments in this group. |
double | result() This implementation returns the Last argument result! |
void | setOperations(java.util.List<? extends Operation> ops) |
java.lang.String | toString() Returns a String describing this OperationGroup |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MyGroup(java.util.List<? extends Operation> ops)
ops
- the list of Operations.public MyGroup()
Method Detail |
---|
public void setOperations(java.util.List<? extends Operation> ops)
public void addOperations(java.util.List<? extends Operation> ops)
public double result() throws MathException
This is group: (x=10 , y= 20, z=y+x) the result of this operationGroup is 30!Notice that the equal sign is an Assignement sign. The Default Equals Sign is '=='
MyParser
It is the responsibility of other Operations to read all arguments. For example: Function
result
in interface Operation
MathException
- if there is a Math Exception!!public java.util.List<? extends Operation> getOperations()
OperationGroup
getOperations
in interface OperationGroup
public Operation getOperation(int i)
OperationGroup
getOperation
in interface OperationGroup
i
- The index of the operation public java.lang.String toString()
toString
in class java.lang.Object
public MyGroup clone(OperatorSourceImpl s) throws java.lang.CloneNotSupportedException
Operation
OperatorSource
as a parameter, this method should update this source with any arguments needed such as Variables! It can be seen as an implemetation of the Visitor approach. It is also worth to note that this method's implemetation is optional. You can egnore the implemetation of this method and just return this.
clone
in interface Operation
s
- The OperatorSourceImpl. java.lang.CloneNotSupportedException
- If the operation is not clonable.ConstantNumber.clone(hussam.math.operations.dataBase.OperatorSourceImpl)
, Variable.clone(hussam.math.operations.dataBase.OperatorSourceImpl)
public OperationGroup optimize()
optimize
in interface Operation
optimize
in interface OperationGroup
| ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |