@Test public void testCompareTo() { ZigBeeEndpointAddress address1 = new ZigBeeEndpointAddress("25000/33"); ZigBeeEndpointAddress address2 = new ZigBeeEndpointAddress("25000/33"); assertEquals(0, address1.compareTo(address2)); ZigBeeEndpointAddress address3 = new ZigBeeEndpointAddress("25001/33"); assertTrue(address1.compareTo(address3) < 0); ZigBeeEndpointAddress address4 = new ZigBeeEndpointAddress("24999/33"); assertTrue(address1.compareTo(address4) > 0); ZigBeeEndpointAddress address5 = new ZigBeeEndpointAddress("25000/30"); assertTrue(address1.compareTo(address5) > 0); ZigBeeEndpointAddress address6 = new ZigBeeEndpointAddress("25000/36"); assertTrue(address1.compareTo(address6) < 0); }
@Override public int compareTo(ZigBeeAddress that) { if (this == that) { return 0; } ZigBeeEndpointAddress thatAddr = (ZigBeeEndpointAddress) that; if (thatAddr.getAddress() == getAddress() && thatAddr.getEndpoint() == getEndpoint()) { return 0; } if (thatAddr.getAddress() == getAddress()) { return getEndpoint() - thatAddr.getEndpoint(); } return getAddress() - thatAddr.getAddress(); }
ZigBeeEndpointAddress extends ZigBeeAddress { @Override public int compareTo(ZigBeeAddress that) { if (this == that) { return 0; } ZigBeeEndpointAddress thatAddr = (ZigBeeEndpointAddress) that; if (thatAddr.getAddress() == getAddress() && thatAddr.getEndpoint() == getEndpoint()) { return 0; } if (thatAddr.getAddress() == getAddress()) { return getEndpoint() - thatAddr.getEndpoint(); } return getAddress() - thatAddr.getAddress(); } }
ZigBeeEndpointAddress extends ZigBeeAddress { @Override public int compareTo(ZigBeeAddress that) { if (this == that) { return 0; } ZigBeeEndpointAddress thatAddr = (ZigBeeEndpointAddress) that; if (thatAddr.getAddress() == getAddress() && thatAddr.getEndpoint() == getEndpoint()) { return 0; } if (thatAddr.getAddress() == getAddress()) { return getEndpoint() - thatAddr.getEndpoint(); } return getAddress() - thatAddr.getAddress(); } ZigBeeEndpointAddress(int address);  ZigBeeEndpointAddress(int address, int endpoint);  ZigBeeEndpointAddress(String address); }
ZigBeeEndpointAddress extends ZigBeeAddress { @Override public int compareTo(ZigBeeAddress that) { if (this == that) { return 0; } ZigBeeEndpointAddress thatAddr = (ZigBeeEndpointAddress) that; if (thatAddr.getAddress() == getAddress() && thatAddr.getEndpoint() == getEndpoint()) { return 0; } if (thatAddr.getAddress() == getAddress()) { return getEndpoint() - thatAddr.getEndpoint(); } return getAddress() - thatAddr.getAddress(); } ZigBeeEndpointAddress(int address);  ZigBeeEndpointAddress(int address, int endpoint);  ZigBeeEndpointAddress(String address); @Override int getAddress(); @Override void setAddress(final int address); @Override boolean isGroup(); int getEndpoint(); void setEndpoint(final int endpoint); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(ZigBeeAddress that); @Override String toString(); }
ZigBeeEndpointAddress extends ZigBeeAddress { @Override public int compareTo(ZigBeeAddress that) { if (this == that) { return 0; } ZigBeeEndpointAddress thatAddr = (ZigBeeEndpointAddress) that; if (thatAddr.getAddress() == getAddress() && thatAddr.getEndpoint() == getEndpoint()) { return 0; } if (thatAddr.getAddress() == getAddress()) { return getEndpoint() - thatAddr.getEndpoint(); } return getAddress() - thatAddr.getAddress(); } ZigBeeEndpointAddress(int address);  ZigBeeEndpointAddress(int address, int endpoint);  ZigBeeEndpointAddress(String address); @Override int getAddress(); @Override void setAddress(final int address); @Override boolean isGroup(); int getEndpoint(); void setEndpoint(final int endpoint); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(ZigBeeAddress that); @Override String toString();  }