Back to index

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

The root node in the rule network. More...

#include <nsRuleNetwork.h>

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

List of all members.

Public Member Functions

virtual nsresult Propagate (const InstantiationSet &aInstantiations, void *aClosure)
 Propagate a set of instantiations "down" through the network.
virtual nsresult Constrain (InstantiationSet &aInstantiations, void *aClosure)
 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
 Retrieve the set of variables that are introduced by this node and any of its ancestors.
virtual PRBool HasAncestor (const ReteNode *aNode) const
 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.

Protected Attributes

ReteNodeSet mKids

Detailed Description

The root node in the rule network.

Definition at line 990 of file nsRuleNetwork.h.


Member Function Documentation

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

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:

nsresult RootNode::Constrain ( InstantiationSet aInstantiations,
void aClosure 
) [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

Implements InnerNode.

Definition at line 769 of file nsRuleNetwork.cpp.

{
    PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
           ("RootNode[%p]: Constrain()", this));

    return NS_OK;
}
nsresult RootNode::GetAncestorVariables ( VariableSet aVariables) const [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.

Implements InnerNode.

Definition at line 779 of file nsRuleNetwork.cpp.

{
    return NS_OK;
}
PRBool RootNode::HasAncestor ( const ReteNode aNode) const [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.

Implements InnerNode.

Definition at line 786 of file nsRuleNetwork.cpp.

{
    return aNode == this;
}
nsresult RootNode::Propagate ( const InstantiationSet aInstantiations,
void aClosure 
) [virtual]

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.

Implements ReteNode.

Definition at line 753 of file nsRuleNetwork.cpp.

{
    PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
           ("RootNode[%p]: Propagate() begin", this));

    ReteNodeSet::Iterator last = mKids.Last();
    for (ReteNodeSet::Iterator kid = mKids.First(); kid != last; ++kid)
        kid->Propagate(aInstantiations, aClosure);

    PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
           ("RootNode[%p]: Propagate() end", this));

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult InnerNode::RemoveAllChildren ( ) [inline, inherited]

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

ReteNodeSet InnerNode::mKids [protected, inherited]

Definition at line 982 of file nsRuleNetwork.h.


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