public interface AddressDivisionSeries extends AddressItem, AddressStringDivisionSeries
Modifier and Type | Method and Description |
---|---|
boolean |
containsPrefixBlock(int prefixLength)
Returns whether the values of this series contains the prefix block for the given prefix length.
|
boolean |
containsSinglePrefixBlock(int prefixLength)
Returns whether the values of this series contains a single prefix block for the given prefix length.
|
AddressDivision |
getDivision(int index) |
java.lang.String[] |
getDivisionStrings()
Get standard-format strings for each of the divisions in the series.
|
int |
getMinPrefixLengthForBlock()
Returns the smallest prefix length possible such that this address division series includes the block of addresses for that prefix.
|
java.math.BigInteger |
getPrefixCount()
If this has a prefix length, the count of the range of values in the prefix.
|
java.lang.Integer |
getPrefixLength()
The bit-length of the portion of the address that is not specific to an individual address but common amongst a group of addresses.
|
java.lang.Integer |
getPrefixLengthForSingleBlock()
Returns a prefix length for which the range of this division series matches the the block of addresses for that prefix.
|
java.math.BigInteger |
getUpperValue() |
java.math.BigInteger |
getValue() |
int |
isMore(AddressDivisionSeries other)
Use this method to compare the counts of two address series.
|
boolean |
isPrefixBlock()
Returns whether this address segment series represents a block of addresses associated with its prefix length.
|
boolean |
isPrefixed()
Whether there exists a prefix.
|
boolean |
isSinglePrefixBlock()
Returns whether the range of values matches a single subnet block for the prefix length
|
getBitCount, getBytes, getBytes, getCount, getUpperBytes, getUpperBytes, includesMax, includesZero, isFullRange, isMax, isMultiple, isZero
getDivisionCount
int isMore(AddressDivisionSeries other)
AddressDivision getDivision(int index)
getDivision
in interface AddressStringDivisionSeries
boolean isPrefixed()
java.lang.Integer getPrefixLength()
Typically this is the largest number of bits in the upper-most portion of the section for which the remaining bits assume all possible values.
For IP addresses, this must be explicitly defined when the address is created. For example, 1.2.0.0/16 has a prefix length of 16, while 1.2.*.* has no prefix length, even though they both represent the same set of addresses and are considered equal. Prefixes can be considered variable for any given IP addresses and can depend on the routing table.
The methods getMinPrefixLengthForBlock()
and getPrefixLengthForSingleBlock()
can help you to obtain or define a prefix length if one does not exist already.
1.2.0.0/16 and 1.2.*.* both the same equivalent and minimum prefix length of 16.
For MAC addresses, the prefix is initially defined by the range, so 1:2:3:*:*:* has a prefix length of 24 by definition. Addresses derived from the original may retain the original prefix length regardless of their range.
boolean isPrefixBlock()
This returns false if it has no prefix length or if it is a range of addresses that does not include the entire subnet block for the prefix length.
If AddressNetwork.getPrefixConfiguration()
is set to consider all prefixes as subnets, this returns true for any series with a prefix length.
boolean containsPrefixBlock(int prefixLength) throws PrefixLenException
isPrefixBlock()
is that isPrefixBlock()
returns
false if the series does not have a prefix length assigned to it,
even if there exists one or more prefix lengths for which containsPrefixBlock(int)
returns true. This method simply returns whether it contains all the values for the given prefix length block
regardless of whether that prefix length has been assigned to this series.
Use getMinPrefixLengthForBlock()
to determine the smallest prefix length for which this method returns true.
prefixLength
- PrefixLenException
- if prefixLength exceeds the bit count or is negativeboolean isSinglePrefixBlock()
boolean containsSinglePrefixBlock(int prefixLength) throws PrefixLenException
isSinglePrefixBlock()
is that isSinglePrefixBlock()
returns
false if the series does not have a prefix length assigned to it,
even if there exists a prefix length for which containsSinglePrefixBlock(int)
returns true. This method simply returns whether it contains exactly the values for the given prefix length block
regardless of whether that prefix length has been assigned to this series.
Use getPrefixLengthForSingleBlock()
to determine whether there is a prefix length for which this method returns true.
prefixLength
- PrefixLenException
- if prefixLength exceeds the bit count or is negativejava.math.BigInteger getPrefixCount()
If this has no prefix length, returns the same value as AddressItem.getCount()
int getMinPrefixLengthForBlock()
If the entire range can be dictated this way, then this method returns the same value as getPrefixLengthForSingleBlock()
.
Otherwise, this method will return the minimal possible prefix that can be paired with this address, while getPrefixLengthForSingleBlock()
will return null.
In cases where the final bit in this address division series is constant, this returns the bit length of this address division series.
java.lang.Integer getPrefixLengthForSingleBlock()
If the range can be dictated this way, then this method returns the same value as getMinPrefixLengthForBlock()
.
If no such prefix exists, returns null.
If this segment grouping represents a single value, returns the bit length of this address division series.
java.lang.String[] getDivisionStrings()
java.math.BigInteger getValue()
java.math.BigInteger getUpperValue()