public class ConstantPool extends java.lang.Object implements ProgramExtensionTemplate
| Modifier and Type | Field and Description |
|---|---|
static double[] |
COMMON_CONST |
NO_PARAMS, NO_PREC| Constructor and Description |
|---|
ConstantPool()
Construct with common constants, plus 100 random constants between -10 and 10.
|
ConstantPool(java.lang.String theName,
double[] thePool)
Construct for a specific constant pool.
|
ConstantPool(java.lang.String theName,
double[] thePool,
int count,
GenerateRandom rnd,
double low,
double high)
Construct for a specific constant pool and random constants.
|
| Modifier and Type | Method and Description |
|---|---|
ExpressionValue |
evaluate(ProgramNode actual)
Evaluate the specified actual program node, using this opcode template.
|
int |
getChildNodeCount() |
int |
getDataSize() |
java.lang.String |
getName() |
NodeType |
getNodeType() |
java.util.List<ParamTemplate> |
getParams() |
int |
getPrecedence() |
ParamTemplate |
getReturnValue() |
boolean |
isPossibleReturnType(EncogProgramContext context,
ValueType rtn)
Determines if the specified return type is a possible return type.
|
boolean |
isVariable() |
void |
randomize(java.util.Random rnd,
java.util.List<ValueType> desiredType,
ProgramNode actual,
double minValue,
double maxValue)
Randomize this actual tree node.
|
public ConstantPool(java.lang.String theName,
double[] thePool)
theName - The name of the pool.thePool - The pool of values.public ConstantPool(java.lang.String theName,
double[] thePool,
int count,
GenerateRandom rnd,
double low,
double high)
theName - The name of the pool.thePool - The pool of values.count - The number of random values to generate, total size is length of pool + count.rnd - Random number generator.low - The low end of the random range.high - The high end of the random range.public ConstantPool()
public ExpressionValue evaluate(ProgramNode actual)
ProgramExtensionTemplateevaluate in interface ProgramExtensionTemplateactual - The tree node in the actual program.public int getChildNodeCount()
getChildNodeCount in interface ProgramExtensionTemplatepublic int getDataSize()
getDataSize in interface ProgramExtensionTemplatepublic java.lang.String getName()
getName in interface ProgramExtensionTemplatepublic NodeType getNodeType()
getNodeType in interface ProgramExtensionTemplatepublic java.util.List<ParamTemplate> getParams()
getParams in interface ProgramExtensionTemplatepublic int getPrecedence()
getPrecedence in interface ProgramExtensionTemplatepublic ParamTemplate getReturnValue()
getReturnValue in interface ProgramExtensionTemplatepublic boolean isPossibleReturnType(EncogProgramContext context, ValueType rtn)
ProgramExtensionTemplateisPossibleReturnType in interface ProgramExtensionTemplatecontext - The program context.rtn - The potential return type to check.public boolean isVariable()
isVariable in interface ProgramExtensionTemplatepublic void randomize(java.util.Random rnd,
java.util.List<ValueType> desiredType,
ProgramNode actual,
double minValue,
double maxValue)
ProgramExtensionTemplaterandomize in interface ProgramExtensionTemplaternd - Random number generator.desiredType - The desired type of the randomization, if allowed.actual - The actual program node to randomize.minValue - The minimum value to use for randomization.maxValue - The maximum value to use for randomization.