@Test public void testNewPosition() throws Exception { Rectangle theOriginal = new Rectangle(new Position(-10000, 10000), new Size(20,30)); Rectangle theRectangle = theOriginal.newPosition(new Position(10, 10)); assertNotSame(theOriginal, theRectangle); assertTrue(theRectangle.contains(new Position(11, 11))); assertTrue(theRectangle.contains(new Position(10, 10))); assertTrue(theRectangle.contains(new Position(30, 10))); assertTrue(theRectangle.contains(new Position(30, 40))); assertTrue(theRectangle.contains(new Position(10, 40))); assertFalse(theRectangle.contains(new Position(9, 10))); assertFalse(theRectangle.contains(new Position(31, 10))); assertFalse(theRectangle.contains(new Position(31, 40))); assertFalse(theRectangle.contains(new Position(9, 40))); assertFalse(theRectangle.contains(new Position(9, 9))); assertFalse(theRectangle.contains(new Position(31, 9))); assertFalse(theRectangle.contains(new Position(31, 41))); assertFalse(theRectangle.contains(new Position(9, 41))); }
public Rectangle newPosition(Position aNewPosition) { return new Rectangle(aNewPosition, size); }
Rectangle implements Distributable { public Rectangle newPosition(Position aNewPosition) { return new Rectangle(aNewPosition, size); } }
Rectangle implements Distributable { public Rectangle newPosition(Position aNewPosition) { return new Rectangle(aNewPosition, size); } Rectangle();  Rectangle(Position aPosition, Size aSize); }
Rectangle implements Distributable { public Rectangle newPosition(Position aNewPosition) { return new Rectangle(aNewPosition, size); } Rectangle();  Rectangle(Position aPosition, Size aSize); boolean contains(Position aPosition); Rectangle newPosition(Position aNewPosition); Rectangle newSize(Size aNewSize); @Override Map<String, Object> serialize(); static Rectangle deserialize(Map<String, Object> aSerializedData); }
Rectangle implements Distributable { public Rectangle newPosition(Position aNewPosition) { return new Rectangle(aNewPosition, size); } Rectangle();  Rectangle(Position aPosition, Size aSize); boolean contains(Position aPosition); Rectangle newPosition(Position aNewPosition); Rectangle newSize(Size aNewSize); @Override Map<String, Object> serialize(); static Rectangle deserialize(Map<String, Object> aSerializedData); final Position position; final Size size; }