com.cra.bnet.engine
Class AbstractNode

java.lang.Object
  |
  +--com.cra.bnet.engine.AbstractNode
All Implemented Interfaces:
AmgNode
Direct Known Subclasses:
AbstractQueueNode, ConstantNode, CptEntryNode, EvidenceNode

public abstract class AbstractNode
extends Object
implements AmgNode

Skeletal implementation of the Node interface. This class handles the child and parent lists, storage of and access to the value and derivative variables, computation of the derivative variable, and basic reset functionality.


Field Summary
protected  String derivativeName
           
protected  String name
           
protected  String valueName
           
 
Constructor Summary
AbstractNode()
           
 
Method Summary
protected  boolean addChild(AmgNode node)
          Adds the specified node to this node's child list.
protected  boolean addParent(AmgNode node)
          Adds the specified node to this node's parent list.
protected  double computeDerivative()
          Computes the derivative for this node.
protected abstract  double computeValue()
          Computes the value for this node.
protected abstract  String createName()
           
 List getChildren()
          Returns a list of this node's children.
 double getDerivative()
          Returns this node's derivative.
 String getDerivativeName()
          Returns this node's derivative name.
 String getName()
          Returns this node's name.
 List getParents()
          Returns a list of this node's parents.
 double getValue()
          Returns this node's value.
 String getValueName()
          Returns this node's value name.
 void reset()
          Resets this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected String name

valueName

protected String valueName

derivativeName

protected String derivativeName
Constructor Detail

AbstractNode

public AbstractNode()
Method Detail

getChildren

public List getChildren()
Description copied from interface: AmgNode
Returns a list of this node's children. Elements of the returned list are guaranteed to be of type Node.

Specified by:
getChildren in interface AmgNode
Returns:
a list of this node's children.

addChild

protected boolean addChild(AmgNode node)
Adds the specified node to this node's child list.

Parameters:
node - child node.
Returns:
true if the child was added and false if it was not.

getParents

public List getParents()
Description copied from interface: AmgNode
Returns a list of this node's parents. Elements of the returned list are guaranteed to be of type Node.

Specified by:
getParents in interface AmgNode
Returns:
a list of this node's parents.

addParent

protected boolean addParent(AmgNode node)
Adds the specified node to this node's parent list.

Parameters:
node - parent node.
Returns:
true if the child was added and false if it was not.

getValue

public double getValue()
Description copied from interface: AmgNode
Returns this node's value.

Specified by:
getValue in interface AmgNode
Returns:
this node's value.

computeValue

protected abstract double computeValue()
Computes the value for this node.

Returns:
the value for this node.

getDerivative

public double getDerivative()
Description copied from interface: AmgNode
Returns this node's derivative.

Specified by:
getDerivative in interface AmgNode
Returns:
this node's derivative.

computeDerivative

protected double computeDerivative()
Computes the derivative for this node.

Returns:
the derivative for this node.

reset

public void reset()
Description copied from interface: AmgNode
Resets this node.

Specified by:
reset in interface AmgNode

getName

public String getName()
Description copied from interface: AmgNode
Returns this node's name.

Specified by:
getName in interface AmgNode
Returns:
this node's name.

createName

protected abstract String createName()

getDerivativeName

public String getDerivativeName()
Description copied from interface: AmgNode
Returns this node's derivative name.

Specified by:
getDerivativeName in interface AmgNode
Returns:
this node's derivative name.

getValueName

public String getValueName()
Description copied from interface: AmgNode
Returns this node's value name.

Specified by:
getValueName in interface AmgNode
Returns:
this node's value name.