@Test public void testPutOnFrames() { BoundingBoxMap map = new BoundingBoxMap(); BoundingBox boundingBox = new BoundingBox(25, 30, 100, 100, 0, false, 0xFF, 0, 0); BoundingBox boundingBoxCopy = new BoundingBox(25, 30, 100, 100, 0, false, 0xFF, 0, 0); map.putOnFrames(5, 10, boundingBox); Assert.assertEquals("The map must contain 5 elements.", 10 - 5 + 1, map.size()); for(int i = 5; i <= 10; i++) { Assert.assertNotEquals(String.format("The value for map.get(%d) must not be null.", i), map.get(i), null); Assert.assertEquals(String.format("The value for map.get(%d) must contain 1 element.", i), 1, map.get(i).size()); Assert.assertEquals(String.format("The value for map.get(%d).get(0) did not match the expected value.", i), boundingBoxCopy, map.get(i).get(0)); } }
public void putOnFrames(Integer firstFrame, Integer lastFrame, BoundingBox boundingBox) { if (firstFrame == null) { throw new IllegalArgumentException("firstFrame must not be null"); } if (lastFrame == null) { throw new IllegalArgumentException("lastFrame must not be null"); } if (lastFrame < firstFrame) { throw new IllegalArgumentException(String.format("lastFrame must not be smaller than firstFrame (%s <= %s)", lastFrame.toString(), firstFrame.toString())); } for (int i = firstFrame; i <= lastFrame; i++) { putOnFrame(i, boundingBox); } }
BoundingBoxMap extends TreeMap<Integer, List<BoundingBox>> { public void putOnFrames(Integer firstFrame, Integer lastFrame, BoundingBox boundingBox) { if (firstFrame == null) { throw new IllegalArgumentException("firstFrame must not be null"); } if (lastFrame == null) { throw new IllegalArgumentException("lastFrame must not be null"); } if (lastFrame < firstFrame) { throw new IllegalArgumentException(String.format("lastFrame must not be smaller than firstFrame (%s <= %s)", lastFrame.toString(), firstFrame.toString())); } for (int i = firstFrame; i <= lastFrame; i++) { putOnFrame(i, boundingBox); } } }
BoundingBoxMap extends TreeMap<Integer, List<BoundingBox>> { public void putOnFrames(Integer firstFrame, Integer lastFrame, BoundingBox boundingBox) { if (firstFrame == null) { throw new IllegalArgumentException("firstFrame must not be null"); } if (lastFrame == null) { throw new IllegalArgumentException("lastFrame must not be null"); } if (lastFrame < firstFrame) { throw new IllegalArgumentException(String.format("lastFrame must not be smaller than firstFrame (%s <= %s)", lastFrame.toString(), firstFrame.toString())); } for (int i = firstFrame; i <= lastFrame; i++) { putOnFrame(i, boundingBox); } }  }
BoundingBoxMap extends TreeMap<Integer, List<BoundingBox>> { public void putOnFrames(Integer firstFrame, Integer lastFrame, BoundingBox boundingBox) { if (firstFrame == null) { throw new IllegalArgumentException("firstFrame must not be null"); } if (lastFrame == null) { throw new IllegalArgumentException("lastFrame must not be null"); } if (lastFrame < firstFrame) { throw new IllegalArgumentException(String.format("lastFrame must not be smaller than firstFrame (%s <= %s)", lastFrame.toString(), firstFrame.toString())); } for (int i = firstFrame; i <= lastFrame; i++) { putOnFrame(i, boundingBox); } }  @Override List<BoundingBox> put(Integer key, List<BoundingBox> value); @Override void putAll(Map<? extends Integer, ? extends List<BoundingBox>> m); void putOnFrame(Integer frame, BoundingBox boundingBox); void putOnFrames(Integer firstFrame, Integer lastFrame, BoundingBox boundingBox); void animate(BoundingBox origin, BoundingBox destination, int firstFrame, int interval); @Override String toString(); List<Markup.BoundingBoxMapEntry> toBoundingBoxMapEntryList(); int getEntryCount(); }
BoundingBoxMap extends TreeMap<Integer, List<BoundingBox>> { public void putOnFrames(Integer firstFrame, Integer lastFrame, BoundingBox boundingBox) { if (firstFrame == null) { throw new IllegalArgumentException("firstFrame must not be null"); } if (lastFrame == null) { throw new IllegalArgumentException("lastFrame must not be null"); } if (lastFrame < firstFrame) { throw new IllegalArgumentException(String.format("lastFrame must not be smaller than firstFrame (%s <= %s)", lastFrame.toString(), firstFrame.toString())); } for (int i = firstFrame; i <= lastFrame; i++) { putOnFrame(i, boundingBox); } }  @Override List<BoundingBox> put(Integer key, List<BoundingBox> value); @Override void putAll(Map<? extends Integer, ? extends List<BoundingBox>> m); void putOnFrame(Integer frame, BoundingBox boundingBox); void putOnFrames(Integer firstFrame, Integer lastFrame, BoundingBox boundingBox); void animate(BoundingBox origin, BoundingBox destination, int firstFrame, int interval); @Override String toString(); List<Markup.BoundingBoxMapEntry> toBoundingBoxMapEntryList(); int getEntryCount(); static final int ALL_FRAMES; }