public <A, T extends VoidVisitor<A>, VisType extends T, ArgType extends A> void addVoidListener( Class<VisType> visitorType, Class<ArgType> argType, In3<T, Node, A> listener) { addVoidListener( (vis, arg) -> (visitorType == null || visitorType.isInstance(vis)) && (argType == null || argType.isInstance(arg)), listener); }
public <R, A, T extends GenericVisitor<R, A>, VisType extends T, ArgType extends A> void addGenericListener( Class<VisType> visitorType, Class<ArgType> argType, In3Out1<T, Node, A, R> listener) { addGenericListener( (vis, arg) -> (visitorType == null || visitorType.isInstance(vis)) && (argType == null || argType.isInstance(arg)), listener); }
public <A, S extends A> SysExpr addUniversalListener( Class<S> argType, In2Out1<Node, A, Do> callback) { final In2Out1<Node, Object, Do> was = universalListener; universalListener = (node, arg) -> { final Do toUndo = was.io(node, arg); if (argType.isInstance(arg) || arg == null) { final Do undo = callback.io(node, (A) arg); return toUndo.doAfter(undo); } return toUndo; }; return this; }