Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes
InnerNode Class Reference

An abstract base class for an "inner node" in the rule network. More...

#include <nsRuleNetwork.h>

Inheritance diagram for InnerNode:
Inheritance graph
[legend]
Collaboration diagram for InnerNode:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual nsresult Constrain (InstantiationSet &aInstantiations, void *aClosure)=0
 This is called by a child node on its parent to allow the parent's constraints to apply to the set of instantiations.
virtual nsresult GetAncestorVariables (VariableSet &aVariables) const =0
 Retrieve the set of variables that are introduced by this node and any of its ancestors.
virtual PRBool HasAncestor (const ReteNode *aNode) const =0
 Determine if this node has another node as its direct ancestor.
nsresult AddChild (ReteNode *aNode)
 Add another node as a child of this node.
nsresult RemoveAllChildren ()
 Remove all the children of this node.
virtual nsresult Propagate (const InstantiationSet &aInstantiations, void *aClosure)=0
 Propagate a set of instantiations "down" through the network.

Protected Attributes

ReteNodeSet mKids

Detailed Description

An abstract base class for an "inner node" in the rule network.

Adds support for children and "upward" queries.

Definition at line 922 of file nsRuleNetwork.h.


Member Function Documentation

nsresult InnerNode::AddChild ( ReteNode aNode) [inline]

Add another node as a child of this node.

Parameters:
aNodethe node to add.
Returns:
NS_OK if no errors occur.

Definition at line 973 of file nsRuleNetwork.h.

{ return mKids.Add(aNode); }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual nsresult InnerNode::Constrain ( InstantiationSet aInstantiations,
void aClosure 
) [pure virtual]

This is called by a child node on its parent to allow the parent's constraints to apply to the set of instantiations.

A node must iterate through the set of instantiations, and for each instantiation, either 1) extend the instantiation by adding variable-to-value assignments and memory element support for those assignments, or 2) remove the instantiation because it is inconsistent.

The node must then pass the resulting set of instantiations up to its parent (by recursive call; we should make this iterative & interruptable at some point.)

Parameters:
aInstantiationsthe set of instantiations that must be constrained
aClosureapplication-specific information that needs to be passed through the network.
Returns:
NS_OK if no errors occurred

Implemented in TestNode, JoinNode, and RootNode.

Here is the caller graph for this function:

virtual nsresult InnerNode::GetAncestorVariables ( VariableSet aVariables) const [pure virtual]

Retrieve the set of variables that are introduced by this node and any of its ancestors.

To correctly implement this method, a node must add any variables that it introduces to the variable set, and then recursively call GetAncestorVariables() on its parent (or parents).

Parameters:
aVariablesThe variable set to which the callee will add its variables, and its ancestors variables.
Returns:
NS_OK if no errors occur.

Implemented in TestNode, JoinNode, RootNode, nsRDFPropertyTestNode, nsRDFConInstanceTestNode, nsContentTestNode, nsRDFConMemberTestNode, nsTreeRowTestNode, and nsContentTagTestNode.

Here is the caller graph for this function:

virtual PRBool InnerNode::HasAncestor ( const ReteNode aNode) const [pure virtual]

Determine if this node has another node as its direct ancestor.

Parameters:
aNodethe node to look for.
Returns:
PR_TRUE if aNode is a direct ancestor of this node, PR_FALSE otherwise.

Implemented in TestNode, JoinNode, and RootNode.

Here is the caller graph for this function:

virtual nsresult ReteNode::Propagate ( const InstantiationSet aInstantiations,
void aClosure 
) [pure virtual, inherited]

Propagate a set of instantiations "down" through the network.

Each instantiation is a partial set of variable-to-value assignments, along with the memory elements that support it.

The node must evaluate each instantiation, and either 1) extend it with additional assignments and memory-element support, or 2) remove it from the set because it is inconsistent with the constraints that this node applies.

The node must then pass the resulting instantiation set along to any of its children in the network. (In other words, the node must recursively call Propagate() on its children. We should fix this to make the algorithm interruptable.)

Parameters:
aInstantiationsthe set of instantiations to propagate down through the network.
aClosureany application-specific information that needs to be passed through the network.
Returns:
NS_OK if no errors occurred.

Implemented in TestNode, JoinNode, RootNode, and nsInstantiationNode.

Here is the caller graph for this function:

Remove all the children of this node.

Returns:
NS_OK if no errors occur.

Definition at line 979 of file nsRuleNetwork.h.

{ return mKids.Clear(); }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 982 of file nsRuleNetwork.h.


The documentation for this class was generated from the following file: