/** * Negates the given number. * * @param n the number to be negated * @return the negated result; not guaranteed to be the same concrete * type as n; null is returned if n's type wasn't handled */ public Number negate(Number n) { // we specify Number.class as the hierarchy root so // that extraneous visit methods are ignored result = null; dispatcher.invokeVisitor( this, n, "visit"); return result; }
private Method lookupMethod(final Object arg0) { if (!arg0Clazz.isInstance(arg0)) { throw new IllegalArgumentException(); } Method method = dispatcher.lookupVisitMethod( visitor.getClass(), (Class<? extends E>) arg0.getClass(), methodName, otherArgClassList); if (method == null) { List<Class> classList = new ArrayList<>(); classList.add(arg0Clazz); classList.addAll(otherArgClassList); throw new IllegalArgumentException("Method not found: " + methodName + "(" + classList + ")"); } return method; } };
/** * Negates the given number. * * @param n the number to be negated * @return the negated result; not guaranteed to be the same concrete * type as n; null is returned if n's type wasn't handled */ public Number negate(Number n) { // we specify Number.class as the hierarchy root so // that extraneous visit methods are ignored result = null; dispatcher.invokeVisitor( this, n, "visit"); return result; }
private Method lookupMethod(final Object arg0) { if (!arg0Clazz.isInstance(arg0)) { throw new IllegalArgumentException(); } Method method = dispatcher.lookupVisitMethod( visitor.getClass(), (Class<? extends E>) arg0.getClass(), methodName, otherArgClassList); if (method == null) { List<Class> classList = new ArrayList<>(); classList.add(arg0Clazz); classList.addAll(otherArgClassList); throw new IllegalArgumentException("Method not found: " + methodName + "(" + classList + ")"); } return method; } };
@Override public void visit(RelNode p, int ordinal, RelNode parent) { // rewrite children first super.visit(p, ordinal, parent); currentRel = p; final String visitMethodName = "rewriteRel"; boolean found = dispatcher.invokeVisitor( RelStructuredTypeFlattener.this, currentRel, visitMethodName); currentRel = null; if (!found) { if (p.getInputs().size() == 0) { // for leaves, it's usually safe to assume that // no transformation is required rewriteGeneric(p); } else { throw new AssertionError("no '" + visitMethodName + "' method found for class " + p.getClass().getName()); } } } }
@Override public void visit(RelNode p, int ordinal, RelNode parent) { // rewrite children first super.visit(p, ordinal, parent); currentRel = p; final String visitMethodName = "rewriteRel"; boolean found = dispatcher.invokeVisitor( RelStructuredTypeFlattener.this, currentRel, visitMethodName); currentRel = null; if (!found) { if (p.getInputs().size() == 0) { // for leaves, it's usually safe to assume that // no transformation is required rewriteGeneric(p); } else { throw new AssertionError("no '" + visitMethodName + "' method found for class " + p.getClass().getName()); } } } }
@Override public void visit(RelNode p, int ordinal, RelNode parent) { for (;;) { rel = null; boolean found = dispatcher.invokeVisitor(this, p, REWRITE_METHOD_NAME); if (!found) { throw new AssertionError( boolean found = dispatcher.invokeVisitor(this, p, VISIT_METHOD_NAME); if (!found) { if (p instanceof InterpretableRel) {
@Override public void visit(RelNode p, int ordinal, RelNode parent) { for (;;) { rel = null; boolean found = dispatcher.invokeVisitor(this, p, REWRITE_METHOD_NAME); if (!found) { throw new AssertionError( boolean found = dispatcher.invokeVisitor(this, p, VISIT_METHOD_NAME); if (!found) { if (p instanceof InterpretableRel) {