Example #1
0
 public <R, A, T extends GenericVisitor<R, A>> void addGenericListener(
     Filter2<Object, T, A> filter, In3Out1<T, Node, A, R> listener) {
   final GenericFactory was = genericFactory;
   genericFactory =
       (vis, arg) -> {
         if (filter.filter(vis, arg)) {
           return (In3Out1) listener;
         }
         return was.io(vis, arg);
       };
 }
Example #2
0
 public <A> void modify(ModifierVisitorAdapter a, A arg) {
   final In3Out1<GenericVisitor, Node, Object, Object> mapper = genericFactory.io(a, arg);
   for (int i = 0; i < nodes.length; i++) {
     final Object result = mapper.io(a, nodes[i].out1(), arg);
     nodes[i] = Immutable.immutable1((Node) result);
   }
 }
Example #3
0
 public <A, R, Vis extends GenericVisitor<R, A>> In3Out1<Vis, Node, A, R> genericVisit(
     Vis vis, A arg) {
   final In3Out1 factory = genericFactory.io(vis, arg);
   return (v, n, a) -> {
     try (Do undo = universalListener.io(n, a)) {
       return (R) factory.io(v, n, a);
     }
   };
 }