Back to index

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

Rule network node that test if a resource is a member of an RDF container, or is contained'' by another resource that refers to it using acontainment'' attribute. More...

#include <nsRDFConMemberTestNode.h>

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

List of all members.

Classes

class  Element

Public Member Functions

 nsRDFConMemberTestNode (InnerNode *aParent, nsConflictSet &aConflictSet, nsIRDFDataSource *aDataSource, const nsResourceSet &aMembershipProperties, PRInt32 aContainerVariable, PRInt32 aMemberVariable)
virtual nsresult FilterInstantiations (InstantiationSet &aInstantiations, void *aClosure) const
 Given a set of instantiations, filter out any that are inconsistent with the test node's test, and append variable-to-value assignments and memory element support for those which do pass the test node's test.
virtual nsresult GetAncestorVariables (VariableSet &aVariables) const
 Retrieve the set of variables that are introduced by this node and any of its ancestors.
virtual PRBool CanPropagate (nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, Instantiation &aInitialBindings) const
 Determine wether the node can propagate an assertion with the specified source, property, and target.
virtual void Retract (nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, nsTemplateMatchSet &aFirings, nsTemplateMatchSet &aRetractions) const
 
  

InnerNodeGetParent () const
 Retrieve the test node's parent.
virtual nsresult Propagate (const InstantiationSet &aInstantiations, void *aClosure)
 Calls FilterInstantiations() on the instantiation set, and if the resulting set isn't empty, propagates the new set down to each of the test node's children.
virtual nsresult Constrain (InstantiationSet &aInstantiations, void *aClosure)
 Calls FilterInstantiations() on the instantiation set, and if the resulting set isn't empty, propagates the new set up to the test node's parent.
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

nsConflictSetmConflictSet
nsCOMPtr< nsIRDFDataSourcemDataSource
const nsResourceSetmMembershipProperties
PRInt32 mContainerVariable
PRInt32 mMemberVariable
InnerNodemParent
ReteNodeSet mKids

Detailed Description

Rule network node that test if a resource is a member of an RDF container, or is contained'' by another resource that refers to it using acontainment'' attribute.

Definition at line 54 of file nsRDFConMemberTestNode.h.


Constructor & Destructor Documentation

nsRDFConMemberTestNode::nsRDFConMemberTestNode ( InnerNode aParent,
nsConflictSet aConflictSet,
nsIRDFDataSource aDataSource,
const nsResourceSet aMembershipProperties,
PRInt32  aContainerVariable,
PRInt32  aMemberVariable 
)

Definition at line 54 of file nsRDFConMemberTestNode.cpp.

    : nsRDFTestNode(aParent),
      mConflictSet(aConflictSet),
      mDataSource(aDataSource),
      mMembershipProperties(aMembershipProperties),
      mContainerVariable(aContainerVariable),
      mMemberVariable(aMemberVariable)
{
#ifdef PR_LOGGING
    if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) {
        nsCAutoString props;

        nsResourceSet::ConstIterator last = aMembershipProperties.Last();
        nsResourceSet::ConstIterator first = aMembershipProperties.First();
        nsResourceSet::ConstIterator iter;

        for (iter = first; iter != last; ++iter) {
            if (iter != first)
                props += " ";

            const char* str;
            iter->GetValueConst(&str);

            props += str;
        }

        PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
               ("nsRDFConMemberTestNode[%p]: parent=%p member-props=(%s) container-var=%d member-var=%d",
                this,
                aParent,
                props.get(),
                mContainerVariable,
                mMemberVariable));
    }
#endif
}

Here is the call graph for this function:


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:

PRBool nsRDFConMemberTestNode::CanPropagate ( nsIRDFResource aSource,
nsIRDFResource aProperty,
nsIRDFNode aTarget,
Instantiation aInitialBindings 
) const [virtual]

Determine wether the node can propagate an assertion with the specified source, property, and target.

