/** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null) { return false; } if (!(o instanceof HRegionLocation)) { return false; } return this.compareTo((HRegionLocation)o) == 0; }
@SuppressWarnings("SelfComparison") @Test public void testCompareTo() { ServerName hsa1 = ServerName.valueOf("localhost", 1234, -1L); HRegionLocation hsl1 = new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO, hsa1); ServerName hsa2 = ServerName.valueOf("localhost", 1235, -1L); HRegionLocation hsl2 = new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO, hsa2); assertEquals(0, hsl1.compareTo(hsl1)); assertEquals(0, hsl2.compareTo(hsl2)); int compare1 = hsl1.compareTo(hsl2); int compare2 = hsl2.compareTo(hsl1); assertTrue((compare1 > 0)? compare2 < 0: compare2 > 0); } }
/** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null) { return false; } if (!(o instanceof HRegionLocation)) { return false; } return this.compareTo((HRegionLocation)o) == 0; }
/** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null) { return false; } if (!(o instanceof HRegionLocation)) { return false; } return this.compareTo((HRegionLocation)o) == 0; }
/** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null) { return false; } if (!(o instanceof HRegionLocation)) { return false; } return this.compareTo((HRegionLocation)o) == 0; }
/** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null) { return false; } if (!(o instanceof HRegionLocation)) { return false; } return this.compareTo((HRegionLocation)o) == 0; }
@SuppressWarnings("SelfComparison") @Test public void testCompareTo() { ServerName hsa1 = ServerName.valueOf("localhost", 1234, -1L); HRegionLocation hsl1 = new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO, hsa1); ServerName hsa2 = ServerName.valueOf("localhost", 1235, -1L); HRegionLocation hsl2 = new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO, hsa2); assertEquals(0, hsl1.compareTo(hsl1)); assertEquals(0, hsl2.compareTo(hsl2)); int compare1 = hsl1.compareTo(hsl2); int compare2 = hsl2.compareTo(hsl1); assertTrue((compare1 > 0)? compare2 < 0: compare2 > 0); } }