com.rubecula.darwin.domain.world
Class Function_Desirable
java.lang.Object
com.rubecula.darwin.foundation.Function_
com.rubecula.darwin.domain.world.Function_Desirable
- All Implemented Interfaces:
- Desirable, Function, HasExpressions, com.rubecula.jexpression.EvalExpression, com.rubecula.jexpression.EvalExpressionMutable, com.rubecula.jexpression.Valuable, net.sf.tostring0.Identifiable
public class Function_Desirable
- extends Function_
- implements Desirable, HasExpressions
Concrete implementation of Desirable which extends Function_
and implements HasExpressions (thus it can be updated graphically at
runtime).
- Author:
- Robin Hillyard
| Methods inherited from class com.rubecula.darwin.foundation.Function_ |
addListener, addSymbol, equals, evaluate, getErrorInfo, getEvaluator, getExpression, getExpressionMap, getExpressionTerms, getValue, hashCode, isDifferent, isMutable, normalDistributionDensityFunction, normalDistributionDensityFunctionScaled, onFunctionChange, removeVariable, reset, setEvaluator, setExpression, setExpression |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.rubecula.jexpression.EvalExpressionMutable |
isMutable, setExpression, setExpression |
| Methods inherited from interface com.rubecula.jexpression.EvalExpression |
getExpression, getExpressionTerms |
Function_Desirable
public Function_Desirable()
Function_Desirable
public Function_Desirable(com.rubecula.jexpression.Evaluator evaluator)
- Parameters:
evaluator -
getDesirability
public double getDesirability(boolean viability,
double random,
int age)
- Specified by:
getDesirability in interface Desirable
- Parameters:
viability - true if the male is viablerandom - a random number between 0 and 1age - the age of the male
- Returns:
- the desirability either hard-coded or based on the current
customized formula
- See Also:
Desirable.getDesirability(boolean,
double, int)
getExpressions
public ExpressionMap getExpressions()
- Specified by:
getExpressions in interface HasExpressions
- Returns:
- a map of
String / EvalExpressionMutable pairs.
The String key for each EvalExpressionMutable is the name
by which that expression will be known in the user interface. - See Also:
HasExpressions.getExpressions(),
HasExpressions.getExpressions()
getIdentifier
public java.lang.String getIdentifier()
- Specified by:
getIdentifier in interface net.sf.tostring0.Identifiable
- Returns:
- (typically) "Desirability"
- See Also:
Identifiable.getIdentifier()
standardFunction
protected double standardFunction(java.lang.Object... arguments)
throws FunctionException
- Specified by:
standardFunction in class Function_
- Parameters:
arguments - these arguments must be, in order,
- Integer: viabilityFactor (10 for viable, 1 for non-viable)
- Number: random
- Integer: age
Note that the arguments are auto-boxed for passing into
evaluateFixedExpression(int, double, int). Note also
that we do not protect against cast exceptions.
- Returns:
- the result of invoking
evaluateFixedExpression(int, double, int).
- Throws:
FunctionException - XXX- See Also:
com.rubecula.darwin.foundation.Function_#standardFunction(double[])
standardFunctionTokens
protected java.lang.CharSequence[] standardFunctionTokens(com.rubecula.jexpression.Notation notation)
- Specified by:
standardFunctionTokens in class Function_
- Parameters:
notation - the notation type used by the evaluator.
- Returns:
- the sequence of tokens that corresponds to the
Function_.standardFunction(Object...). This is called by
Function_.reset(). - See Also:
Function_.standardFunctionTokens(Notation)
Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.