Class InstanceNode
InstanceNodes are the key building block of object-oriented Bayesian networks and influence diagrams.
Implements
Inherited Members
Namespace: HAPI
Assembly: hugincs-9.7-netstandard2.0-x64.dll
Syntax
public class InstanceNode : Node, ICloneable
Remarks
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".Constructors
InstanceNode(Class, Class)
Constructs a new InstanceNode. The InstanceNode is an instance of Class 'instanceOf' and is added to Class 'home'.
Declaration
public InstanceNode(Class home, Class instanceOf)
Parameters
| Type | Name | Description |
|---|---|---|
| Class | home | the home Class of the new InstanceNode. |
| Class | instanceOf | the Class from which to instantiate the new InstanceNode. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
Methods
GetCategory()
Returns the Category of this Node.
Declaration
public override Node.Category GetCategory()
Returns
| Type | Description |
|---|---|
| Node.Category |
Overrides
GetInput(Node)
Returns the actual input node bound to a formal input node for this InstanceNode.
Declaration
public Node GetInput(Node formalInput)
Parameters
| Type | Name | Description |
|---|---|---|
| Node | formalInput | The formal input node of this InstanceNode. |
Returns
| Type | Description |
|---|---|
| Node | The actual input - the node bound to |
Remarks
If there is no actual input to which the given formal input
is bound, null is returned.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetInstanceClass()
Returns the instance Class of this InstanceNode (i.e., the Class on which this InstanceNode is based).
Declaration
public Class GetInstanceClass()
Returns
| Type | Description |
|---|---|
| Class |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetKind()
Returns the Kind of this Node.
Declaration
public override Node.Kind GetKind()
Returns
| Type | Description |
|---|---|
| Node.Kind |
Overrides
GetOutput(Node)
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.
Declaration
public Node GetOutput(Node output)
Parameters
| Type | Name | Description |
|---|---|---|
| Node | output | the output node of the Class from which this InstanceNode has been instantiated. |
Returns
| Type | Description |
|---|---|
| Node |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetOutputs()
Returns the output nodes (i.e., output clones) of this InstanceNode.
Declaration
public NodeList GetOutputs()
Returns
| Type | Description |
|---|---|
| NodeList | NodeList containing the output Nodes of this InstanceNode. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetInput(Node, Node)
Binds a node to an input node of this InstanceNode.
Declaration
public void SetInput(Node formalInput, Node actualInput)
Parameters
| Type | Name | Description |
|---|---|---|
| Node | formalInput | the formal input node of this InstanceNode. This node is to be considered a placeholder for the 'actualInput'. |
| Node | actualInput | the actual input node to be bound to 'formalInput'. This node must belong to the same Class as this InstanceNode. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SubstituteClass(Class)
Replace the class that this instance node represents.
Declaration
public void SubstituteClass(Class newClass)
Parameters
| Type | Name | Description |
|---|---|---|
| Class | newClass | The class that the instance node should represent. |
Remarks
The node itself is not deleted during this operation, nor are the input and output nodes. However, new output nodes may be created.
This operation is only allowed, if the interface of the original class is a subset of the interface of the given newClass argument.Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
UnsetInput(Node)
Unbinds an input node of this InstanceNode.
Declaration
public void UnsetInput(Node formalInput)
Parameters
| Type | Name | Description |
|---|---|---|
| Node | formalInput | the input node to become unbound. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |