Package hussam.math.operations
Provides the Logical View of Mathematical operations. See:
Description
| Interface Summary |
|---|
| Operation | This interface is the main interface used for all Values, Numbers, Variables Operands, Functions, and all other operatos. |
| OperationGroup | This is an abstraction of a group of operations. |
| Operator | This interface reflects operators such as Operands(+, -, ^ , * ...etc) and Functions such as Abs, Log, Min, Max...etc an Operator takes an Operation for example from which it will get a new Result. |
| Class Summary |
|---|
| Constant | This is an Operation that simulates a constant number. |
| ConstantNumber | هذه الفئة تمثل رقما عمليا مثل: 4و 5و 40و -123,345345. |
| Function | This class is an abstract Operator. |
| MyGroup | This is an implementation for the OperationGroup interface. |
| Operand | An Operand is an Operator that takes at most two Operations as arguments. |
| OperationProxy | This is a proxy to hide an Operation. |
| Variable | A Variable is an operation indicating a variable amount. |
Package hussam.math.operations Description
Provides the Logical View of Mathematical operations. The package Shows the concept of an Operation having a value and other methods. Operations are numbers, operators, operands, Functions, Constants and other facilitating classes. You can start forming mathimatical operations using these classes. For example, you can write:
Variable variable = new Variable("x");
variable.setOperation(new ConstantNumber(20));
System.out.println(variable.result());
variable.setOperation(new Constant("PI", 3.14));
System.out.println(variable);
Or you can do this:
//create a new operand: Operand
Operand add=new Operand(Operator.INDEFINITE, "+"){
public double result()throws MathException{
return getPrevious().result()+getNext().result();
}
};
Operation o1 = new ConstantNumber(20);
Variable o2 = new Variable("var");
o2.setOperation(new ConstantNumber(10));
//add the operations tothe operand:
add.setPrevious(o1);
add.setNext(o2);
//print result
System.out.println(add.result());
//change variable value:(make it equals o1)
o2.setOperation(o1);
System.out.println(add.result());
Package Specification
Needs Java 5. Related Documentation
For overviews, tutorials, examples, guides, and tool documentation, please see: