org.encog.ml.prg.extension

## Class BasicTemplate

- java.lang.Object
- - org.encog.ml.prg.extension.BasicTemplate

- All Implemented Interfaces:
    Serializable, ProgramExtensionTemplate

      public abstract class BasicTemplate
      extends Object
      implements ProgramExtensionTemplate

  A basic template.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from interface org.encog.ml.prg.extension.ProgramExtensionTemplate

      `NO_PREC`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicTemplate(int thePrecedence, String theSignature, NodeType theType, boolean isVariable, int theDataSize)` Construct a basic template object.
    `BasicTemplate(String theSignature)` Construct a function based on the provided signature.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getChildNodeCount()`
    `int` | `getDataSize()`
    `String` | `getName()`
    `NodeType` | `getNodeType()`
    `List<ParamTemplate>` | `getParams()`
    `int` | `getPrecedence()`
    `ParamTemplate` | `getReturnValue()`
    `String` | `getSignature()`
    `boolean` | `isPossibleReturnType(EncogProgramContext context, ValueType rtn)` Determines if the specified return type is a possible return type.
    `boolean` | `isVariable()`
    `void` | `randomize(Random rnd, List<ValueType> desiredTypes, ProgramNode actual, double minValue, double maxValue)` Randomize this actual tree node.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, 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,
                       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(String theSignature)

      Construct a function based on the provided signature.
      Parameters:
        `theSignature` - The signature.

  - ### Method Detail

    - #### getChildNodeCount

          public int getChildNodeCount()

      Specified by:
        `getChildNodeCount` in interface `ProgramExtensionTemplate`
      Returns:
        Get the number of child nodes that this opcode requires.

    - #### getDataSize

          public int getDataSize()

      Specified by:
        `getDataSize` in interface `ProgramExtensionTemplate`
      Returns:
        The size of extra data that is stored by this node.

    - #### getName

          public String getName()

      Specified by:
        `getName` in interface `ProgramExtensionTemplate`
      Returns:
        Get the name of this opcode.

    - #### getNodeType

          public NodeType getNodeType()

      Specified by:
        `getNodeType` in interface `ProgramExtensionTemplate`
      Returns:
        The node type.

    - #### getParams

          public List<ParamTemplate> getParams()

      Specified by:
        `getParams` in interface `ProgramExtensionTemplate`
      Returns:
        The parameters (child nodes) required by this node.

    - #### getPrecedence

          public int getPrecedence()

      Specified by:
        `getPrecedence` in interface `ProgramExtensionTemplate`
      Returns:
        The operator precedence.

    - #### getReturnValue

          public ParamTemplate getReturnValue()

      Specified by:
        `getReturnValue` in interface `ProgramExtensionTemplate`
      Returns:
        The return value for this opcode.

    - #### getSignature

          public 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:
        `isPossibleReturnType` in interface `ProgramExtensionTemplate`
      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:
        `isVariable` in interface `ProgramExtensionTemplate`
      Returns:
        Returns true if this node is variable.

    - #### randomize

          public void randomize(Random rnd,
                       List<ValueType> desiredTypes,
                       ProgramNode actual,
                       double minValue,
                       double maxValue)

      Randomize this actual tree node.
      Specified by:
        `randomize` in interface `ProgramExtensionTemplate`
      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 String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2014. All Rights Reserved.