Module inet.ipaddr
Package inet.ipaddr

Class AddressComparator.ValueComparator

  • All Implemented Interfaces:
    java.util.Comparator<AddressItem>
    Enclosing class:
    AddressComparator

    public static class AddressComparator.ValueComparator
    extends AddressComparator
    ValueComparator 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::/64 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 Also see AddressComparator.CountComparator

    Author:
    sfoley
    • Constructor Detail

      • ValueComparator

        public ValueComparator​(boolean compareHighValue)
      • ValueComparator

        public ValueComparator​(boolean equalsConsistent,
                               boolean compareHighValue)
      • ValueComparator

        public ValueComparator​(boolean equalsConsistent,
                               boolean compareHighValue,
                               boolean flipSecond)