public class IPv4AddressSeqRange extends IPAddressSeqRange implements java.lang.Iterable<IPv4Address>
| Constructor and Description |
|---|
IPv4AddressSeqRange(IPv4Address first,
IPv4Address second) |
| Modifier and Type | Method and Description |
|---|---|
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()
If this instance represents multiple individual addresses, returns the one 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()
If this instance represents multiple individual addresses, returns the one 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.
|
java.util.Iterator<IPv4AddressSeqRange> |
prefixIterator(int prefixLength)
Iterates through the range of prefixes in this range instance using the given prefix length.
|
IPv4Address[] |
spanWithPrefixBlocks()
Produces an array of prefix blocks that cover the same set of addresses.
|
IPv4Address[] |
spanWithSequentialBlocks()
Produces an array of blocks that are sequential that cover the same set of addresses.
|
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, toStringcompareTo, getByteCount, isFullRange, testRange, testRangepublic IPv4AddressSeqRange(IPv4Address first, IPv4Address second)
public IPv4Address getLower()
IPAddressRangegetLower in interface AddressItemRangegetLower in interface IPAddressRangegetLower in class IPAddressSeqRangepublic IPv4Address getUpper()
IPAddressRangegetUpper in interface AddressItemRangegetUpper in interface IPAddressRangegetUpper in class IPAddressSeqRangepublic long getIPv4Count()
IPAddressSeqRange.getCount() but returns a longpublic long getIPv4PrefixCount(int prefixLength)
getPrefixCount(int) but returns a longpublic java.math.BigInteger getPrefixCount(int prefixLength)
AddressItemgetPrefixCount in interface AddressItempublic java.lang.Iterable<IPv4Address> getIterable()
IPAddressRangefor(addr : address.getIterable()) { ... }
Otherwise just call IPAddressRange.iterator() directly.
getIterable in interface AddressItemRangegetIterable in interface IPAddressRangegetIterable in class IPAddressSeqRangepublic 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 AddressItemRangeiterator in interface IPAddressRangeiterator in interface java.lang.Iterable<IPv4Address>iterator in class IPAddressSeqRangepublic java.util.Iterator<IPv4Address> prefixBlockIterator(int prefLength)
IPAddressSeqRangeprefixBlockIterator in interface IPAddressRangeprefixBlockIterator in class IPAddressSeqRangepublic java.util.Iterator<IPv4AddressSeqRange> prefixIterator(int prefixLength)
IPAddressSeqRangeprefixIterator in interface IPAddressRangeprefixIterator in class IPAddressSeqRangepublic IPv4Address[] spanWithPrefixBlocks()
IPAddressRangespanWithPrefixBlocks in interface IPAddressRangespanWithPrefixBlocks in class IPAddressSeqRangepublic IPv4Address[] spanWithSequentialBlocks()
IPAddressRangeIPAddressRange.spanWithPrefixBlocks() and is never longer.spanWithSequentialBlocks in interface IPAddressRangespanWithSequentialBlocks in class IPAddressSeqRangepublic 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 AddressItempublic 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 AddressItempublic 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)
IPAddressSeqRangeintersect in class IPAddressSeqRangepublic IPv4AddressSeqRange join(IPAddressSeqRange other)
IPAddressSeqRangeOtherwise null is returned.
join in class IPAddressSeqRangepublic IPv4AddressSeqRange[] subtract(IPAddressSeqRange other)
IPAddressSeqRangesubtract in class IPAddressSeqRange