COM.hugin.HAPI
Class InstanceNode

java.lang.Object
  |
  +--COM.hugin.HAPI.Node
        |
        +--COM.hugin.HAPI.InstanceNode

public class InstanceNode
extends Node

InstanceNodes are the key building block of object-oriented Bayesian networks and influence diagrams.

An InstanceNode represents an instance of a Class (i.e., a Bayesian network or an influence diagram). In other words, an instance node represents a subnetwork. The Class of which InstanceNodes exist in other Classes can itself contain InstanceNodes, whereby an object-oriented network can be viewed as a hierarchical description of a problem domain. Describing a network in a hierarchical fashion often makes the network much less cluttered, and thus provides a much better means of communicating ideas among knowledge engineers and users.

As systems often are composed of collections of identical or similar components, models of systems often contain repetitive patterns. The notion of InstanceNodes makes it very easy to construct multiple identical instances of a network fragment.

An InstanceNode is connected to other nodes via its interface nodes, which are the input Nodes and the output Nodes of the Class of which the InstanceNode is an instance. Chance nodes and decision nodes of the encapsulating Class (i.e., network) as well as output nodes of InstanceNodes of the encapsulating Class can be bound to input nodes of an InstanceNode.

As the output nodes of an InstanceNode can be parents of non-InstanceNodes, these output nodes are represented in the "home Class" of the InstanceNode as clones of the output nodes of the "instance Class" of the InstanceNode. Therefore, the output nodes of InstanceNodes are sometimes referred to as "output clones".


Constructor Summary
InstanceNode(Class home, Class instanceOf)
          Constructs a new InstanceNode.
 
Method Summary
 void delete()
          Deletes this InstanceNode.
 NetworkModel.Category getCategory()
          Returns the Category for this InstanceNode.
 Node getInput(Node formalInput)
          Returns the actual input node associated with a formal input node for this InstanceNode.
 Class getInstanceClass()
          Returns the instance Class of this InstanceNode (i.e., the Class on which this InstanceNode is based).
 NetworkModel.Kind getKind()
          Returns the Kind for this InstanceNode.
 Node getOutput(Node output)
          Returns the output node of this InstanceNode that is a clone of a given output node of the Class from which this InstanceNode has been instantiated.
 NodeList getOutputs()
          Returns the output nodes (i.e., output clones) of this InstanceNode.
 void setInput(Node formalInput, Node actualInput)
          Binds a node to an input node of this InstanceNode.
 void unsetInput(Node formalInput)
          Unbinds an input node of this InstanceNode.
 
Methods inherited from class COM.hugin.HAPI.Node
addParent, addToInputs, addToOutputs, evidenceIsEntered, evidenceIsPropagated, evidenceToPropagate, getAttribute, getAttributes, getChildren, getDomain, getEdgeConstraint, getHome, getHomeClass, getHomeDomain, getInstance, getJunctionTree, getLabel, getMaster, getModel, getName, getParents, getPosition, getSource, getUserData, likelihoodIsEntered, likelihoodIsPropagated, removeFromInputs, removeFromOutputs, removeParent, reverseEdge, setAttribute, setEdgeConstraint, setLabel, setName, setPosition, setUserData
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceNode

public InstanceNode(Class home,
                    Class instanceOf)
             throws ExceptionArgumentNotAlive,
                    ExceptionHugin
Constructs a new InstanceNode. The InstanceNode is an instance of Class 'instanceOf' and is added to Class 'home'.

Parameters:
home - the home Class of the new InstanceNode.
instanceClass - the Class from which to instantiate the new InstanceNode.
Method Detail

getCategory

public NetworkModel.Category getCategory()
                                  throws ExceptionObjectNotAlive
Returns the Category for this InstanceNode.

Overrides:
getCategory in class Node
Returns:
NetworkModel.H_CATEGORY_INSTANCE.

getKind

public NetworkModel.Kind getKind()
                          throws ExceptionObjectNotAlive
Returns the Kind for this InstanceNode.

Overrides:
getKind in class Node
Returns:
NetworkModel.H_KIND_DISCRETE.

getOutput

public Node getOutput(Node output)
               throws ExceptionObjectNotAlive,
                      ExceptionHugin
Returns the output node of this InstanceNode that is a clone of a given output node of the Class from which this InstanceNode has been instantiated.

Parameters:
output - the output node of the Class from which this InstanceNode has been instantiated.

getOutputs

public NodeList getOutputs()
                    throws ExceptionObjectNotAlive,
                           ExceptionHugin
Returns the output nodes (i.e., output clones) of this InstanceNode.

Returns:
NodeList containing the output Nodes of this InstanceNode.

setInput

public void setInput(Node formalInput,
                     Node actualInput)
              throws ExceptionObjectNotAlive,
                     ExceptionHugin
Binds a node to an input node of this InstanceNode.

Parameters:
formalInput - the formal input node of this InstanceNode. This node is to be considered a placeholder for the 'actualInput'.
actualInput - the actual input node to be bound to 'formalInput'. This node must belong to the same Class as this InstanceNode.

unsetInput

public void unsetInput(Node formalInput)
                throws ExceptionObjectNotAlive,
                       ExceptionHugin
Unbinds an input node of this InstanceNode.

Parameters:
formalInput - the input node to become unbound.

getInput

public Node getInput(Node formalInput)
              throws ExceptionObjectNotAlive,
                     ExceptionHugin
Returns the actual input node associated with a formal input node for this InstanceNode.

Parameters:
formalInput - The formal input node of this InstanceNode.

Returns:
The actual input - the node bound to 'formalInput'.

getInstanceClass

public Class getInstanceClass()
                       throws ExceptionObjectNotAlive,
                              ExceptionHugin
Returns the instance Class of this InstanceNode (i.e., the Class on which this InstanceNode is based).

delete

public void delete()
            throws ExceptionObjectNotAlive,
                   ExceptionHugin
Deletes this InstanceNode.
Overrides:
delete in class Node