@Test public void testReserveTableWhenNoneMatches() { Assert.assertNull(TableManager.reserveTable(4)); }
public static Table reserveTable(final int seating, final SpecialFeature... specialFeatures) { List<SpecialFeature> tableFeatures = null; Table table = null; outer: for (int availableTableId : availableTableIds) { table = findTableById(availableTableId); if (table.seatingCapacity() == seating) { tableFeatures = table.specialFeatures(); for (SpecialFeature requestedFeature : specialFeatures) { if (!tableFeatures.contains(requestedFeature)) { continue outer; } } availableTableIds.remove(availableTableId); break; } table = null; } return table; }
TableManager { public static Table reserveTable(final int seating, final SpecialFeature... specialFeatures) { List<SpecialFeature> tableFeatures = null; Table table = null; outer: for (int availableTableId : availableTableIds) { table = findTableById(availableTableId); if (table.seatingCapacity() == seating) { tableFeatures = table.specialFeatures(); for (SpecialFeature requestedFeature : specialFeatures) { if (!tableFeatures.contains(requestedFeature)) { continue outer; } } availableTableIds.remove(availableTableId); break; } table = null; } return table; } }
TableManager { public static Table reserveTable(final int seating, final SpecialFeature... specialFeatures) { List<SpecialFeature> tableFeatures = null; Table table = null; outer: for (int availableTableId : availableTableIds) { table = findTableById(availableTableId); if (table.seatingCapacity() == seating) { tableFeatures = table.specialFeatures(); for (SpecialFeature requestedFeature : specialFeatures) { if (!tableFeatures.contains(requestedFeature)) { continue outer; } } availableTableIds.remove(availableTableId); break; } table = null; } return table; }  }
TableManager { public static Table reserveTable(final int seating, final SpecialFeature... specialFeatures) { List<SpecialFeature> tableFeatures = null; Table table = null; outer: for (int availableTableId : availableTableIds) { table = findTableById(availableTableId); if (table.seatingCapacity() == seating) { tableFeatures = table.specialFeatures(); for (SpecialFeature requestedFeature : specialFeatures) { if (!tableFeatures.contains(requestedFeature)) { continue outer; } } availableTableIds.remove(availableTableId); break; } table = null; } return table; }  static void setAllTables(Set<Table> allTables); static Table reserveTable(final int seating, final SpecialFeature... specialFeatures); }
TableManager { public static Table reserveTable(final int seating, final SpecialFeature... specialFeatures) { List<SpecialFeature> tableFeatures = null; Table table = null; outer: for (int availableTableId : availableTableIds) { table = findTableById(availableTableId); if (table.seatingCapacity() == seating) { tableFeatures = table.specialFeatures(); for (SpecialFeature requestedFeature : specialFeatures) { if (!tableFeatures.contains(requestedFeature)) { continue outer; } } availableTableIds.remove(availableTableId); break; } table = null; } return table; }  static void setAllTables(Set<Table> allTables); static Table reserveTable(final int seating, final SpecialFeature... specialFeatures);  }