Class AddressComparator.ValueComparator
- All Implemented Interfaces:
Comparator<AddressItem>
- Enclosing class:
AddressComparator
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
-
Nested Class Summary
Nested classes/interfaces inherited from class AddressComparator
AddressComparator.CountComparator, AddressComparator.ValueComparator -
Constructor Summary
ConstructorsConstructorDescriptionValueComparator(boolean compareHighValue) ValueComparator(boolean equalsConsistent, boolean compareHighValue) ValueComparator(boolean equalsConsistent, boolean compareHighValue, boolean flipSecond) -
Method Summary
Methods inherited from class AddressComparator
compare, compare, compare, compare, compare, compare, compareMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
ValueComparator
public ValueComparator(boolean compareHighValue) -
ValueComparator
public ValueComparator(boolean equalsConsistent, boolean compareHighValue) -
ValueComparator
public ValueComparator(boolean equalsConsistent, boolean compareHighValue, boolean flipSecond)
-