If the assertion can be propagated, aInitialBindings will be initialized with appropriate variable-to-value assignments to allow the rule network to start a constrain and propagate search from this node in the network.

Returns:
PR_TRUE if the node can propagate the specified assertion.

Implements nsRDFTestNode.

Definition at line 499 of file nsRDFConMemberTestNode.cpp.

{
    nsresult rv;

    PRBool canpropagate = PR_FALSE;

    nsCOMPtr<nsIRDFContainerUtils> rdfc =
        do_GetService("@mozilla.org/rdf/container-utils;1");

    if (! rdfc)
        return NS_ERROR_FAILURE;

    // We can certainly propagate ordinal properties
    rv = rdfc->IsOrdinalProperty(aProperty, &canpropagate);
    if (NS_FAILED(rv)) return PR_FALSE;

    if (! canpropagate) {
        canpropagate = mMembershipProperties.Contains(aProperty);
    }

#ifdef PR_LOGGING
    if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) {
        const char* source;
        aSource->GetValueConst(&source);

        const char* property;
        aProperty->GetValueConst(&property);

        nsAutoString target;
        nsXULContentUtils::GetTextForNode(aTarget, target);

        PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
               ("nsRDFConMemberTestNode[%p]: CanPropagate([%s]==[%s]=>[%s]) => %s",
                this, source, property, NS_ConvertUCS2toUTF8(target).get(),
                canpropagate ? "true" : "false"));
    }
#endif

    if (canpropagate) {
        aInitialBindings.AddAssignment(mContainerVariable, Value(aSource));
        aInitialBindings.AddAssignment(mMemberVariable, Value(aTarget));
        return PR_TRUE;
    }

    return PR_FALSE;
}

Here is the call graph for this function:

nsresult TestNode::Constrain ( InstantiationSet aInstantiations,
void aClosure 
) [virtual, inherited]

Calls FilterInstantiations() on the instantiation set, and if the resulting set isn't empty, propagates the new set up to the test node's parent.

Implements InnerNode.

Definition at line 1065 of file nsRuleNetwork.cpp.

{
    nsresult rv;

    PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
           ("TestNode[%p]: Constrain() begin", this));

    rv = FilterInstantiations(aInstantiations, aClosure);
    if (NS_FAILED(rv)) return rv;

    if (! aInstantiations.Empty()) {
        // if we still have instantiations, then ride 'em on up to the
        // parent to narrow them.

        PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
               ("TestNode[%p]: Constrain() passing to parent %p", this, mParent));

        rv = mParent->Constrain(aInstantiations, aClosure);
    }
    else {
        PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
               ("TestNode[%p]: Constrain() failed", this));

        rv = NS_OK;
    }

    PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
           ("TestNode[%p]: Constrain() end", this));

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsRDFConMemberTestNode::FilterInstantiations ( InstantiationSet aInstantiations,
void aClosure 
) const [virtual]

Given a set of instantiations, filter out any that are inconsistent with the test node's test, and append variable-to-value assignments and memory element support for those which do pass the test node's test.

Parameters:
aInstantiationsthe set of instantiations to be filtered
aClosureapplication-specific data that is to be passed through the network.
Returns:
NS_OK if no errors occurred.

Implements TestNode.

Definition at line 97 of file nsRDFConMemberTestNode.cpp.

