@Test public void testIntersect() { assertStatement("SELECT 123 INTERSECT DISTINCT SELECT 123 INTERSECT ALL SELECT 123", new Query( Optional.empty(), new Intersect(ImmutableList.of( new Intersect(ImmutableList.of(createSelect123(), createSelect123()), true), createSelect123() ), false), Optional.empty(), Optional.empty())); }
@Override public Node visitSetOperation(SqlBaseParser.SetOperationContext context) { QueryBody left = (QueryBody) visit(context.left); QueryBody right = (QueryBody) visit(context.right); boolean distinct = context.setQuantifier() == null || context.setQuantifier().DISTINCT() != null; switch (context.operator.getType()) { case SqlBaseLexer.UNION: return new Union(getLocation(context.UNION()), ImmutableList.of(left, right), distinct); case SqlBaseLexer.INTERSECT: return new Intersect(getLocation(context.INTERSECT()), ImmutableList.of(left, right), distinct); case SqlBaseLexer.EXCEPT: return new Except(getLocation(context.EXCEPT()), left, right, distinct); } throw new IllegalArgumentException("Unsupported set operation: " + context.operator.getText()); }
boolean collision() { return oval.intersects(rect.getBounds()); } public static void main(String[] args) { Intersect i = new Intersect(); i.setVisible(true); if (i.collision()) System.out.println("boom"); else System.out.println("no boom"); }
public static void main(final String[] args) { if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater(new Runnable() { public void run() { main(args); } }); return; } Intersect i = new Intersect(); ...
@Test public void testIntersect() { assertStatement("SELECT 123 INTERSECT DISTINCT SELECT 123 INTERSECT ALL SELECT 123", new Query( Optional.empty(), new Intersect(ImmutableList.of( new Intersect(ImmutableList.of(createSelect123(), createSelect123()), true), createSelect123() ), false), Optional.empty(), Optional.empty())); }
@Test public void testIntersect() { assertStatement("SELECT 123 INTERSECT DISTINCT SELECT 123 INTERSECT ALL SELECT 123", new Query( Optional.empty(), new Intersect(ImmutableList.of( new Intersect(ImmutableList.of(createSelect123(), createSelect123()), true), createSelect123() ), false), ImmutableList.of(), Optional.empty(), Optional.empty())); }
@Override public Node visitSetOperation(SqlBaseParser.SetOperationContext context) { QueryBody left = (QueryBody) visit(context.left); QueryBody right = (QueryBody) visit(context.right); boolean distinct = context.setQuantifier() == null || context.setQuantifier().DISTINCT() != null; switch (context.operator.getType()) { case SqlBaseLexer.UNION: return new Union(getLocation(context.UNION()), ImmutableList.of(left, right), distinct); case SqlBaseLexer.INTERSECT: return new Intersect(getLocation(context.INTERSECT()), ImmutableList.of(left, right), distinct); case SqlBaseLexer.EXCEPT: return new Except(getLocation(context.EXCEPT()), left, right, distinct); } throw new IllegalArgumentException("Unsupported set operation: " + context.operator.getText()); }
@Override public Node visitSetOperation(SqlBaseParser.SetOperationContext context) { QueryBody left = (QueryBody) visit(context.left); QueryBody right = (QueryBody) visit(context.right); boolean distinct = context.setQuantifier() == null || context.setQuantifier().DISTINCT() != null; switch (context.operator.getType()) { case SqlBaseLexer.UNION: return new Union(getLocation(context.UNION()), ImmutableList.of(left, right), distinct); case SqlBaseLexer.INTERSECT: return new Intersect(getLocation(context.INTERSECT()), ImmutableList.of(left, right), distinct); case SqlBaseLexer.EXCEPT: return new Except(getLocation(context.EXCEPT()), left, right, distinct); } throw new IllegalArgumentException("Unsupported set operation: " + context.operator.getText()); }