private List<Matcher> createMatchers() { List<Matcher> matchers = newArrayListWithCapacity(includes.size()); for (Include include : includes) { matchers.add(new Matcher(this, include)); } return matchers; }
public List<Matcher> createMatchers(AggregateRoot root){ List<Matcher> matchers = newArrayListWithCapacity(includes.size()); for (Include include : includes) { matchers.add(new Matcher(this, include, root)); } return matchers; }
public Collection<Matcher> nextSet() { checkArgument(status != Status.FAIL); if (status == Status.MATCH_FOUND){ Aggregate nextAgg = currentInclude.getAggregate(matchedNodeState); if (nextAgg != null){ int recursionLevel = aggregateStack.size() + 1; if (recursionLevel >= rootState.rootAggregate.reAggregationLimit){ return Collections.emptyList(); } List<Matcher> result = Lists.newArrayListWithCapacity(nextAgg.includes.size()); for (Include i : nextAgg.includes){ result.add(new Matcher(this, i, currentPath)); } return result; } return Collections.emptyList(); } return Collections.singleton(new Matcher(this, status, depth + 1, null, currentPath)); }
public Matcher match(String name, NodeState nodeState) { boolean result = currentInclude.match(name, nodeState, depth); if (result){ if (hasMore()){ return new Matcher(this, Status.CONTINUE, depth, nodeState, path(name)); } else { return new Matcher(this, Status.MATCH_FOUND, depth, nodeState, path(name)); } } else { return new Matcher(this, Status.FAIL, depth); } }