wGmdh.jGmdh.oldskul
Class TwoInputModel.VisitedHt

java.lang.Object
  extended by wGmdh.jGmdh.oldskul.TwoInputModel.VisitedHt
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
TwoInputModel

public class TwoInputModel.VisitedHt
extends java.lang.Object
implements java.io.Serializable

Uses a Hashtable to store pairs of Nodes and inputs for which they have calculated the output, to avoid multiple calculations of the same thing. Hashtable enables calculation if the outputs in paralell, on different Nodes, and for different inputs. (In contrast, take a single boolean flag per Node. This would allow us to mark visited subnodes in a single traversal, for a single input point, making computation in paralell impossible.)

See Also:
Serialized Form

Constructor Summary
TwoInputModel.VisitedHt()
           
 
Method Summary
 boolean isReset()
           
 boolean isVisited()
           
 void onVisit()
          Store the pair obtained in feed() to our Hashtable
 void resetVisited()
          Makes us forget everything we calculated.
 double returnOutput()
          In case we already have been visited, return the output given this.inputs.
 void setInputs(double[] inputs)
          Call it before checking with isVisited() or calling onVisit() or returnOutput() to get to know the inputs we're delaing with
 void setOutput(double output)
          Call it before checking with calling onVisit() to get to know the outputs we're delaing with
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwoInputModel.VisitedHt

public TwoInputModel.VisitedHt()
Method Detail

isVisited

public boolean isVisited()
Returns:
true if this.inputs and this.outputs exist as an entry in our hashmap

onVisit

public void onVisit()
Store the pair obtained in feed() to our Hashtable


resetVisited

public void resetVisited()
Makes us forget everything we calculated.


isReset

public boolean isReset()

setInputs

public void setInputs(double[] inputs)
Call it before checking with isVisited() or calling onVisit() or returnOutput() to get to know the inputs we're delaing with

Parameters:
inputs - the inputs to set

setOutput

public void setOutput(double output)
Call it before checking with calling onVisit() to get to know the outputs we're delaing with

Parameters:
output - the output to set

returnOutput

public double returnOutput()
In case we already have been visited, return the output given this.inputs.

Returns: