IndexScanSelector { public static IndexScanSelector rightJoinUntil(Index index, final Table rootmostRequired) { final int leafmostRequiredDepth = rootmostRequired.getDepth(); return create(index, new SelectorCreationPolicy() { @Override public boolean include(Table table) { if (table.equals(rootmostRequired)) sawTable = true; return table.getDepth() >= leafmostRequiredDepth; } @Override public String description(GroupIndex index) { return index.rootMostTable().equals(rootmostRequired) ? "" : " RIGHT JOIN thru " + rootmostRequired.getName().getTableName() + ", then INNER"; } @Override public void validate(GroupIndex index) { if (!sawTable) complain(index, rootmostRequired); } @Override public void validate(TableIndex index) { if (!index.getTable().equals(rootmostRequired)) complain(index, rootmostRequired); } 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 rightBelowTI() { IndexScanSelector.rightJoinUntil(ais.oTableIndex, ais.i); }
@OnlyIfNot("parameterized()") @Test(expected = IllegalArgumentException.class) public void rightAboveTI() { IndexScanSelector.rightJoinUntil(ais.oTableIndex, ais.c); }