- Type Parameters:
A- address type
- All Superinterfaces:
Iterable<A>
Discrete ordered set interface of zero to Family.max() Addresses.
AddressSet is tightly coupled to Range and Block.
Implementations MUST be immutable.
Iteration methods MUST produce values from least to greatest.
| Interface | Must Be Implemented When Set... |
|---|---|
Block
|
...forms a valid RFC4632 CIDR block. |
Range
|
...is contiguous range. |
AddressSet
|
...is made up of non-contiguous ranges or is the empty set. |
-
Method Summary
Modifier and TypeMethodDescriptionAddresses from least to greatest.default booleanTests ifRange.contains(Addr)is true for any of the constituentranges().booleaninthashCode()RangeContract:first().hashCode() * 31 + last().hashCode()default booleanisEmpty()Tests for the empty set.ranges()ConstituentRanges.default BigIntegersize()Cardinality of the set.default Spliterator<A>
-
Method Details
-
equals
RangeContract: other isRangeinstance andRange.first()&Range.last()are equal.General
AddressSetContract: returns true if instance ofAddressSetand all constituentranges()are identical. -
hashCode
int hashCode()RangeContract:first().hashCode() * 31 + last().hashCode()General
AddressSetContract:ranges().mapToInt(Object::hashCode).reduce(0, (n, r) -> n * 31 + r) -
ranges
Constituent
Ranges.Adjacent or overlapping ranges MUST be combined into a single
Range. Elements MUST be produced from leastAddress to greatest.A
StreamofAddress values can be obtained withranges().flatMap(Range::stream). AStreamofBlocks can be obtained withranges().flatMap(Range::blocks).- Returns:
- constituent ranges
-
spliterator
Default
Spliterator.characteristics():Spliterator.IMMUTABLE;Spliterator.ORDERED;Spliterator.SORTED;Spliterator.NONNULL;Spliterator.DISTINCT. If smaller thanLong.MAX_VALUEalsoSpliterator.SIZEDandSpliterator.SUBSIZED.Spliterator.trySplit()is implemented.- Specified by:
spliteratorin interfaceIterable<A extends Addr<A>>- Returns:
- all addresses in set
-
addresses
Addresses from least to greatest.
- Returns:
- address stream
-
contains
Tests ifRange.contains(Addr)is true for any of the constituentranges().- Parameters:
address- candidate (cannot be null)- Returns:
- true if the given address is present
-
size
Cardinality of the set. Number of uniqueAddrres.- Returns:
- count
-
isEmpty
default boolean isEmpty()Tests for the empty set.- Returns:
- true if empty
-