- All Implemented Interfaces:
AddressComponentRange
,AddressItem
,AddressItemRange
,IPAddressRange
,Serializable
,Comparable<AddressItem>
,Iterable<IPv4Address>
IPAddressSeqRange
for more details.- Author:
- sfoley
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the minimal-size prefix block that covers all the addresses in this range.long
Equivalent toIPAddressSeqRange.getCount()
but returns a longlong
getIPv4PrefixCount
(int prefixLength) Equivalent togetPrefixCount(int)
but returns a longUseful for using an instance in a "for-each loop", as infor(addr : address.getIterable()) { ...
getLower()
Returns the address in the range with the lowest numeric value.int
Returns the smallest prefix length possible such that this item includes the block of all values for that prefix length.getPrefixCount
(int prefixLength) The count of the number of distinct values within the prefix part of the address item, the bits that appear within the prefix length.Returns a prefix length for which the range of this item matches the block of all values for that prefix length.getUpper()
Returns the address in the range with the highest numeric value.intersect
(IPAddressSeqRange other) Returns the intersection of this range with the given range, a range which includes those addresses in both this and the given range.iterator()
Iterates through the individual addresses of this address or subnet.join
(IPAddressSeqRange other) If this range overlaps with the given range, or if the highest value of the lower range is one below the lowest value of the higher range, then the two are joined into a new larger range that is returned.prefixBlockIterator
(int prefLength) Iterates through the range of prefix blocks in this range instance using the given prefix length.prefixBlockSpliterator
(int prefLength) Partitions and traverses through the individual prefix blocks for the given prefix length.prefixBlockStream
(int prefLength) Returns a sequential stream of the prefix blocks for the given prefix length.prefixIterator
(int prefixLength) Iterates through the range of prefixes in this range instance using the given prefix length.prefixSpliterator
(int prefLength) Partitions and traverses through the individual prefixes for the given prefix length.prefixStream
(int prefLength) Returns a sequential stream of the individual prefixes for the given prefix length.Produces an array of prefix blocks that spans the same set of addresses.Produces an array of blocks that are sequential that cover the same set of addresses.Partitions and traverses through the individual addresses.stream()
Returns a sequential stream of the individual address components.subtract
(IPAddressSeqRange other) Subtracts the given range from this range, to produce either zero, one, or two address ranges that contain the addresses in this range and not in the given range.toIPv4String
(Function<IPv4Address, String> lowerStringer, String separator, Function<IPv4Address, String> upperStringer) Converts to a sequential range from the lowest and highest addresses in this range, returns "this" if one alreadyMethods inherited from class inet.ipaddr.IPAddressSeqRange
contains, contains, containsPrefixBlock, containsSinglePrefixBlock, equals, extend, getBitCount, getBytes, getBytes, getBytes, getCount, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, hashCode, includesMax, includesZero, isMax, isMore, isMultiple, isSequential, isZero, join, overlaps, toCanonicalString, toCanonicalString, toNormalizedString, toNormalizedString, toString, toString
Methods inherited from interface inet.ipaddr.format.AddressItem
compareTo, getByteCount, isFullRange
-
Constructor Details
-
IPv4AddressSeqRange
-
-
Method Details
-
getLower
Description copied from interface:IPAddressRange
Returns the address in the range with the lowest numeric value.- Specified by:
getLower
in interfaceAddressComponentRange
- Specified by:
getLower
in interfaceIPAddressRange
- Overrides:
getLower
in classIPAddressSeqRange
- Returns:
-
getUpper
Description copied from interface:IPAddressRange
Returns the address in the range with the highest numeric value.- Specified by:
getUpper
in interfaceAddressComponentRange
- Specified by:
getUpper
in interfaceIPAddressRange
- Overrides:
getUpper
in classIPAddressSeqRange
- Returns:
-
getIPv4Count
public long getIPv4Count()Equivalent toIPAddressSeqRange.getCount()
but returns a long- Returns:
-
getIPv4PrefixCount
public long getIPv4PrefixCount(int prefixLength) Equivalent togetPrefixCount(int)
but returns a long- Returns:
-
getPrefixCount
Description copied from interface:AddressItem
The count of the number of distinct values within the prefix part of the address item, the bits that appear within the prefix length.- Specified by:
getPrefixCount
in interfaceAddressItem
- Parameters:
prefixLength
-- Returns:
-
getIterable
Description copied from interface:IPAddressRange
Useful for using an instance in a "for-each loop", as infor(addr : address.getIterable()) { ... }
Otherwise just call
IPAddressRange.iterator()
directly.- Specified by:
getIterable
in interfaceAddressComponentRange
- Specified by:
getIterable
in interfaceIPAddressRange
- Specified by:
getIterable
in classIPAddressSeqRange
- Returns:
-
iterator
Description copied from interface:IPAddressRange
Iterates through the individual addresses of this address or subnet.Call
AddressItem.isMultiple()
to determine if this instance represents multiple, orAddressItem.getCount()
for the count.- Specified by:
iterator
in interfaceAddressComponentRange
- Specified by:
iterator
in interfaceIPAddressRange
- Specified by:
iterator
in interfaceIterable<IPv4Address>
- Specified by:
iterator
in classIPAddressSeqRange
- Returns:
-
spliterator
Description copied from interface:IPAddressRange
Partitions and traverses through the individual addresses.- Specified by:
spliterator
in interfaceAddressComponentRange
- Specified by:
spliterator
in interfaceIPAddressRange
- Specified by:
spliterator
in interfaceIterable<IPv4Address>
- Specified by:
spliterator
in classIPAddressSeqRange
- Returns:
-
stream
Description copied from interface:AddressComponentRange
Returns a sequential stream of the individual address components. For a parallel stream, callBaseStream.parallel()
on the returned stream.- Specified by:
stream
in interfaceAddressComponentRange
- Specified by:
stream
in classIPAddressSeqRange
- Returns:
-
prefixBlockIterator
Description copied from class:IPAddressSeqRange
Iterates through the range of prefix blocks in this range instance using the given prefix length.- Specified by:
prefixBlockIterator
in interfaceIPAddressRange
- Specified by:
prefixBlockIterator
in classIPAddressSeqRange
- Parameters:
prefLength
-- Returns:
-
prefixBlockSpliterator
public AddressComponentRangeSpliterator<IPv4AddressSeqRange,IPv4Address> prefixBlockSpliterator(int prefLength) Description copied from interface:IPAddressRange
Partitions and traverses through the individual prefix blocks for the given prefix length.- Specified by:
prefixBlockSpliterator
in interfaceIPAddressRange
- Specified by:
prefixBlockSpliterator
in classIPAddressSeqRange
- Returns:
-
prefixBlockStream
Description copied from interface:IPAddressRange
Returns a sequential stream of the prefix blocks for the given prefix length. For a parallel stream, callBaseStream.parallel()
on the returned stream.- Specified by:
prefixBlockStream
in interfaceIPAddressRange
- Specified by:
prefixBlockStream
in classIPAddressSeqRange
- Returns:
-
prefixIterator
Description copied from class:IPAddressSeqRange
Iterates through the range of prefixes in this range instance using the given prefix length.Since a range between two arbitrary addresses cannot always be represented with a single IPAddress instance, the returned iterator iterates through IPAddressRange instances.
For instance, if iterating from 1.2.3.4 to 1.2.4.5 with prefix 8, the range shares the same prefix 1, but the range cannot be represented by the address 1.2.3-4.4-5 which does not include 1.2.3.255 or 1.2.4.0 both of which are in the original range. Nor can the range be represented by 1.2.3-4.0-255 which includes 1.2.4.6 and 1.2.3.3, both of which were not in the original range. An IPAddressSeqRange is thus required to represent that prefixed range.
- Specified by:
prefixIterator
in interfaceIPAddressRange
- Overrides:
prefixIterator
in classIPAddressSeqRange
- Parameters:
prefixLength
-- Returns:
-
prefixStream
Description copied from interface:IPAddressRange
Returns a sequential stream of the individual prefixes for the given prefix length. For a parallel stream, callBaseStream.parallel()
on the returned stream.- Specified by:
prefixStream
in interfaceIPAddressRange
- Specified by:
prefixStream
in classIPAddressSeqRange
- Returns:
-
prefixSpliterator
Description copied from interface:IPAddressRange
Partitions and traverses through the individual prefixes for the given prefix length.- Specified by:
prefixSpliterator
in interfaceIPAddressRange
- Specified by:
prefixSpliterator
in classIPAddressSeqRange
- Returns:
-
coverWithPrefixBlock
Description copied from interface:IPAddressRange
Returns the minimal-size prefix block that covers all the addresses in this range. The resulting block will have a larger address count than this range, unless this range is already a prefix block.- Specified by:
coverWithPrefixBlock
in interfaceIPAddressRange
- Specified by:
coverWithPrefixBlock
in classIPAddressSeqRange
-
spanWithPrefixBlocks
Description copied from interface:IPAddressRange
Produces an array of prefix blocks that spans the same set of addresses.- Specified by:
spanWithPrefixBlocks
in interfaceIPAddressRange
- Specified by:
spanWithPrefixBlocks
in classIPAddressSeqRange
-
spanWithSequentialBlocks
Description copied from interface:IPAddressRange
Produces an array of blocks that are sequential that cover the same set of addresses. This array can be shorter than that produced byIPAddressRange.spanWithPrefixBlocks()
and is never longer.- Specified by:
spanWithSequentialBlocks
in interfaceIPAddressRange
- Specified by:
spanWithSequentialBlocks
in classIPAddressSeqRange
-
getMinPrefixLengthForBlock
public int getMinPrefixLengthForBlock()Description copied from interface:AddressItem
Returns the smallest prefix length possible such that this item includes the block of all values for that prefix length.If the entire range can be dictated this way, then this method returns the same value as
AddressItem.getPrefixLengthForSingleBlock()
. Otherwise, this method will return the minimal possible prefix that can be paired with this address, whileAddressItem.getPrefixLengthForSingleBlock()
will return null.In cases where the final bit is constant so there is no such block, this returns the bit count.
- Specified by:
getMinPrefixLengthForBlock
in interfaceAddressItem
- Returns:
- the prefix length
-
getPrefixLengthForSingleBlock
Description copied from interface:AddressItem
Returns a prefix length for which the range of this item matches the block of all values for that prefix length.If the range can be dictated this way, then this method returns the same value as
AddressItem.getMinPrefixLengthForBlock()
.If no such prefix length exists, returns null.
If this item represents a single value, this returns the bit count.
- Specified by:
getPrefixLengthForSingleBlock
in interfaceAddressItem
- Returns:
- the prefix length or null
-
toIPv4String
public String toIPv4String(Function<IPv4Address, String> lowerStringer, String separator, Function<IPv4Address, String> upperStringer) -
intersect
Description copied from class:IPAddressSeqRange
Returns the intersection of this range with the given range, a range which includes those addresses in both this and the given range.- Overrides:
intersect
in classIPAddressSeqRange
- Parameters:
other
-- Returns:
-
join
Description copied from class:IPAddressSeqRange
If this range overlaps with the given range, or if the highest value of the lower range is one below the lowest value of the higher range, then the two are joined into a new larger range that is returned.Otherwise null is returned.
- Overrides:
join
in classIPAddressSeqRange
- Parameters:
other
-- Returns:
-
subtract
Description copied from class:IPAddressSeqRange
Subtracts the given range from this range, to produce either zero, one, or two address ranges that contain the addresses in this range and not in the given range. If the result has length 2, the two ranges are ordered by ascending lowest range value.- Overrides:
subtract
in classIPAddressSeqRange
- Parameters:
other
-- Returns:
-
toSequentialRange
Description copied from interface:IPAddressRange
Converts to a sequential range from the lowest and highest addresses in this range, returns "this" if one alreadyThe result will represent the same set of addresses if and only if
IPAddressRange.isSequential()
is true- Specified by:
toSequentialRange
in interfaceIPAddressRange
-