Package hussam.math.operations

Provides the Logical View of Mathematical operations.

See:
          Description

Interface Summary
OperationThis interface is the main interface used for all Values, Numbers, Variables Operands, Functions, and all other operatos.
OperationGroupThis is an abstraction of a group of operations.
OperatorThis 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
ConstantThis is an Operation that simulates a constant number.
ConstantNumberهذه الفئة تمثل رقما عمليا مثل: 4و 5و 40و -123,345345.
FunctionThis class is an abstract Operator.
MyGroupThis is an implementation for the OperationGroup interface.
OperandAn Operand is an Operator that takes at most two Operations as arguments.
OperationProxyThis is a proxy to hide an Operation.
VariableA Variable is an operation indicating a variable amount.
 

Exception Summary
MathExceptionThis is the Mother of all Math and Operation Exception.
MathLogicExceptionThis Exception indicates a problem in the Logic of the Math expression.
OperatorArgumentMissingExceptionThis Exception indicates a missing argument in the Math expression.
 

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: