@Test public final void testShrink() { int gadgetCount = gadgets.size(); sut.shrink(AVAILABLE_ZONES, gadgets); assertEquals("Gadgets changed size.", gadgetCount, gadgets.size()); verifyGadget(gadgets.get(0), new GadgetDefinition("gadget0", UUID.randomUUID().toString(), new GalleryItemCategory("somecategory")), 0, 0); verifyGadget(gadgets.get(1), new GadgetDefinition("gadget1", UUID.randomUUID().toString(), new GalleryItemCategory("somecategory")), 0, 1); verifyGadget(gadgets.get(2), new GadgetDefinition("gadget2", UUID.randomUUID().toString(), new GalleryItemCategory("somecategory")), 1, 0); verifyGadget(gadgets.get(3), new GadgetDefinition("gadget3", UUID.randomUUID().toString(), new GalleryItemCategory("somecategory")), 1, 1); verifyGadget(gadgets.get(4), new GadgetDefinition("gadget4", UUID.randomUUID().toString(), new GalleryItemCategory("somecategory")), 1, 2); verifyGadget(gadgets.get(5), new GadgetDefinition("gadget5", UUID.randomUUID().toString(), new GalleryItemCategory("somecategory")), 1, 3); verifyGadget(gadgets.get(6), new GadgetDefinition("gadget6", UUID.randomUUID().toString(), new GalleryItemCategory("somecategory")), 1, 4); }
public final void shrink(final int availableZones, final List<Gadget> gadgets) { int lastZone = availableZones - 1; int lastIndex = 0; for (Gadget gadget : gadgets) { if (gadget.getZoneNumber() > lastZone) { gadget.setZoneNumber(lastZone); gadget.setZoneIndex(++lastIndex); } else { lastIndex = gadget.getZoneIndex(); } } }
LastShrinkLayoutStrategy implements ShrinkLayoutStrategy { public final void shrink(final int availableZones, final List<Gadget> gadgets) { int lastZone = availableZones - 1; int lastIndex = 0; for (Gadget gadget : gadgets) { if (gadget.getZoneNumber() > lastZone) { gadget.setZoneNumber(lastZone); gadget.setZoneIndex(++lastIndex); } else { lastIndex = gadget.getZoneIndex(); } } } }
LastShrinkLayoutStrategy implements ShrinkLayoutStrategy { public final void shrink(final int availableZones, final List<Gadget> gadgets) { int lastZone = availableZones - 1; int lastIndex = 0; for (Gadget gadget : gadgets) { if (gadget.getZoneNumber() > lastZone) { gadget.setZoneNumber(lastZone); gadget.setZoneIndex(++lastIndex); } else { lastIndex = gadget.getZoneIndex(); } } }  }
LastShrinkLayoutStrategy implements ShrinkLayoutStrategy { public final void shrink(final int availableZones, final List<Gadget> gadgets) { int lastZone = availableZones - 1; int lastIndex = 0; for (Gadget gadget : gadgets) { if (gadget.getZoneNumber() > lastZone) { gadget.setZoneNumber(lastZone); gadget.setZoneIndex(++lastIndex); } else { lastIndex = gadget.getZoneIndex(); } } }  final void shrink(final int availableZones,
            final List<Gadget> gadgets); }
LastShrinkLayoutStrategy implements ShrinkLayoutStrategy { public final void shrink(final int availableZones, final List<Gadget> gadgets) { int lastZone = availableZones - 1; int lastIndex = 0; for (Gadget gadget : gadgets) { if (gadget.getZoneNumber() > lastZone) { gadget.setZoneNumber(lastZone); gadget.setZoneIndex(++lastIndex); } else { lastIndex = gadget.getZoneIndex(); } } }  final void shrink(final int availableZones,
            final List<Gadget> gadgets);  }