예제 #1
0
 @Override
 public Node traverse(SelectorLeaf selector) {
   Node secondNode = selector.traverse(baseContext);
   Set<Tally> tallies = new HashSet<Tally>();
   tallies.addAll(firstNode.getTallies());
   tallies.retainAll(secondNode.getTallies());
   assert tallies.isEmpty() || tallies.size() == 1;
   if (tallies.isEmpty()) {
     Tally tally = newTally(firstNode, secondNode);
     firstNode.addTally(tally);
     secondNode.addTally(tally);
     return tally.getNode();
   } else {
     return tallies.iterator().next().getNode();
   }
 }
예제 #2
0
 @Override
 public Node traverse(SelectorLeaf selector) {
   return selector.traverse(this);
 }