@Test public void testCompareTo() throws IPStringConversionException { assertEquals(new IPv6("::7000").compareTo(new IPv6("::0000:7000")), 0); assertEquals(new IPv6("::7000").compareTo(new IPv6("::0000:6000")), 1); assertEquals(new IPv6("::7000").compareTo(new IPv6("::0000:8000")), -1); }
@Override public int compareTo(IPv6 that) { BigInteger thisInt; BigInteger thatInt; int out; try { thisInt = this.toBigInteger(); thatInt = that.toBigInteger(); } catch (IPStringConversionException ex) { throw new IllegalArgumentException("One IP address was invalid"); } out = thisInt.compareTo(thatInt); return out; }
IPv6 implements Comparable<IPv6> { @Override public int compareTo(IPv6 that) { BigInteger thisInt; BigInteger thatInt; int out; try { thisInt = this.toBigInteger(); thatInt = that.toBigInteger(); } catch (IPStringConversionException ex) { throw new IllegalArgumentException("One IP address was invalid"); } out = thisInt.compareTo(thatInt); return out; } }
IPv6 implements Comparable<IPv6> { @Override public int compareTo(IPv6 that) { BigInteger thisInt; BigInteger thatInt; int out; try { thisInt = this.toBigInteger(); thatInt = that.toBigInteger(); } catch (IPStringConversionException ex) { throw new IllegalArgumentException("One IP address was invalid"); } out = thisInt.compareTo(thatInt); return out; } IPv6(BigInteger in);  IPv6();  IPv6(String ip);  IPv6(byte[] in); }
IPv6 implements Comparable<IPv6> { @Override public int compareTo(IPv6 that) { BigInteger thisInt; BigInteger thatInt; int out; try { thisInt = this.toBigInteger(); thatInt = that.toBigInteger(); } catch (IPStringConversionException ex) { throw new IllegalArgumentException("One IP address was invalid"); } out = thisInt.compareTo(thatInt); return out; } IPv6(BigInteger in);  IPv6();  IPv6(String ip);  IPv6(byte[] in); static String expand(String ipStr, int nwords); String expand(); BigInteger toBigInteger(); static IPv6 bigInteger2IPv6(BigInteger in); static byte[] IpString2bytes(String ipStr); static String bytes2IpString(byte[] in); void setIp(byte[] in); String getString(); byte[] getBytes(); void setIp(String ip); void insertInteger(int in, int startBit); void insertBigInteger(BigInteger in, int startBit, int size); void setAccountPartition(int accountId); void setVipOctets(int lo); int getVipOctets(); void setClusterPartition(IPv6Cidr clusterCidr); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(IPv6 that); }
IPv6 implements Comparable<IPv6> { @Override public int compareTo(IPv6 that) { BigInteger thisInt; BigInteger thatInt; int out; try { thisInt = this.toBigInteger(); thatInt = that.toBigInteger(); } catch (IPStringConversionException ex) { throw new IllegalArgumentException("One IP address was invalid"); } out = thisInt.compareTo(thatInt); return out; } IPv6(BigInteger in);  IPv6();  IPv6(String ip);  IPv6(byte[] in); static String expand(String ipStr, int nwords); String expand(); BigInteger toBigInteger(); static IPv6 bigInteger2IPv6(BigInteger in); static byte[] IpString2bytes(String ipStr); static String bytes2IpString(byte[] in); void setIp(byte[] in); String getString(); byte[] getBytes(); void setIp(String ip); void insertInteger(int in, int startBit); void insertBigInteger(BigInteger in, int startBit, int size); void setAccountPartition(int accountId); void setVipOctets(int lo); int getVipOctets(); void setClusterPartition(IPv6Cidr clusterCidr); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(IPv6 that);  }