IndexScanSelector { public static IndexScanSelector leftJoinAfter(Index index, final Table leafmostRequired) { final int leafmostRequiredDepth = leafmostRequired.getDepth(); return create(index, new SelectorCreationPolicy() { @Override public boolean include(Table table) { if (table.equals(leafmostRequired)) sawTable = true; return table.getDepth() <= leafmostRequiredDepth; } @Override public String description(GroupIndex index) { return index.leafMostTable().equals(leafmostRequired) ? "" : " INNER JOIN thru " + leafmostRequired.getName().getTableName() + ", then LEFT"; } @Override public void validate(GroupIndex index) { if (!sawTable) complain(index, leafmostRequired); } @Override public void validate(TableIndex index) { if (!index.getTable().equals(leafmostRequired)) complain(index, leafmostRequired); } private boolean sawTable = false; }); } private  IndexScanSelector(); abstract boolean matchesAll(); abstract boolean matches(long map); static IndexScanSelector leftJoinAfter(Index index, final Table leafmostRequired); static IndexScanSelector rightJoinUntil(Index index, final Table rootmostRequired); static IndexScanSelector inner(Index index); abstract String describe();  }
@OnlyIfNot("parameterized()") @Test(expected = IllegalArgumentException.class) public void leftAboveGI() { IndexScanSelector.leftJoinAfter(ais.oiGroupIndex, ais.c); }
@OnlyIfNot("parameterized()") @Test(expected = IllegalArgumentException.class) public void leftBelowGI() { IndexScanSelector.leftJoinAfter(ais.oiGroupIndex, ais.h); }
@OnlyIfNot("parameterized()") @Test(expected = IllegalArgumentException.class) public void rightAboveGI() { IndexScanSelector.leftJoinAfter(ais.oiGroupIndex, ais.c); }
@OnlyIfNot("parameterized()") @Test(expected = IllegalArgumentException.class) public void rightBelowGI() { IndexScanSelector.leftJoinAfter(ais.oiGroupIndex, ais.h); }
@OnlyIfNot("parameterized()") @Test(expected = IllegalArgumentException.class) public void leftBelowTI() { IndexScanSelector.leftJoinAfter(ais.oTableIndex, ais.i); }
@OnlyIfNot("parameterized()") @Test(expected = IllegalArgumentException.class) public void leftAboveTI() { IndexScanSelector.leftJoinAfter(ais.oTableIndex, ais.c); }