@Test public void testEquals() { BoundingBox box1 = new BoundingBox(12, 34, 56, 78, 0, false, 0, 0, 0); BoundingBox box2 = new BoundingBox(12, 34, 56, 78, 0, false, 0, 0, 0); BoundingBox box3 = new BoundingBox(12, 34, 56, 78, 0, false, 0, 0, 0xFF); Assert.assertTrue("box1.equals(box1) should be true", box1.equals(box1)); Assert.assertTrue("box2.equals(box2) should be true", box2.equals(box2)); Assert.assertTrue("box3.equals(box3) should be true", box3.equals(box3)); Assert.assertTrue("box1.equals(box2) should be true", box1.equals(box2)); Assert.assertTrue("box2.equals(box1) should be true", box2.equals(box1)); Assert.assertTrue("box1.hashCode() != box2.hashCode()", box1.hashCode() == box2.hashCode()); Assert.assertFalse("box1 == box2 should not be true (they should be different objects)", box1 == box2); Assert.assertFalse("box1.equals(box3) should be false", box1.equals(box3)); Assert.assertFalse("box3.equals(box1) should be false", box3.equals(box1)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof BoundingBox)) { return false; } BoundingBox casted = (BoundingBox) obj; return x == casted.x && y == casted.y && height == casted.height && width == casted.width && Double.compare(rotationDegrees, casted.rotationDegrees) == 0 && flip == casted.flip && red == casted.red && green == casted.green && blue == casted.blue; }
BoundingBox { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof BoundingBox)) { return false; } BoundingBox casted = (BoundingBox) obj; return x == casted.x && y == casted.y && height == casted.height && width == casted.width && Double.compare(rotationDegrees, casted.rotationDegrees) == 0 && flip == casted.flip && red == casted.red && green == casted.green && blue == casted.blue; } }
BoundingBox { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof BoundingBox)) { return false; } BoundingBox casted = (BoundingBox) obj; return x == casted.x && y == casted.y && height == casted.height && width == casted.width && Double.compare(rotationDegrees, casted.rotationDegrees) == 0 && flip == casted.flip && red == casted.red && green == casted.green && blue == casted.blue; } BoundingBox(int x, int y, int width, int height, double rotationDegrees, boolean flip, int red, int green,
                       int blue); }
BoundingBox { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof BoundingBox)) { return false; } BoundingBox casted = (BoundingBox) obj; return x == casted.x && y == casted.y && height == casted.height && width == casted.width && Double.compare(rotationDegrees, casted.rotationDegrees) == 0 && flip == casted.flip && red == casted.red && green == casted.green && blue == casted.blue; } BoundingBox(int x, int y, int width, int height, double rotationDegrees, boolean flip, int red, int green,
                       int blue); int getX(); int getY(); int getWidth(); int getHeight(); double getRotationDegrees(); boolean getFlip(); int getRed(); int getGreen(); int getBlue(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); Markup.BoundingBox toProtocolBuffer(); }
BoundingBox { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof BoundingBox)) { return false; } BoundingBox casted = (BoundingBox) obj; return x == casted.x && y == casted.y && height == casted.height && width == casted.width && Double.compare(rotationDegrees, casted.rotationDegrees) == 0 && flip == casted.flip && red == casted.red && green == casted.green && blue == casted.blue; } BoundingBox(int x, int y, int width, int height, double rotationDegrees, boolean flip, int red, int green,
                       int blue); int getX(); int getY(); int getWidth(); int getHeight(); double getRotationDegrees(); boolean getFlip(); int getRed(); int getGreen(); int getBlue(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); Markup.BoundingBox toProtocolBuffer();  }