This commit is contained in:
waterson%netscape.com 2001-11-07 04:25:41 +00:00
Родитель 38bf272e33
Коммит 86385dc75e
16 изменённых файлов: 73 добавлений и 73 удалений

Просмотреть файл

@ -66,7 +66,7 @@ nsInstantiationNode::~nsInstantiationNode()
}
nsresult
nsInstantiationNode::Propogate(const InstantiationSet& aInstantiations, void* aClosure)
nsInstantiationNode::Propagate(const InstantiationSet& aInstantiations, void* aClosure)
{
// If we get here, we've matched the rule associated with this
// node. Extend it with any <bindings> that we might have, add it

Просмотреть файл

@ -47,7 +47,7 @@ class nsTemplateRule;
/**
* A leaf-level node in the rule network. If any instantiations
* propogate to this node, then we know we've matched a rule.
* propagate to this node, then we know we've matched a rule.
*/
class nsInstantiationNode : public ReteNode
{
@ -59,7 +59,7 @@ public:
~nsInstantiationNode();
// "downward" propogations
virtual nsresult Propogate(const InstantiationSet& aInstantiations, void* aClosure);
virtual nsresult Propagate(const InstantiationSet& aInstantiations, void* aClosure);
protected:
nsConflictSet& mConflictSet;

Просмотреть файл

@ -283,14 +283,14 @@ nsRDFConInstanceTestNode::GetAncestorVariables(VariableSet& aVariables) const
}
PRBool
nsRDFConInstanceTestNode::CanPropogate(nsIRDFResource* aSource,
nsRDFConInstanceTestNode::CanPropagate(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
nsIRDFNode* aTarget,
Instantiation& aInitialBindings) const
{
nsresult rv;
PRBool canpropogate = PR_FALSE;
PRBool canpropagate = PR_FALSE;
nsCOMPtr<nsIRDFContainerUtils> rdfc
= do_GetService("@mozilla.org/rdf/container-utils;1");
@ -298,12 +298,12 @@ nsRDFConInstanceTestNode::CanPropogate(nsIRDFResource* aSource,
if (! rdfc)
return NS_ERROR_FAILURE;
// We can certainly propogate ordinal properties
rv = rdfc->IsOrdinalProperty(aProperty, &canpropogate);
// We can certainly propagate ordinal properties
rv = rdfc->IsOrdinalProperty(aProperty, &canpropagate);
if (NS_FAILED(rv)) return PR_FALSE;
if (! canpropogate) {
canpropogate = mMembershipProperties.Contains(aProperty);
if (! canpropagate) {
canpropagate = mMembershipProperties.Contains(aProperty);
}
#ifdef PR_LOGGING
@ -318,13 +318,13 @@ nsRDFConInstanceTestNode::CanPropogate(nsIRDFResource* aSource,
nsXULContentUtils::GetTextForNode(aTarget, target);
PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
("nsRDFConInstanceTestNode[%p]: CanPropogate([%s]==[%s]=>[%s]) => %s",
("nsRDFConInstanceTestNode[%p]: CanPropagate([%s]==[%s]=>[%s]) => %s",
this, source, property, NS_ConvertUCS2toUTF8(target).get(),
canpropogate ? "true" : "false"));
canpropagate ? "true" : "false"));
}
#endif
if (canpropogate) {
if (canpropagate) {
aInitialBindings.AddAssignment(mContainerVariable, Value(aSource));
return PR_TRUE;
}

Просмотреть файл

@ -70,7 +70,7 @@ public:
virtual nsresult GetAncestorVariables(VariableSet& aVariables) const;
virtual PRBool
CanPropogate(nsIRDFResource* aSource,
CanPropagate(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
nsIRDFNode* aTarget,
Instantiation& aInitialBindings) const;

Просмотреть файл

@ -497,14 +497,14 @@ nsRDFConMemberTestNode::GetAncestorVariables(VariableSet& aVariables) const
PRBool
nsRDFConMemberTestNode::CanPropogate(nsIRDFResource* aSource,
nsRDFConMemberTestNode::CanPropagate(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
nsIRDFNode* aTarget,
Instantiation& aInitialBindings) const
{
nsresult rv;
PRBool canpropogate = PR_FALSE;
PRBool canpropagate = PR_FALSE;
nsCOMPtr<nsIRDFContainerUtils> rdfc =
do_GetService("@mozilla.org/rdf/container-utils;1");
@ -512,12 +512,12 @@ nsRDFConMemberTestNode::CanPropogate(nsIRDFResource* aSource,
if (! rdfc)
return NS_ERROR_FAILURE;
// We can certainly propogate ordinal properties
rv = rdfc->IsOrdinalProperty(aProperty, &canpropogate);
// We can certainly propagate ordinal properties
rv = rdfc->IsOrdinalProperty(aProperty, &canpropagate);
if (NS_FAILED(rv)) return PR_FALSE;
if (! canpropogate) {
canpropogate = mMembershipProperties.Contains(aProperty);
if (! canpropagate) {
canpropagate = mMembershipProperties.Contains(aProperty);
}
#ifdef PR_LOGGING
@ -532,13 +532,13 @@ nsRDFConMemberTestNode::CanPropogate(nsIRDFResource* aSource,
nsXULContentUtils::GetTextForNode(aTarget, target);
PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
("nsRDFConMemberTestNode[%p]: CanPropogate([%s]==[%s]=>[%s]) => %s",
("nsRDFConMemberTestNode[%p]: CanPropagate([%s]==[%s]=>[%s]) => %s",
this, source, property, NS_ConvertUCS2toUTF8(target).get(),
canpropogate ? "true" : "false"));
canpropagate ? "true" : "false"));
}
#endif
if (canpropogate) {
if (canpropagate) {
aInitialBindings.AddAssignment(mContainerVariable, Value(aSource));
aInitialBindings.AddAssignment(mMemberVariable, Value(aTarget));
return PR_TRUE;

Просмотреть файл

@ -67,7 +67,7 @@ public:
virtual nsresult GetAncestorVariables(VariableSet& aVariables) const;
virtual PRBool
CanPropogate(nsIRDFResource* aSource,
CanPropagate(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
nsIRDFNode* aTarget,
Instantiation& aInitialBindings) const;

Просмотреть файл

@ -351,7 +351,7 @@ nsRDFPropertyTestNode::GetAncestorVariables(VariableSet& aVariables) const
}
PRBool
nsRDFPropertyTestNode::CanPropogate(nsIRDFResource* aSource,
nsRDFPropertyTestNode::CanPropagate(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
nsIRDFNode* aTarget,
Instantiation& aInitialBindings) const
@ -385,7 +385,7 @@ nsRDFPropertyTestNode::CanPropogate(nsIRDFResource* aSource,
nsXULContentUtils::GetTextForNode(aTarget, target);
PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
("nsRDFPropertyTestNode[%p]: CanPropogate([%s]==[%s]=>[%s]) => %s",
("nsRDFPropertyTestNode[%p]: CanPropagate([%s]==[%s]=>[%s]) => %s",
this, source, property, NS_ConvertUCS2toUTF8(target).get(),
result ? "true" : "false"));
}

Просмотреть файл

@ -85,7 +85,7 @@ public:
virtual nsresult GetAncestorVariables(VariableSet& aVariables) const;
virtual PRBool
CanPropogate(nsIRDFResource* aSource,
CanPropagate(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
nsIRDFNode* aTarget,
Instantiation& aInitialBindings) const;

Просмотреть файл

@ -57,17 +57,17 @@ public:
: TestNode(aParent) {}
/**
* Determine wether the node can propogate an assertion
* Determine wether the node can propagate an assertion
* with the specified source, property, and target. If the
* assertion can be propogated, aInitialBindings will be
* assertion can be propagated, aInitialBindings will be
* initialized with appropriate variable-to-value assignments
* to allow the rule network to start a constrain and propogate
* to allow the rule network to start a constrain and propagate
* search from this node in the network.
*
* @return PR_TRUE if the node can propogate the specified
* @return PR_TRUE if the node can propagate the specified
* assertion.
*/
virtual PRBool CanPropogate(nsIRDFResource* aSource,
virtual PRBool CanPropagate(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
nsIRDFNode* aTarget,
Instantiation& aInitialBindings) const = 0;

Просмотреть файл

@ -43,7 +43,7 @@
To Do.
- Constrain() & Propogate() still feel like they are poorly named.
- Constrain() & Propagate() still feel like they are poorly named.
- As do Instantiation and InstantiationSet.
- Make InstantiationSet share and do copy-on-write.
- Make things iterative, instead of recursive.
@ -750,17 +750,17 @@ InstantiationSet::HasAssignmentFor(PRInt32 aVariable) const
//
nsresult
RootNode::Propogate(const InstantiationSet& aInstantiations, void* aClosure)
RootNode::Propagate(const InstantiationSet& aInstantiations, void* aClosure)
{
PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
("RootNode[%p]: Propogate() begin", this));
("RootNode[%p]: Propagate() begin", this));
ReteNodeSet::Iterator last = mKids.Last();
for (ReteNodeSet::Iterator kid = mKids.First(); kid != last; ++kid)
kid->Propogate(aInstantiations, aClosure);
kid->Propagate(aInstantiations, aClosure);
PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
("RootNode[%p]: Propogate() end", this));
("RootNode[%p]: Propagate() end", this));
return NS_OK;
}
@ -809,9 +809,9 @@ JoinNode::JoinNode(InnerNode* aLeftParent,
}
nsresult
JoinNode::Propogate(const InstantiationSet& aInstantiations, void* aClosure)
JoinNode::Propagate(const InstantiationSet& aInstantiations, void* aClosure)
{
// the add will have been propogated down from one of the parent
// the add will have been propagated down from one of the parent
// nodes: either the left or the right. Test the other node for
// matches.
nsresult rv;
@ -848,13 +848,13 @@ JoinNode::Propogate(const InstantiationSet& aInstantiations, void* aClosure)
}
if (! instantiations.Empty()) {
// propogate consistency checking back up the tree
// propagate consistency checking back up the tree
rv = test->Constrain(instantiations, aClosure);
if (NS_FAILED(rv)) return rv;
ReteNodeSet::Iterator last = mKids.Last();
for (ReteNodeSet::Iterator kid = mKids.First(); kid != last; ++kid)
kid->Propogate(instantiations, aClosure);
kid->Propagate(instantiations, aClosure);
}
return NS_OK;
@ -1033,12 +1033,12 @@ TestNode::TestNode(InnerNode* aParent)
nsresult
TestNode::Propogate(const InstantiationSet& aInstantiations, void* aClosure)
TestNode::Propagate(const InstantiationSet& aInstantiations, void* aClosure)
{
nsresult rv;
PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
("TestNode[%p]: Propogate() begin", this));
("TestNode[%p]: Propagate() begin", this));
InstantiationSet instantiations = aInstantiations;
rv = FilterInstantiations(instantiations, aClosure);
@ -1048,14 +1048,14 @@ TestNode::Propogate(const InstantiationSet& aInstantiations, void* aClosure)
ReteNodeSet::Iterator last = mKids.Last();
for (ReteNodeSet::Iterator kid = mKids.First(); kid != last; ++kid) {
PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
("TestNode[%p]: Propogate() passing to child %p", this, kid.operator->()));
("TestNode[%p]: Propagate() passing to child %p", this, kid.operator->()));
kid->Propogate(instantiations, aClosure);
kid->Propagate(instantiations, aClosure);
}
}
PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
("TestNode[%p]: Propogate() end", this));
("TestNode[%p]: Propagate() end", this));
return NS_OK;
}

Просмотреть файл

@ -799,7 +799,7 @@ public:
virtual ~ReteNode() {}
/**
* Propogate a set of instantiations "down" through the
* 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.
@ -811,16 +811,16 @@ public:
*
* 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 Propogate() on its children. We
* node must recursively call Propagate() on its children. We
* should fix this to make the algorithm interruptable.)
*
* @param aInstantiations the set of instantiations to propogate
* @param aInstantiations the set of instantiations to propagate
* down through the network.
* @param aClosure any application-specific information that
* needs to be passed through the network.
* @return NS_OK if no errors occurred.
*/
virtual nsresult Propogate(const InstantiationSet& aInstantiations, void* aClosure) = 0;
virtual nsresult Propagate(const InstantiationSet& aInstantiations, void* aClosure) = 0;
};
//----------------------------------------------------------------------
@ -992,7 +992,7 @@ class RootNode : public InnerNode
{
public:
// "downward" propogations
virtual nsresult Propogate(const InstantiationSet& aInstantiations, void* aClosure);
virtual nsresult Propagate(const InstantiationSet& aInstantiations, void* aClosure);
// "upward" propogations
virtual nsresult Constrain(InstantiationSet& aInstantiations, void* aClosure);
@ -1021,7 +1021,7 @@ public:
Operator aOperator);
// "downward" propogations
virtual nsresult Propogate(const InstantiationSet& aInstantiations, void* aClosure);
virtual nsresult Propagate(const InstantiationSet& aInstantiations, void* aClosure);
// "upward" propogations
virtual nsresult Constrain(InstantiationSet& aInstantiations, void* aClosure);
@ -1048,7 +1048,7 @@ protected:
/**
* A node that applies a test condition to a set of instantiations.
*
* This class provides implementations of Propogate() and Constrain()
* This class provides implementations of Propagate() and Constrain()
* in terms of one simple operation, FilterInstantiations(). A node
* that is a "simple test node" in a rule network should derive from
* this class, and need only implement FilterInstantiations() and
@ -1067,14 +1067,14 @@ public:
/**
* Calls FilterInstantiations() on the instantiation set, and if
* the resulting set isn't empty, propogates the new set down to
* the resulting set isn't empty, propagates the new set down to
* each of the test node's children.
*/
virtual nsresult Propogate(const InstantiationSet& aInstantiations, void* aClosure);
virtual nsresult Propagate(const InstantiationSet& aInstantiations, void* aClosure);
/**
* Calls FilterInstantiations() on the instantiation set, and if
* the resulting set isn't empty, propogates the new set up to the
* the resulting set isn't empty, propagates the new set up to the
* test node's parent.
*/
virtual nsresult Constrain(InstantiationSet& aInstantiations, void* aClosure);