{
    // XXX Uh, factor me, please!
    nsresult rv;

    nsCOMPtr<nsIRDFContainerUtils> rdfc =
        do_GetService("@mozilla.org/rdf/container-utils;1");

    if (! rdfc)
        return NS_ERROR_FAILURE;

    InstantiationSet::Iterator last = aInstantiations.Last();
    for (InstantiationSet::Iterator inst = aInstantiations.First(); inst != last; ++inst) {
        PRBool hasContainerBinding;
        Value containerValue;
        hasContainerBinding = inst->mAssignments.GetAssignmentFor(mContainerVariable, &containerValue);

        nsCOMPtr<nsIRDFContainer> rdfcontainer;

        if (hasContainerBinding) {
            // If we have a container assignment, then see if the
            // container is an RDF container (bag, seq, alt), and if
            // so, wrap it.
            PRBool isRDFContainer;
            rv = rdfc->IsContainer(mDataSource,
                                   VALUE_TO_IRDFRESOURCE(containerValue),
                                   &isRDFContainer);
            if (NS_FAILED(rv)) return rv;

            if (isRDFContainer) {
                rdfcontainer = do_CreateInstance("@mozilla.org/rdf/container;1", &rv);
                if (NS_FAILED(rv)) return rv;

                rv = rdfcontainer->Init(mDataSource, VALUE_TO_IRDFRESOURCE(containerValue));
                if (NS_FAILED(rv)) return rv;
            }
        }

        PRBool hasMemberBinding;
        Value memberValue;
        hasMemberBinding = inst->mAssignments.GetAssignmentFor(mMemberVariable, &memberValue);

#ifdef PR_LOGGING
        if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) {
            const char* container = "(unbound)";
            if (hasContainerBinding)
                VALUE_TO_IRDFRESOURCE(containerValue)->GetValueConst(&container);

            nsAutoString member(NS_LITERAL_STRING("(unbound)"));
            if (hasMemberBinding)
                nsXULContentUtils::GetTextForNode(VALUE_TO_IRDFRESOURCE(memberValue), member);

            PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
                   ("nsRDFConMemberTestNode[%p]: FilterInstantiations() container=[%s] member=[%s]",
                    this, container, NS_ConvertUCS2toUTF8(member).get()));
        }
#endif

        if (hasContainerBinding && hasMemberBinding) {
            // it's a consistency check. see if we have a assignment that is consistent
            PRBool isconsistent = PR_FALSE;

            if (rdfcontainer) {
                // RDF containers are easy. Just use the container API.
                PRInt32 index;
                rv = rdfcontainer->IndexOf(VALUE_TO_IRDFRESOURCE(memberValue), &index);
                if (NS_FAILED(rv)) return rv;

                if (index >= 0)
                    isconsistent = PR_TRUE;
            }

            // XXXwaterson oof. if we *are* an RDF container, why do
            // we still need to grovel through all the containment
            // properties if the thing we're looking for wasn't there?

            if (! isconsistent) {
                // Othewise, we'll need to grovel through the
                // membership properties to see if we have an
                // assertion that indicates membership.
                for (nsResourceSet::ConstIterator property = mMembershipProperties.First();
                     property != mMembershipProperties.Last();
                     ++property) {
                    PRBool hasAssertion;
                    rv = mDataSource->HasAssertion(VALUE_TO_IRDFRESOURCE(containerValue),
                                                   *property,
                                                   VALUE_TO_IRDFNODE(memberValue),
                                                   PR_TRUE,
                                                   &hasAssertion);
                    if (NS_FAILED(rv)) return rv;

                    if (hasAssertion) {
                        // it's consistent. leave it in the set and we'll
                        // run it up to our parent.
                        isconsistent = PR_TRUE;
                        break;
                    }
                }
            }

            PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
                   ("    consistency check => %s", isconsistent ? "passed" : "failed"));

            if (isconsistent) {
                // Add a memory element to our set-of-support.
                Element* element =
                    nsRDFConMemberTestNode::Element::Create(mConflictSet.GetPool(),
                                                            VALUE_TO_IRDFRESOURCE(containerValue),
                                                            VALUE_TO_IRDFNODE(memberValue));

                if (! element)
                    return NS_ERROR_OUT_OF_MEMORY;

                inst->AddSupportingElement(element);
            }
            else {
                // it's inconsistent. remove it.
                aInstantiations.Erase(inst--);
            }

            // We're done, go on to the next instantiation
            continue;
        }

        if (hasContainerBinding && rdfcontainer) {
            // We've got a container assignment, and the container is
            // bound to an RDF container. Add each member as a new
            // instantiation.
            nsCOMPtr<nsISimpleEnumerator> elements;
            rv = rdfcontainer->GetElements(getter_AddRefs(elements));
            if (NS_FAILED(rv)) return rv;

            while (1) {
                PRBool hasmore;
                rv = elements->HasMoreElements(&hasmore);
                if (NS_FAILED(rv)) return rv;

                if (! hasmore)
                    break;

                nsCOMPtr<nsISupports> isupports;
                rv = elements->GetNext(getter_AddRefs(isupports));
                if (NS_FAILED(rv)) return rv;

                nsCOMPtr<nsIRDFNode> node = do_QueryInterface(isupports);
                if (! node)
                    return NS_ERROR_UNEXPECTED;

#ifdef PR_LOGGING
                if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) {
                    nsAutoString member;
                    nsXULContentUtils::GetTextForNode(node, member);

                    PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
                           ("    member => %s", NS_ConvertUCS2toUTF8(member).get()));
                }
#endif

                Instantiation newinst = *inst;
                newinst.AddAssignment(mMemberVariable, Value(node.get()));

                Element* element =
                    nsRDFConMemberTestNode::Element::Create(mConflictSet.GetPool(),
                                                            VALUE_TO_IRDFRESOURCE(containerValue),
                                                            node);

                if (! element)
                    return NS_ERROR_OUT_OF_MEMORY;

                newinst.AddSupportingElement(element);

                aInstantiations.Insert(inst, newinst);
            }
        }

        if (hasMemberBinding) {
            // Oh, this is so nasty. If we have a member assignment, then
            // grovel through each one of our inbound arcs to see if
            // any of them are ordinal properties (like an RDF
            // container might have). If so, walk it backwards to get
            // the container we're in.
            nsCOMPtr<nsISimpleEnumerator> arcsin;
            rv = mDataSource->ArcLabelsIn(VALUE_TO_IRDFNODE(memberValue), getter_AddRefs(arcsin));
            if (NS_FAILED(rv)) return rv;

            while (1) {
                nsCOMPtr<nsIRDFResource> property;

                {
                    PRBool hasmore;
                    rv = arcsin->HasMoreElements(&hasmore);
                    if (NS_FAILED(rv)) return rv;

                    if (! hasmore)
                        break;

                    nsCOMPtr<nsISupports> isupports;
                    rv = arcsin->GetNext(getter_AddRefs(isupports));
                    if (NS_FAILED(rv)) return rv;

                    property = do_QueryInterface(isupports);
                    if (! property)
                        return NS_ERROR_UNEXPECTED;
                }

                // Ordinal properties automagically indicate container
                // membership as far as we're concerned. Note that
                // we're *only* concerned with ordinal properties
                // here: the next block will worry about the other
                // membership properties.
                PRBool isordinal;
                rv = rdfc->IsOrdinalProperty(property, &isordinal);
                if (NS_FAILED(rv)) return rv;

                if (isordinal) {
                    // If we get here, we've found a property that
                    // indicates container membership leading *into* a
                    // member node. Find all the people that point to
                    // it, and call them containers.
                    nsCOMPtr<nsISimpleEnumerator> sources;
                    rv = mDataSource->GetSources(property, VALUE_TO_IRDFNODE(memberValue), PR_TRUE,
                                                 getter_AddRefs(sources));
                    if (NS_FAILED(rv)) return rv;

                    while (1) {
                        PRBool hasmore;
                        rv = sources->HasMoreElements(&hasmore);
                        if (NS_FAILED(rv)) return rv;

                        if (! hasmore)
                            break;

                        nsCOMPtr<nsISupports> isupports;
                        rv = sources->GetNext(getter_AddRefs(isupports));
                        if (NS_FAILED(rv)) return rv;

                        nsCOMPtr<nsIRDFResource> source = do_QueryInterface(isupports);
                        if (! source)
                            return NS_ERROR_UNEXPECTED;

#ifdef PR_LOGGING
                        if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) {
                            const char* container;
                            source->GetValueConst(&container);

                            PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
                                   ("    container => %s", container));
                        }
#endif

                        // Add a new instantiation
                        Instantiation newinst = *inst;
                        newinst.AddAssignment(mContainerVariable, Value(source.get()));

                        Element* element =
                            nsRDFConMemberTestNode::Element::Create(mConflictSet.GetPool(),
                                                                    source,
                                                                    VALUE_TO_IRDFNODE(memberValue));

                        if (! element)
                            return NS_ERROR_OUT_OF_MEMORY;

                        newinst.AddSupportingElement(element);

                        aInstantiations.Insert(inst, newinst);
                    }
                }
            }
        }

        if ((hasContainerBinding && ! hasMemberBinding) ||
            (! hasContainerBinding && hasMemberBinding)) {
            // it's an open ended query on the container or member. go
            // through our containment properties to see if anything
            // applies.
            for (nsResourceSet::ConstIterator property = mMembershipProperties.First();
                 property != mMembershipProperties.Last();
                 ++property) {
                nsCOMPtr<nsISimpleEnumerator> results;
                if (hasContainerBinding) {
                    rv = mDataSource->GetTargets(VALUE_TO_IRDFRESOURCE(containerValue), *property, PR_TRUE,
                                                 getter_AddRefs(results));
                }
                else {
                    rv = mDataSource->GetSources(*property, VALUE_TO_IRDFNODE(memberValue), PR_TRUE,
                                                 getter_AddRefs(results));
                }
                if (NS_FAILED(rv)) return rv;

                while (1) {
                    PRBool hasmore;
                    rv = results->HasMoreElements(&hasmore);
                    if (NS_FAILED(rv)) return rv;

                    if (! hasmore)
                        break;

                    nsCOMPtr<nsISupports> isupports;
                    rv = results->GetNext(getter_AddRefs(isupports));
                    if (NS_FAILED(rv)) return rv;

                    PRInt32 variable;
                    Value value;

                    if (hasContainerBinding) {
                        variable = mMemberVariable;

                        nsCOMPtr<nsIRDFNode> member = do_QueryInterface(isupports);
                        NS_ASSERTION(member != nsnull, "member is not an nsIRDFNode");
                        if (! member) continue;

#ifdef PR_LOGGING
                        if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) {
                            nsAutoString s;
                            nsXULContentUtils::GetTextForNode(member, s);

                            PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
                                   ("    member => %s", NS_ConvertUCS2toUTF8(s).get()));
                        }
#endif

                        value = member.get();
                    }
                    else {
                        variable = mContainerVariable;

                        nsCOMPtr<nsIRDFResource> container = do_QueryInterface(isupports);
                        NS_ASSERTION(container != nsnull, "container is not an nsIRDFResource");
                        if (! container) continue;

#ifdef PR_LOGGING
                        if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) {
                            const char* s;
                            container->GetValueConst(&s);

                            PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
                                   ("    container => %s", s));
                        }
#endif

                        value = container.get();
                    }

                    // Copy the original instantiation, and add it to the
                    // instantiation set with the new assignment that we've
                    // introduced. Ownership will be transferred to the
                    Instantiation newinst = *inst;
                    newinst.AddAssignment(variable, value);

                    Element* element;
                    if (hasContainerBinding) {
                        element =
                            nsRDFConMemberTestNode::Element::Create(mConflictSet.GetPool(),
                                                                    VALUE_TO_IRDFRESOURCE(containerValue),
                                                                    VALUE_TO_IRDFNODE(value));
                    }
                    else {
                        element =
                            nsRDFConMemberTestNode::Element::Create(mConflictSet.GetPool(),
                                                                    VALUE_TO_IRDFRESOURCE(value),
                                                                    VALUE_TO_IRDFNODE(memberValue));
                    }

                    if (! element)
                        return NS_ERROR_OUT_OF_MEMORY;

                    newinst.AddSupportingElement(element);

                    aInstantiations.Insert(inst, newinst);
                }
            }
        }

        if (! hasContainerBinding && ! hasMemberBinding) {
            // Neither container nor member assignment!
            NS_ERROR("can't do open ended queries like that!");
            return NS_ERROR_UNEXPECTED;
        }

        // finally, remove the "under specified" instantiation.
        aInstantiations.Erase(inst--);
    }

    return NS_OK;
}

