|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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 - mean
public void addListener(FunctionListener listener)
Function
addListener
in interface Function
Function.addListener(com.rubecula.darwin.foundation.FunctionListener)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.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.EvalExpression
DarwinException
EvalExpression.getExpression()
public com.rubecula.jexpression.Term[] getExpressionTerms()
getEvaluator()
returns an EvalExpression
, delegate to
it. Else throw new DarwinException
;
getExpressionTerms
in interface com.rubecula.jexpression.EvalExpression
DarwinException
EvalExpression.getExpressionTerms()
public java.lang.Number getValue() throws com.rubecula.jexpression.JexpressionException
evaluator
getValue
in interface com.rubecula.jexpression.Valuable
com.rubecula.jexpression.JexpressionException
Valuable.getValue()
public int hashCode()
hashCode
in class java.lang.Object
Object.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.EvalExpressionMutable
com.rubecula.jexpression.JexpressionException
EvalExpressionMutable.setExpression(java.lang.CharSequence[])
public void setExpression(java.lang.String expression) throws com.rubecula.jexpression.JexpressionException
setExpression
in interface com.rubecula.jexpression.EvalExpressionMutable
expression
-
com.rubecula.jexpression.JexpressionException
EvalExpressionMutable.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...)
.
FunctionException
FitnessFunction.getFitness(double,
double, double)
protected java.lang.Object getErrorInfo() throws FunctionException
evaluator
and return the result.
FunctionException
protected com.rubecula.jexpression.Evaluator getEvaluator()
evaluator
protected ExpressionMap getExpressionMap()
Identifiable.getIdentifier()
,this
in a new
HashMap
protected 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 |