inet.ipaddr

Class IPAddressComparator.ValueComparator

  • java.lang.Object
    • inet.ipaddr.IPAddressComparator.ValueComparator
  • All Implemented Interfaces:
    IPAddressComparator, java.util.Comparator<IPAddress>
    Enclosing interface:
    IPAddressComparator


    public static class IPAddressComparator.ValueComparator
    extends java.lang.Object
    This is similar to the default comparator CountComparator in the way they treat addresses representing a single address. For individual addresses, it simply compares segment to segment from high to low, so 1.2.3.4 < 1.2.3.5 and 2.2.3.4 > 1.2.3.5. The difference is how they treat addresses representing multiple addresses (ie subnets) like 1::/8 or 1.*.*.* The count comparator considers addresses which represent more individual addresses to be larger. The value comparator goes by either the highest value or the lowest value in the range of represented addresses.

    So, for instance, consider 1.2.3.4 and 1.0.0.* With count comparator, 1.2.3.4 < 1.2.3.* since the second represents more addresses (ie 1 < 255) With value comparator using the high value, 1.2.3.4 < 1.2.3.* since 1.2.3.4 < 1.2.3.255 With value comparator using the low value, 1.2.3.4 > 1.2.3.* since 1.2.3.4 > 1.2.3.0