Просмотреть файл

@ -426,7 +426,7 @@ nsXULContentBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
// If |aNotify| is "false", then |aContainer| and
// |aNewIndexInContainer| are used to determine where in the
// content model new content is constructed. This allows a single
// notification to be propogated to document observers.
// notification to be propagated to document observers.
//
nsresult rv;
@ -1254,16 +1254,16 @@ nsXULContentBuilder::CreateContainerContents(nsIContent* aElement,
// container variables
//
// XXXwaterson could this code be shared with
// nsXULTemplateBuilder::Propogate()?
// nsXULTemplateBuilder::Propagate()?
Instantiation seed;
seed.AddAssignment(mContentVar, Value(aElement));
InstantiationSet instantiations;
instantiations.Append(seed);
// Propogate the assignments through the network
// Propagate the assignments through the network
nsClusterKeySet newkeys;
mRules.GetRoot()->Propogate(instantiations, &newkeys);
mRules.GetRoot()->Propagate(instantiations, &newkeys);
// Iterate through newly added keys to determine which rules fired
nsClusterKeySet::ConstIterator last = newkeys.Last();

Просмотреть файл

@ -1511,9 +1511,9 @@ nsXULOutlinerBuilder::OpenSubtreeOf(nsOutlinerRows::Subtree* aSubtree,
InstantiationSet instantiations;
instantiations.Append(seed);
// Propogate the assignments through the network
// Propagate the assignments through the network
nsClusterKeySet newkeys;
mRules.GetRoot()->Propogate(instantiations, &newkeys);
mRules.GetRoot()->Propagate(instantiations, &newkeys);
nsAutoVoidArray open;
PRInt32 count = 0;

Просмотреть файл

@ -450,18 +450,18 @@ nsXULTemplateBuilder::DocumentWillBeDestroyed(nsIDocument *aDocument)
//
nsresult
nsXULTemplateBuilder::Propogate(nsIRDFResource* aSource,
nsXULTemplateBuilder::Propagate(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
nsIRDFNode* aTarget,
nsClusterKeySet& aNewKeys)
{
// Find the "dominating" tests that could be used to propogate the
// Find the "dominating" tests that could be used to propagate the
// assertion we've just received. (Test A "dominates" test B if A
// is an ancestor of B in the rule network).
nsresult rv;
// First, we'll go through and find all of the test nodes that can
// propogate the assertion.
// propagate the assertion.
ReteNodeSet livenodes;
{
@ -470,14 +470,14 @@ nsXULTemplateBuilder::Propogate(nsIRDFResource* aSource,
nsRDFTestNode* rdftestnode = NS_STATIC_CAST(nsRDFTestNode*, *i);
Instantiation seed;
if (rdftestnode->CanPropogate(aSource, aProperty, aTarget, seed)) {
if (rdftestnode->CanPropagate(aSource, aProperty, aTarget, seed)) {
livenodes.Add(rdftestnode);
}
}
}
// Now, we'll go through each, and any that aren't dominated by
// another live node will be used to propogate the assertion
// another live node will be used to propagate the assertion
// through the rule network
{
ReteNodeSet::Iterator last = livenodes.Last();
@ -500,7 +500,7 @@ nsXULTemplateBuilder::Propogate(nsIRDFResource* aSource,
if (! isdominated) {
// Bogus, to get the seed instantiation
Instantiation seed;
rdftestnode->CanPropogate(aSource, aProperty, aTarget, seed);
rdftestnode->CanPropagate(aSource, aProperty, aTarget, seed);
InstantiationSet instantiations;
instantiations.Append(seed);
@ -509,7 +509,7 @@ nsXULTemplateBuilder::Propogate(nsIRDFResource* aSource,
if (NS_FAILED(rv)) return rv;
if (! instantiations.Empty()) {
rv = rdftestnode->Propogate(instantiations, &aNewKeys);
rv = rdftestnode->Propagate(instantiations, &aNewKeys);
if (NS_FAILED(rv)) return rv;
}
}
@ -579,7 +579,7 @@ nsXULTemplateBuilder::OnAssert(nsIRDFDataSource* aDataSource,
LOG("onassert", aSource, aProperty, aTarget);
nsClusterKeySet newkeys;
rv = Propogate(aSource, aProperty, aTarget, newkeys);
rv = Propagate(aSource, aProperty, aTarget, newkeys);
if (NS_FAILED(rv)) return rv;
rv = FireNewlyMatchedRules(newkeys);
@ -693,7 +693,7 @@ nsXULTemplateBuilder::OnChange(nsIRDFDataSource* aDataSource,
if (aNewTarget) {
// Fire any new rules that are activated by aNewTarget
nsClusterKeySet newkeys;
rv = Propogate(aSource, aProperty, aNewTarget, newkeys);
rv = Propagate(aSource, aProperty, aNewTarget, newkeys);
if (NS_FAILED(rv)) return rv;
rv = FireNewlyMatchedRules(newkeys);

Просмотреть файл

@ -332,7 +332,7 @@ public:
nsIRDFNode* aNewTarget);
nsresult
Propogate(nsIRDFResource* aSource,
Propagate(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
nsIRDFNode* aTarget,
nsClusterKeySet& aNewKeys);

Просмотреть файл

@ -1511,9 +1511,9 @@ nsXULOutlinerBuilder::OpenSubtreeOf(nsOutlinerRows::Subtree* aSubtree,
InstantiationSet instantiations;
instantiations.Append(seed);
// Propogate the assignments through the network
// Propagate the assignments through the network
nsClusterKeySet newkeys;
mRules.GetRoot()->Propogate(instantiations, &newkeys);
mRules.GetRoot()->Propagate(instantiations, &newkeys);
nsAutoVoidArray open;
PRInt32 count = 0;