|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.encog.ml.prg.extension.FunctionFactory
public class FunctionFactory
A function factory maps the opcodes contained in the EncogOpcodeRegistry into an EncogProgram. You rarely want to train with every available opcode. For example, if you are only looking to produce an equation, you should not make use of the if-statement and logical operators.
Constructor Summary | |
---|---|
FunctionFactory()
Default constructor. |
Method Summary | |
---|---|
void |
addExtension(ProgramExtensionTemplate ext)
Add an opcode to the function factory. |
void |
addExtension(String name,
int args)
Add an opcode to the function factory from the opcode registry. |
ProgramNode |
factorProgramNode(ProgramExtensionTemplate temp,
EncogProgram program,
ProgramNode[] args)
Factor a new program node, based in a template object. |
ProgramNode |
factorProgramNode(String name,
EncogProgram program,
ProgramNode[] args)
Factor a new program node, based on an opcode name and arguments. |
ProgramExtensionTemplate |
findFunction(String name)
Find a function with the specified name. |
List<ProgramExtensionTemplate> |
findOpcodes(List<ValueType> types,
EncogProgramContext context,
boolean includeTerminal,
boolean includeFunction)
Find all opcodes that match the search criteria. |
ProgramExtensionTemplate |
findOperator(char ch1,
char ch2)
This method is used when parsing an expression. |
ProgramExtensionTemplate |
getOpCode(int theOpCode)
Get the specified opcode. |
List<ProgramExtensionTemplate> |
getOpCodes()
|
Map<String,ProgramExtensionTemplate> |
getTemplateMap()
|
boolean |
isDefined(String name,
int l)
Determine if an opcode is in the function factory. |
int |
size()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FunctionFactory()
Method Detail |
---|
public void addExtension(ProgramExtensionTemplate ext)
ext
- The opcode to add.public void addExtension(String name, int args)
name
- The name of the opcode.args
- The number of arguments.public ProgramNode factorProgramNode(ProgramExtensionTemplate temp, EncogProgram program, ProgramNode[] args)
temp
- The opcode.program
- The program.args
- The arguments for this node.
public ProgramNode factorProgramNode(String name, EncogProgram program, ProgramNode[] args)
name
- The name of the opcode.program
- The program to factor for.args
- The arguements.
public ProgramExtensionTemplate findFunction(String name)
name
- The name of the function.
public List<ProgramExtensionTemplate> findOpcodes(List<ValueType> types, EncogProgramContext context, boolean includeTerminal, boolean includeFunction)
types
- The return types to consider.context
- The program context.includeTerminal
- True, to include the terminals.includeFunction
- True, to include the functions.
public ProgramExtensionTemplate findOperator(char ch1, char ch2)
ch1
- The first character of the potential operator.ch2
- The second character of the potential operator. Zero if none.
public ProgramExtensionTemplate getOpCode(int theOpCode)
theOpCode
- The opcode index.
public List<ProgramExtensionTemplate> getOpCodes()
public Map<String,ProgramExtensionTemplate> getTemplateMap()
public boolean isDefined(String name, int l)
name
- The name of the opcode.l
- The argument count for the opcode.
public int size()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |