org.encog.ml.prg.extension
Class BasicTemplate
- java.lang.Object
-
- org.encog.ml.prg.extension.BasicTemplate
-
- All Implemented Interfaces:
- java.io.Serializable, ProgramExtensionTemplate
public abstract class BasicTemplate extends java.lang.Object implements ProgramExtensionTemplate
A basic template.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.encog.ml.prg.extension.ProgramExtensionTemplate
NO_PARAMS, NO_PREC
-
-
Constructor Summary
Constructors Constructor and Description BasicTemplate(int thePrecedence, java.lang.String theSignature, NodeType theType, boolean isVariable, int theDataSize)Construct a basic template object.BasicTemplate(java.lang.String theSignature)Construct a function based on the provided signature.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intgetChildNodeCount()intgetDataSize()java.lang.StringgetName()NodeTypegetNodeType()java.util.List<ParamTemplate>getParams()intgetPrecedence()ParamTemplategetReturnValue()java.lang.StringgetSignature()booleanisPossibleReturnType(EncogProgramContext context, ValueType rtn)Determines if the specified return type is a possible return type.booleanisVariable()voidrandomize(java.util.Random rnd, java.util.List<ValueType> desiredTypes, ProgramNode actual, double minValue, double maxValue)Randomize this actual tree node.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.encog.ml.prg.extension.ProgramExtensionTemplate
evaluate
-
-
-
-
Constructor Detail
-
BasicTemplate
public BasicTemplate(int thePrecedence, java.lang.String theSignature, NodeType theType, boolean isVariable, int theDataSize)Construct a basic template object.- Parameters:
thePrecedence- The precedence.theSignature- The opcode signature.theType- The opcode type.isVariable- True, if this opcode is a variable.theDataSize- The data size kept for this opcode.
-
BasicTemplate
public BasicTemplate(java.lang.String theSignature)
Construct a function based on the provided signature.- Parameters:
theSignature- The signature.
-
-
Method Detail
-
getChildNodeCount
public int getChildNodeCount()
- Specified by:
getChildNodeCountin interfaceProgramExtensionTemplate- Returns:
- Get the number of child nodes that this opcode requires.
-
getDataSize
public int getDataSize()
- Specified by:
getDataSizein interfaceProgramExtensionTemplate- Returns:
- The size of extra data that is stored by this node.
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceProgramExtensionTemplate- Returns:
- Get the name of this opcode.
-
getNodeType
public NodeType getNodeType()
- Specified by:
getNodeTypein interfaceProgramExtensionTemplate- Returns:
- The node type.
-
getParams
public java.util.List<ParamTemplate> getParams()
- Specified by:
getParamsin interfaceProgramExtensionTemplate- Returns:
- The parameters (child nodes) required by this node.
-
getPrecedence
public int getPrecedence()
- Specified by:
getPrecedencein interfaceProgramExtensionTemplate- Returns:
- The operator precedence.
-
getReturnValue
public ParamTemplate getReturnValue()
- Specified by:
getReturnValuein interfaceProgramExtensionTemplate- Returns:
- The return value for this opcode.
-
getSignature
public java.lang.String getSignature()
- Returns:
- the signature
-
isPossibleReturnType
public boolean isPossibleReturnType(EncogProgramContext context, ValueType rtn)
Determines if the specified return type is a possible return type.- Specified by:
isPossibleReturnTypein interfaceProgramExtensionTemplate- Parameters:
context- The program context.rtn- The potential return type to check.- Returns:
- True, if the specified type is a possible return type.
-
isVariable
public boolean isVariable()
- Specified by:
isVariablein interfaceProgramExtensionTemplate- Returns:
- Returns true if this node is variable.
-
randomize
public void randomize(java.util.Random rnd, java.util.List<ValueType> desiredTypes, ProgramNode actual, double minValue, double maxValue)Randomize this actual tree node.- Specified by:
randomizein interfaceProgramExtensionTemplate- Parameters:
rnd- Random number generator.desiredTypes- 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.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG