PRBool hasNegation = PR_FALSE; for (i = mNext - 1; i >= 0; --i) { nsIRDFDataSource* datasource = (nsIRDFDataSource*) mCompositeDataSource->mDataSources[i];
if (mAllowNegativeAssertions == PR_TRUE) {  PRBool hasNegation = PR_FALSE; for (i = mNext - 1; i >= 0; --i) { nsIRDFDataSource* datasource = (nsIRDFDataSource*) mCompositeDataSource->mDataSources[i];
CompositeEnumeratorImpl::HasMoreElements(PRBool* aResult){    NS_PRECONDITION(aResult != nsnull, "null ptr");    if (! aResult)        return NS_ERROR_NULL_POINTER;    nsresult rv;    // If we've already queued up a next target, then yep, there are    // more elements.    if (mResult) {        *aResult = PR_TRUE;        return NS_OK;    }    // Otherwise, we'll need to find a next target, switching cursors    // if necessary.    while (mNext < mCompositeDataSource->mDataSources.Count()) {        if (! mCurrent) {            // We don't have a current enumerator, so create a new one on            // the next data source.            nsIRDFDataSource* datasource =                (nsIRDFDataSource*) mCompositeDataSource->mDataSources[mNext];            rv = GetEnumerator(datasource, &mCurrent);            if (NS_FAILED(rv)) return rv;        }        do {            PRInt32 i;            PRBool hasMore;            rv = mCurrent->HasMoreElements(&hasMore);            if (NS_FAILED(rv)) return rv;            // Is the current enumerator depleted?            if (! hasMore) {                NS_RELEASE(mCurrent);                break;            }            // Even if the current enumerator has more elements, we still            // need to check that the current element isn't masked by            // a negation in an earlier data source.            // "Peek" ahead and pull out the next target.            nsCOMPtr<nsISupports> result;            rv = mCurrent->GetNext(getter_AddRefs(result));            if (NS_FAILED(rv)) return rv;            rv = result->QueryInterface(nsIRDFNode::GetIID(), (void**) &mResult);            if (NS_FAILED(rv)) return rv;            // See if any previous data source negates this            PRBool hasNegation = PR_FALSE;            for (i = mNext - 1; i >= 0; --i) {                nsIRDFDataSource* datasource =                    (nsIRDFDataSource*) mCompositeDataSource->mDataSources[i];                rv = HasNegation(datasource, mResult, &hasNegation);                if (NS_FAILED(rv)) return rv;                if (hasNegation)                    break;            }            // if so, we've gotta keep looking            if (hasNegation) {                NS_RELEASE(mResult);                continue;            }            // If we get here, then we've really found one. It'll            // remain cached in mResult until GetNext() sucks it out.            *aResult = PR_TRUE;             return NS_OK;        } while (1);        ++mNext;    }    // if we get here, there aren't any elements left.    *aResult = PR_FALSE;    return NS_OK;}