public class IPv4AddressSeqRange extends IPAddressSeqRange implements java.lang.Iterable<IPv4Address>
IPAddressSeqRange
for more details.Constructor and Description |
---|
IPv4AddressSeqRange(IPv4Address first,
IPv4Address second) |
Modifier and Type | Method and Description |
---|---|
IPv4Address |
coverWithPrefixBlock()
Returns the minimal-size prefix block that covers all the addresses in this range.
|
long |
getIPv4Count()
Equivalent to
IPAddressSeqRange.getCount() but returns a long |
long |
getIPv4PrefixCount(int prefixLength)
Equivalent to
getPrefixCount(int) but returns a long |
java.lang.Iterable<IPv4Address> |
getIterable()
Useful for using an instance in a "for-each loop", as in
for(addr : address.getIterable()) { ... |
IPv4Address |
getLower()
Returns the address in the range with the lowest numeric value.
|
int |
getMinPrefixLengthForBlock()
Returns the smallest prefix length possible such that this item includes the block of all values for that prefix length.
|
java.math.BigInteger |
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.
|
java.lang.Integer |
getPrefixLengthForSingleBlock()
Returns a prefix length for which the range of this item matches the block of all values for that prefix length.
|
IPv4Address |
getUpper()
Returns the address in the range with the highest numeric value.
|
IPv4AddressSeqRange |
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 rqnge.
|
java.util.Iterator<IPv4Address> |
iterator()
Iterates through the individual addresses of this address or subnet.
|
IPv4AddressSeqRange |
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.
|
java.util.Iterator<IPv4Address> |
prefixBlockIterator(int prefLength)
Iterates through the range of prefix blocks in this range instance using the given prefix length.
|
AddressComponentRangeSpliterator<IPv4AddressSeqRange,IPv4Address> |
prefixBlockSpliterator(int prefLength)
Partitions and traverses through the individual prefix blocks for the given prefix length.
|
java.util.stream.Stream<IPv4Address> |
prefixBlockStream(int prefLength)
Returns a sequential stream of the prefix blocks for the given prefix length.
|
java.util.Iterator<IPv4AddressSeqRange> |
prefixIterator(int prefixLength)
Iterates through the range of prefixes in this range instance using the given prefix length.
|
AddressComponentSpliterator<IPv4AddressSeqRange> |
prefixSpliterator(int prefLength)
Partitions and traverses through the individual prefixes for the given prefix length.
|
java.util.stream.Stream<IPv4AddressSeqRange> |
prefixStream(int prefLength)
Returns a sequential stream of the individual prefixes for the given prefix length.
|
IPv4Address[] |
spanWithPrefixBlocks()
Produces an array of prefix blocks that spans the same set of addresses.
|
IPv4Address[] |
spanWithSequentialBlocks()
Produces an array of blocks that are sequential that cover the same set of addresses.
|
AddressComponentRangeSpliterator<IPv4AddressSeqRange,IPv4Address> |
spliterator()
Partitions and traverses through the individual addresses.
|
java.util.stream.Stream<IPv4Address> |
stream()
Returns a sequential stream of the individual address components.
|
IPv4AddressSeqRange[] |
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.
|
java.lang.String |
toIPv4String(java.util.function.Function<IPv4Address,java.lang.String> lowerStringer,
java.lang.String separator,
java.util.function.Function<IPv4Address,java.lang.String> upperStringer) |
contains, contains, containsPrefixBlock, containsSinglePrefixBlock, equals, getBitCount, getBytes, getBytes, getBytes, getCount, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, hashCode, includesMax, includesZero, isMax, isMore, isMultiple, isZero, join, overlaps, toCanonicalString, toCanonicalString, toNormalizedString, toNormalizedString, toString, toString
stream, stream
compareTo, getByteCount, isFullRange, testRange, testRange
public IPv4AddressSeqRange(IPv4Address first, IPv4Address second)
public IPv4Address getLower()
IPAddressRange
getLower
in interface AddressComponentRange
getLower
in interface IPAddressRange
getLower
in class IPAddressSeqRange
public IPv4Address getUpper()
IPAddressRange
getUpper
in interface AddressComponentRange
getUpper
in interface IPAddressRange
getUpper
in class IPAddressSeqRange
public long getIPv4Count()
IPAddressSeqRange.getCount()
but returns a longpublic long getIPv4PrefixCount(int prefixLength)
getPrefixCount(int)
but returns a longpublic java.math.BigInteger getPrefixCount(int prefixLength)
AddressItem
getPrefixCount
in interface AddressItem
public java.lang.Iterable<IPv4Address> getIterable()
IPAddressRange
for(addr : address.getIterable()) { ... }
Otherwise just call IPAddressRange.iterator()
directly.
getIterable
in interface AddressComponentRange
getIterable
in interface IPAddressRange
getIterable
in class IPAddressSeqRange
public java.util.Iterator<IPv4Address> iterator()
IPAddressRange
Call AddressItem.isMultiple()
to determine if this instance represents multiple, or AddressItem.getCount()
for the count.
iterator
in interface AddressComponentRange
iterator
in interface IPAddressRange
iterator
in interface java.lang.Iterable<IPv4Address>
iterator
in class IPAddressSeqRange
public AddressComponentRangeSpliterator<IPv4AddressSeqRange,IPv4Address> spliterator()
IPAddressRange
spliterator
in interface AddressComponentRange
spliterator
in interface IPAddressRange
spliterator
in interface java.lang.Iterable<IPv4Address>
spliterator
in class IPAddressSeqRange
public java.util.stream.Stream<IPv4Address> stream()
AddressComponentRange
BaseStream.parallel()
on the returned stream.stream
in interface AddressComponentRange
stream
in class IPAddressSeqRange
public java.util.Iterator<IPv4Address> prefixBlockIterator(int prefLength)
IPAddressSeqRange
prefixBlockIterator
in interface IPAddressRange
prefixBlockIterator
in class IPAddressSeqRange
public AddressComponentRangeSpliterator<IPv4AddressSeqRange,IPv4Address> prefixBlockSpliterator(int prefLength)
IPAddressRange
prefixBlockSpliterator
in interface IPAddressRange
prefixBlockSpliterator
in class IPAddressSeqRange
public java.util.stream.Stream<IPv4Address> prefixBlockStream(int prefLength)
IPAddressRange
BaseStream.parallel()
on the returned stream.prefixBlockStream
in interface IPAddressRange
prefixBlockStream
in class IPAddressSeqRange
public java.util.Iterator<IPv4AddressSeqRange> prefixIterator(int prefixLength)
IPAddressSeqRange
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.
prefixIterator
in interface IPAddressRange
prefixIterator
in class IPAddressSeqRange
public java.util.stream.Stream<IPv4AddressSeqRange> prefixStream(int prefLength)
IPAddressRange
BaseStream.parallel()
on the returned stream.prefixStream
in interface IPAddressRange
prefixStream
in class IPAddressSeqRange
public AddressComponentSpliterator<IPv4AddressSeqRange> prefixSpliterator(int prefLength)
IPAddressRange
prefixSpliterator
in interface IPAddressRange
prefixSpliterator
in class IPAddressSeqRange
public IPv4Address coverWithPrefixBlock()
IPAddressRange
coverWithPrefixBlock
in interface IPAddressRange
coverWithPrefixBlock
in class IPAddressSeqRange
public IPv4Address[] spanWithPrefixBlocks()
IPAddressRange
spanWithPrefixBlocks
in interface IPAddressRange
spanWithPrefixBlocks
in class IPAddressSeqRange
public IPv4Address[] spanWithSequentialBlocks()
IPAddressRange
IPAddressRange.spanWithPrefixBlocks()
and is never longer.spanWithSequentialBlocks
in interface IPAddressRange
spanWithSequentialBlocks
in class IPAddressSeqRange
public int getMinPrefixLengthForBlock()
AddressItem
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, while AddressItem.getPrefixLengthForSingleBlock()
will return null.
In cases where the final bit is constant so there is no such block, this returns the bit count.
getMinPrefixLengthForBlock
in interface AddressItem
public java.lang.Integer getPrefixLengthForSingleBlock()
AddressItem
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.
getPrefixLengthForSingleBlock
in interface AddressItem
public java.lang.String toIPv4String(java.util.function.Function<IPv4Address,java.lang.String> lowerStringer, java.lang.String separator, java.util.function.Function<IPv4Address,java.lang.String> upperStringer)
public IPv4AddressSeqRange intersect(IPAddressSeqRange other)
IPAddressSeqRange
intersect
in class IPAddressSeqRange
public IPv4AddressSeqRange join(IPAddressSeqRange other)
IPAddressSeqRange
Otherwise null is returned.
join
in class IPAddressSeqRange
public IPv4AddressSeqRange[] subtract(IPAddressSeqRange other)
IPAddressSeqRange
subtract
in class IPAddressSeqRange