|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.rubecula.darwin.foundation.Function_
public abstract class Function_
This is the base class for all functions which can be implemented by
evaluating an expression via an Evaluator. The methods operate
generally by delegation to the evaluator field.
| Field Summary | |
|---|---|
protected com.rubecula.jexpression.Evaluator |
evaluator
|
protected static org.apache.commons.logging.Log |
LOG
|
| Constructor Summary | |
|---|---|
protected |
Function_()
Protected constructor to construct a Function_ with no evaluator. |
protected |
Function_(com.rubecula.jexpression.Evaluator evaluator)
Protected constructor to construct a Function_ with given evaluator. |
| Method Summary | |
|---|---|
void |
addListener(FunctionListener listener)
Method to add a function listener. |
protected java.lang.Number |
addSymbol(java.lang.String name,
java.lang.Number value)
Delegate to evaluator
TEST |
boolean |
equals(java.lang.Object obj)
WARNING: do not rewrite this method unless you really know what you are doing! |
protected java.lang.Number |
evaluate(java.lang.Object... parameters)
Evaluate the function based on the variables passed in as parameters. |
protected java.lang.Object |
getErrorInfo()
|
protected com.rubecula.jexpression.Evaluator |
getEvaluator()
|
java.lang.String |
getExpression()
If getEvaluator() returns an EvalExpression, delegate to
it. |
protected ExpressionMap |
getExpressionMap()
|
com.rubecula.jexpression.Term[] |
getExpressionTerms()
If getEvaluator() returns an EvalExpression, delegate to
it. |
java.lang.Number |
getValue()
Delegate to evaluator |
int |
hashCode()
WARNING: do not rewrite this method unless you really know what you are doing! |
protected boolean |
isDifferent()
|
boolean |
isMutable()
|
static double |
normalDistributionDensityFunction(double value,
double mean,
double stdDev)
TODO when the 2.0 version of the commons match package comes out, I think we can use the density() method of the NormalDistributionImpl class. |
static double |
normalDistributionDensityFunctionScaled(double value,
double mean,
double stdDev)
TODO when the 2.0 version of the commons match package comes out, I think we can use the density() method of the NormalDistributionImpl class with the appropriate scaling factor. |
protected void |
onFunctionChange()
|
protected java.lang.Object |
removeVariable(java.lang.String name)
Delegate to evaluator
TEST |
protected void |
reset()
|
protected void |
setEvaluator(com.rubecula.jexpression.Evaluator evaluator)
|
void |
setExpression(java.lang.CharSequence... tokens)
Conditionally set expression (only if it is different). |
void |
setExpression(java.lang.String expression)
|
protected abstract double |
standardFunction(java.lang.Object... arguments)
|
protected abstract java.lang.CharSequence[] |
standardFunctionTokens(com.rubecula.jexpression.Notation notation)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.sf.tostring0.Identifiable |
|---|
getIdentifier |
| Field Detail |
|---|
protected com.rubecula.jexpression.Evaluator evaluator
protected static final org.apache.commons.logging.Log LOG
| Constructor Detail |
|---|
protected Function_()
protected Function_(com.rubecula.jexpression.Evaluator evaluator)
evaluator - the evaluator (expression engine) used to evaluate the
expression.| Method Detail |
|---|
public static double normalDistributionDensityFunction(double value,
double mean,
double stdDev)
value - mean - stdDev -
e ^ (-diff * diff / 2 / stdDev / stdDev) / stdDev / FACTOR_NORMAL_DIST_PDF
public static double normalDistributionDensityFunctionScaled(double value,
double mean,
double stdDev)
value - mean - stdDev -
e ^ (-diff * diff / 2 /stdDev) where diff = value - meanpublic void addListener(FunctionListener listener)
Function
addListener in interface FunctionFunction.addListener(com.rubecula.darwin.foundation.FunctionListener)public boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectObject.equals(java.lang.Object)public java.lang.String getExpression()
getEvaluator() returns an EvalExpression, delegate to
it. Else throw new DarwinException;
getExpression in interface com.rubecula.jexpression.EvalExpressionDarwinExceptionEvalExpression.getExpression()public com.rubecula.jexpression.Term[] getExpressionTerms()
getEvaluator() returns an EvalExpression, delegate to
it. Else throw new DarwinException;
getExpressionTerms in interface com.rubecula.jexpression.EvalExpressionDarwinExceptionEvalExpression.getExpressionTerms()
public java.lang.Number getValue()
throws com.rubecula.jexpression.JexpressionException
evaluator
getValue in interface com.rubecula.jexpression.Valuablecom.rubecula.jexpression.JexpressionExceptionValuable.getValue()public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public boolean isMutable()
isMutable in interface com.rubecula.jexpression.EvalExpressionMutable
public void setExpression(java.lang.CharSequence... tokens)
throws com.rubecula.jexpression.JexpressionException
setExpression in interface com.rubecula.jexpression.EvalExpressionMutablecom.rubecula.jexpression.JexpressionExceptionEvalExpressionMutable.setExpression(java.lang.CharSequence[])
public void setExpression(java.lang.String expression)
throws com.rubecula.jexpression.JexpressionException
setExpression in interface com.rubecula.jexpression.EvalExpressionMutableexpression -
com.rubecula.jexpression.JexpressionExceptionEvalExpressionMutable.setExpression(java.lang.String)
protected java.lang.Number addSymbol(java.lang.String name,
java.lang.Number value)
evaluator
TEST
name - value -
protected java.lang.Number evaluate(java.lang.Object... parameters)
throws FunctionException
parameters -
Evaluator or
the value returned from evaluateByEvaluator(Object...).
FunctionExceptionFitnessFunction.getFitness(double,
double, double)
protected java.lang.Object getErrorInfo()
throws FunctionException
evaluator and return the result.
FunctionExceptionprotected com.rubecula.jexpression.Evaluator getEvaluator()
evaluatorprotected ExpressionMap getExpressionMap()
Identifiable.getIdentifier(),this in a new
HashMapprotected boolean isDifferent()
protected void onFunctionChange()
protected java.lang.Object removeVariable(java.lang.String name)
throws FunctionException
evaluator
TEST
name -
Evaluator.removeSymbol(String)
FunctionException
protected void reset()
throws FunctionException
FunctionException
protected void setEvaluator(com.rubecula.jexpression.Evaluator evaluator)
throws FunctionException
evaluator -
FunctionException
protected abstract double standardFunction(java.lang.Object... arguments)
throws FunctionException
arguments - a variable set of Objects which must be passed to the actual
implemented version of standardFunction(Object...).
isDifferent() returns false.
FunctionException - XXXprotected abstract java.lang.CharSequence[] standardFunctionTokens(com.rubecula.jexpression.Notation notation)
notation - the notation type used by the evaluator.
standardFunction(Object...). This is called by
reset().
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||