com.rubecula.darwin.domain.world
Class Function_Choosy

java.lang.Object
  extended by com.rubecula.darwin.foundation.Function_
      extended by com.rubecula.darwin.domain.world.Function_Choosy
All Implemented Interfaces:
Choosy, Function, HasExpressions, com.rubecula.jexpression.EvalExpression, com.rubecula.jexpression.EvalExpressionMutable, com.rubecula.jexpression.Valuable, net.sf.tostring0.Identifiable

public class Function_Choosy
extends Function_
implements Choosy, HasExpressions

This class implements the Choosy.getMinimumDesirability(double) function and allows dynamic varying of the specific formula, by emplying an Evaluator. Concrete implementation of Desirable which extends Function_ and implements HasExpressions (thus it can be updated graphically at runtime).

Author:
Robin Hillyard

Field Summary
 
Fields inherited from class com.rubecula.darwin.foundation.Function_
evaluator, LOG
 
Constructor Summary
Function_Choosy()
           
Function_Choosy(com.rubecula.jexpression.Evaluator evaluator)
           
 
Method Summary
 ExpressionMap getExpressions()
           
 java.lang.String getIdentifier()
           
 double getMinimumDesirability(double random)
          Get the choosiness of a female for finding a mate.
protected  double standardFunction(java.lang.Object... arguments)
           
protected  java.lang.CharSequence[] standardFunctionTokens(com.rubecula.jexpression.Notation notation)
          The standard formula is: e^(random*3.8) TEST
 
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
 

Constructor Detail

Function_Choosy

public Function_Choosy()

Function_Choosy

public Function_Choosy(com.rubecula.jexpression.Evaluator evaluator)
Parameters:
evaluator -
Method Detail

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()

getIdentifier

public java.lang.String getIdentifier()
Specified by:
getIdentifier in interface net.sf.tostring0.Identifiable
Returns:
(typically) "Choosiness"
See Also:
Identifiable.getIdentifier()

getMinimumDesirability

public double getMinimumDesirability(double random)
Description copied from interface: Choosy
Get the choosiness of a female for finding a mate.

Specified by:
getMinimumDesirability in interface Choosy
Returns:
a value between 0 and infinity. The higher the value, the more choosy she is. A value of 0 means that all males are eligible and a female will never need to look outside the population for a mate.
See Also:
Choosy.getMinimumDesirability(double)

standardFunction

protected double standardFunction(java.lang.Object... arguments)
                           throws FunctionException
Specified by:
standardFunction in class Function_
Parameters:
arguments - a variable set of Objects which must be passed to the actual implemented version of Function_.standardFunction(Object...).
Returns:
the standard value for this function. This is called when Function_.isDifferent() returns false.
Throws:
FunctionException - XXX
See Also:
Function_.standardFunction(java.lang.Object[])

standardFunctionTokens

protected java.lang.CharSequence[] standardFunctionTokens(com.rubecula.jexpression.Notation notation)
The standard formula is: e^(random*3.8) TEST

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.