|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.epochx.representation.Node<TYPE>
com.epochx.representation.FunctionNode<Action>
com.epochx.representation.action.IfFoodAheadFunction
public class IfFoodAheadFunction
A FunctionNode which represents the conditional if-then-else
statement typically used in the artificial ant domain. This version of the
if statement has the condition predefined as a check for whether the next
move in the landscape contains a food item.
| Constructor Summary | |
|---|---|
IfFoodAheadFunction(Ant ant,
AntLandscape landscape)
Construct an IfFoodAheadFunction with no children. |
|
IfFoodAheadFunction(Ant ant,
AntLandscape landscape,
Node<Action> child1,
Node<Action> child2)
Construct an IfFoodAheadFunction with two children. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object obj)
Compare an object for equality. |
Action |
evaluate()
Evaluating an IfFoodAheadFunction involves identifying the
next location the ant would move to on the landscape were it to be moved. |
java.lang.String |
getFunctionName()
Get the unique name that identifies this function. |
| Methods inherited from class com.epochx.representation.FunctionNode |
|---|
toString |
| Methods inherited from class com.epochx.representation.Node |
|---|
clone, getArity, getChild, getChildren, getDepth, getFunctionNodes, getLength, getNodesAtDepth, getNoDistinctFunctions, getNoDistinctTerminals, getNoFunctions, getNoTerminals, getNthNode, getTerminalNodes, hashCode, setChild, setChildren, setNthNode |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IfFoodAheadFunction(Ant ant,
AntLandscape landscape)
ant - the ant which this function will be controlling.landscape - the landscape upon which the ant is roaming which will
be used to check for food locations.
public IfFoodAheadFunction(Ant ant,
AntLandscape landscape,
Node<Action> child1,
Node<Action> child2)
ant - the ant which this function will be controlling.landscape - the landscape upon which the ant is roaming which will
be used to check for food locations.child1 - The first child node.child2 - The second child node.| Method Detail |
|---|
public Action evaluate()
IfFoodAheadFunction involves identifying the
next location the ant would move to on the landscape were it to be moved.
If this position contains a food item then the first child is evaluated
and executed, else the second child is evaluated and executed.
One of the children will thus have been evaluated (triggering
execution of actions at the TerminalNodes) and then this
method which must return an Action, returns Action.DO_NOTHING which any
functions higher up in the program tree will execute, but with no
effect.
evaluate in class Node<Action>public java.lang.String getFunctionName()
getFunctionName in class FunctionNode<Action>public boolean equals(java.lang.Object obj)
Node
equals in class FunctionNode<Action>obj - an object to be compared for equivalence.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||