| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthussam.math.operations.Function
public abstract class Function
This class is an abstract Operator. You should extend this class to have a special reault method. The result method should use the class's functionality.
A Function uses a list of arguments packaged in anOperationGroupThe Result method should read the arguments stored in thegetOperationGroup()method.
For Example: You can extend this to have a (factorial) implementation. The result implementation reads the first argument, from the Function#getOperationGroup() method. Then do the job to return the factorial result!
OperatorFactoryDB, CustomFunction, OperatorFactory| Field Summary |
|---|
| Fields inherited from interface hussam.math.operations.Operator |
|---|
COMMA, FUNCTION, INDEFINITE, LOGICAL, MULTIPLY, NOTHING, PLUS, POWER |
| Constructor Summary | |
|---|---|
Function(java.lang.String name) Simple constructor. | |
Function(java.lang.String name, OperationGroup g) Simpler constructor. | |
Function(java.lang.String name, OperationGroup g, java.lang.String discription) Construcs a new Function given a name, and an Optional OperationGroup, and a discription | |
| Method Summary | |
|---|---|
protected void | checkReady(int argumentCount) This can be used as a check for arguments. |
int | compareTo(Operator p) Compares the Function with another operator. |
int | getCurrentArgumentCount() Returns the current number of arguments inside this Function. |
java.lang.String | getDiscription() The Function Description. |
java.lang.String | getName() Returns the name of this Operator. |
Operation | getOperation(int i) Returns the Operation at the specified index. |
OperationGroup | getOperationGroup() Returns the OperationGroup |
int | getType() Returns Operator.FUNCTION |
void | setOperationGroup(OperationGroup group) Sets the Operations Group. |
java.lang.String | toString() Returns a String describing the name of the function and the list of arguments. |
| 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 Function(java.lang.String name,
OperationGroup g,
java.lang.String discription)name - Name of the Funcitong - Optional OperationGroup, can be null;discription - The function description.public Function(java.lang.String name, OperationGroup g)
name - function name.g - Optional OperationGroup.Function(String, OperationGroup, String)public Function(java.lang.String name)
name - Function name.| Method Detail |
|---|
public java.lang.String getDiscription()
public int getType()
getType in interface OperatorOperator.FUNCTIONpublic void setOperationGroup(OperationGroup group)
group - The OperationGroup to be inserted into this Function. From which the result method will calculate the result, based on the argument list inside the OperationGroup.public OperationGroup getOperationGroup()
public Operation getOperation(int i)
i - the Index of this operation. public int getCurrentArgumentCount()
public java.lang.String getName()
OperatorgetName in interface Operatorpublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(Operator p)
compareTo in interface java.lang.Comparable<Operator>p - The other operator which the method will compare with.
protected void checkReady(int argumentCount)
throws OperatorArgumentMissingExceptionOperatorArgumentMissingException argumentCount - The number of arguments to test. OperatorArgumentMissingException - Thrown if the number of arguments contained in this Function is lower than argumentCount.Operand.checkReady()
| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||