コード例 #1
0
 @Override
 public Iterator<Expression> visitEnter(ScalarFunction node) {
   return node.preservesOrder() == OrderPreserving.NO
       ? Iterators.<Expression>emptyIterator()
       : Iterators.singletonIterator(
           node.getChildren().get(node.getKeyFormationTraversalIndex()));
 }
コード例 #2
0
 @Override
 public Info visitLeave(ScalarFunction node, List<Info> l) {
   if (l.isEmpty()) {
     return null;
   }
   Info info = l.get(0);
   // Keep the minimum value between this function and the current value,
   // so that we never increase OrderPreserving from NO or YES_IF_LAST.
   OrderPreserving orderPreserving =
       OrderPreserving.values()[
           Math.min(node.preservesOrder().ordinal(), info.orderPreserving.ordinal())];
   if (orderPreserving == info.orderPreserving) {
     return info;
   }
   return new Info(info, orderPreserving);
 }