Here is the call graph for this function:

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.

Reimplemented from TestNode.

Definition at line 484 of file nsRDFConMemberTestNode.cpp.

{
    nsresult rv;

    rv = aVariables.Add(mContainerVariable);
    if (NS_FAILED(rv)) return rv;

    rv = aVariables.Add(mMemberVariable);
    if (NS_FAILED(rv)) return rv;

    return TestNode::GetAncestorVariables(aVariables);
}

Here is the call graph for this function:

InnerNode* TestNode::GetParent ( ) const [inline, inherited]

Retrieve the test node's parent.

Returns:
the test node's parent

Definition at line 1065 of file nsRuleNetwork.h.

{ return mParent; }

Here is the caller graph for this function:

PRBool TestNode::HasAncestor ( const ReteNode aNode) const [virtual, inherited]

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 1106 of file nsRuleNetwork.cpp.

{
    return aNode == this ? PR_TRUE : mParent->HasAncestor(aNode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Calls FilterInstantiations() on the instantiation set, and if the resulting set isn't empty, propagates the new set down to each of the test node's children.

Implements ReteNode.

Definition at line 1036 of file nsRuleNetwork.cpp.

{
    nsresult rv;

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

    InstantiationSet instantiations = aInstantiations;
    rv = FilterInstantiations(instantiations, aClosure);
    if (NS_FAILED(rv)) return rv;

    if (! instantiations.Empty()) {
        ReteNodeSet::Iterator last = mKids.Last();
        for (ReteNodeSet::Iterator kid = mKids.First(); kid != last; ++kid) {
            PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
                   ("TestNode[%p]: Propagate() passing to child %p", this, kid.operator->()));

            kid->Propagate(instantiations, aClosure);
        }
    }

    PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
           ("TestNode[%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:

void nsRDFConMemberTestNode::Retract ( nsIRDFResource aSource,
nsIRDFResource aProperty,
nsIRDFNode aTarget,
nsTemplateMatchSet aFirings,
nsTemplateMatchSet aRetractions 
) const [virtual]

  

Implements nsRDFTestNode.

Definition at line 550 of file nsRDFConMemberTestNode.cpp.

{
    PRBool canretract = PR_FALSE;

    nsCOMPtr<nsIRDFContainerUtils> rdfc =
        do_GetService("@mozilla.org/rdf/container-utils;1");

    if (! rdfc)
        return;

    // We can certainly retract ordinal properties
    nsresult rv;
    rv = rdfc->IsOrdinalProperty(aProperty, &canretract);
    if (NS_FAILED(rv)) return;

    if (! canretract) {
        canretract = mMembershipProperties.Contains(aProperty);
    }

    if (canretract) {
        mConflictSet.Remove(Element(aSource, aTarget), aFirings, aRetractions);
    }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 133 of file nsRDFConMemberTestNode.h.

Definition at line 136 of file nsRDFConMemberTestNode.h.

Definition at line 134 of file nsRDFConMemberTestNode.h.

ReteNodeSet InnerNode::mKids [protected, inherited]

Definition at line 982 of file nsRuleNetwork.h.

Definition at line 135 of file nsRDFConMemberTestNode.h.

Definition at line 137 of file nsRDFConMemberTestNode.h.

InnerNode* TestNode::mParent [protected, inherited]

Definition at line 1100 of file nsRuleNetwork.h.


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