/** * True if there are no elements in the where processor. * * @return true if there are no elements. */ public boolean isEmpty() { return whereClause == null || (whereClause instanceof ElementGroup && ((ElementGroup) whereClause).isEmpty()); }
private static boolean emptyGroup(Element element) { if ( !(element instanceof ElementGroup) ) return false ; ElementGroup eg = (ElementGroup)element ; return eg.isEmpty() ; }
/** * True if there are no elements in the where processor. * * @return true if there are no elements. */ public boolean isEmpty() { return whereClause == null || (whereClause instanceof ElementGroup && ((ElementGroup) whereClause).isEmpty()); }
private static boolean emptyGroup(Element element) { if ( ! ( element instanceof ElementGroup ) ) return false ; ElementGroup eg = (ElementGroup)element ; return eg.isEmpty() ; }
public static void addUnionElements(ElementUnion out, Element e) { if(e instanceof ElementUnion) { ElementUnion u = (ElementUnion)e; for(Element m : u.getElements()) { out.addElement(m); } } else if(e instanceof ElementGroup && ((ElementGroup)e).isEmpty()) { // nothing todo } else { out.addElement(e); } }
@Override public void visit(OpSequence opSequence) { ElementGroup g = currentGroup() ; boolean nestGroup = ! g.isEmpty() ; if ( nestGroup ) { startSubGroup() ; g = currentGroup() ; } Iterator<Op> iter = opSequence.iterator() ; for ( ; iter.hasNext() ; ) { Op op = iter.next() ; Element e = asElement(op) ; g.addElement(e) ; } if ( nestGroup ) endSubGroup() ; return ; }
/** Insert into a group, skip initial empty subgroups; recombining ElementPathBlock */ private static void insertIntoGroup(ElementGroup eg, Element e) { // Skip initial empty subgroup. if ( emptyGroup(e) && eg.isEmpty() ) return ; // Empty group. if ( eg.isEmpty() ) { eg.addElement(e); return ; } Element eltTop = eg.getLast() ; if ( ! ( eltTop instanceof ElementPathBlock ) ) { // Not working on a ElementPathBlock - no need to group-of-one // when inserting ElementPathBlock. e = unwrapGroupOfOnePathBlock(e) ; eg.addElement(e); return ; } if ( ! ( e instanceof ElementPathBlock ) ) { eg.addElement(e); return ; } // Combine. ElementPathBlock currentPathBlock = (ElementPathBlock)eltTop ; ElementPathBlock newPathBlock = (ElementPathBlock)e ; currentPathBlock.getPattern().addAll(newPathBlock.getPattern()); }
@Override public void visit(OpSequence opSequence) { ElementGroup g = currentGroup() ; boolean nestGroup = !g.isEmpty() ; if ( nestGroup ) { startSubGroup() ; g = currentGroup() ; } for ( Op op : opSequence.getElements() ) { Element e = asElement(op) ; insertIntoGroup(g, e) ; } if ( nestGroup ) endSubGroup() ; return ; }
ElementGroup clause = getClause(); if (!clause.isEmpty()) { Element lastElement = clause.getElements().get(clause.getElements().size() - 1); if (lastElement instanceof ElementUnion) {
ElementGroup clause = getClause(); if (!clause.isEmpty()) { Element lastElement = clause.getElements().get(clause.getElements().size() - 1); if (lastElement instanceof ElementUnion) {
ElementGroup clause = getClause(); if (!clause.isEmpty()) { Element lastElement = clause.getElements().get(clause.getElements().size() - 1); if (lastElement instanceof ElementUnion) {
ElementGroup clause = getClause(); if (!clause.isEmpty()) { Element lastElement = clause.getElements().get(clause.getElements().size() - 1); if (lastElement instanceof ElementUnion) {