Search in sources :

Example 1 with OrIteratorBuilder

use of datawave.query.iterator.builder.OrIteratorBuilder in project datawave by NationalSecurityAgency.

the class IteratorBuildingVisitor method visit.

@Override
public Object visit(ASTOrNode or, Object data) {
    if (null != data && data instanceof OrIteratorBuilder) {
        or.childrenAccept(this, data);
    } else {
        // Create an OrIterator and recursively add the children
        AbstractIteratorBuilder orItr = new OrIteratorBuilder();
        orItr.setSortedUIDs(sortedUIDs);
        orItr.negateAsNeeded(data);
        or.childrenAccept(this, orItr);
        // If there is no parent
        if (data == null) {
            // Make this OrIterator the root node
            if (!orItr.includes().isEmpty()) {
                root = orItr.build();
            }
        } else {
            // Otherwise, add this OrIterator to its parent
            AbstractIteratorBuilder parent = (AbstractIteratorBuilder) data;
            if (!orItr.includes().isEmpty()) {
                parent.addInclude(orItr.build());
            }
            if (log.isTraceEnabled()) {
                log.trace("ASTOrNode visit: pretty formatting of:\nparent.includes:" + formatIncludesOrExcludes(orItr.includes()) + "\nparent.excludes:" + formatIncludesOrExcludes(orItr.excludes()));
            }
        }
    }
    return null;
}
Also used : OrIteratorBuilder(datawave.query.iterator.builder.OrIteratorBuilder) AbstractIteratorBuilder(datawave.query.iterator.builder.AbstractIteratorBuilder)

Aggregations

AbstractIteratorBuilder (datawave.query.iterator.builder.AbstractIteratorBuilder)1 OrIteratorBuilder (datawave.query.iterator.builder.OrIteratorBuilder)1