java.lang.Object
inet.ipaddr.format.AddressDivisionBase
inet.ipaddr.format.large.IPAddressLargeDivision
- All Implemented Interfaces:
AddressGenericDivision
,AddressItem
,IPAddressGenericDivision
,AddressStringDivision
,IPAddressStringDivision
,Serializable
,Comparable<AddressItem>
This class supports a segment or division of an arbitrary number of bits.
For a bit count less than or equal to 63 bits, AddressDivision
or IPAddressDivision
is a more efficient choice,
which are based on arithmetic using longs and can be grouped with AddressDivisionGrouping
and IPAddressDivisionGrouping
respectively.
- Author:
- sfoley
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionIPAddressLargeDivision
(byte[] bytes, byte[] upperBytes, int bitCount, int defaultRadix, IPAddressNetwork<?, ?, ?, ?, ?> network, Integer prefixLength) IPAddressLargeDivision
(byte[] bytes, int bitCount, int defaultRadix) IPAddressLargeDivision
(byte[] bytes, int bitCount, int defaultRadix, IPAddressNetwork<?, ?, ?, ?, ?> network, Integer prefixLength) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Two divisions are equal if they: - they match type/version (ipv4, ipv6, mac, or a specific division class) - match bit counts - match values Prefix lengths, for those divisions that have them, are ignored.int
Provides the number of bits comprising this address itemint
int
getDigitCount
(int radix) Returns the count of digits of the value, or if a range, the larger value in the rangeint
int
getMaxDigitCount
(int radix) Returns the count of digits of the largest possible valueint
getPrefixAdjustedRangeString
(int segmentIndex, AddressSegmentParams params, StringBuilder appendable) Produces a string to represent the segment of the form a-b where the value b has been adjusted for the prefix, anything beyond the prefix length being zero.Produces a normalized string to represent the segment.Returns the highest value represented by this address item, the highest value included in the range of valuesgetValue()
Returns the lowest value represented by this address item, the lowest value included in the range of valuesProduces a string to represent the segment, favouring wildcards and range characters over the network prefix to represent subnets.boolean
Returns whether this item includes the maximum possible value for the address type or version within its rangeboolean
Returns whether this item includes the value of zero within its rangeboolean
isBoundedBy
(int val) Returns true if the possible values of this division fall below the given boundary value.boolean
isMax()
Returns whether this item matches the maximum possible value for the address type or versionboolean
Whether this represents multiple potential values (eg a prefixed address or a segment representing a range of values)boolean
Returns whether the division range includes the block of values for its prefix lengthboolean
boolean
Returns whether the division range matches the block of values for its prefix lengthboolean
isZero()
Returns whether this item matches the value of zeroMethods inherited from class inet.ipaddr.format.AddressDivisionBase
getBytes, getBytes, getBytes, getDigitCount, getLowerStandardString, getStandardString, getUpperBytes, getUpperBytes, getUpperBytes, hashCode, toString
Methods inherited from interface inet.ipaddr.format.AddressItem
compareTo, containsPrefixBlock, containsSinglePrefixBlock, getByteCount, getBytes, getBytes, getBytes, getCount, getMinPrefixLengthForBlock, getPrefixCount, getPrefixLengthForSingleBlock, getUpperBytes, getUpperBytes, getUpperBytes
Methods inherited from interface inet.ipaddr.format.string.AddressStringDivision
getLowerStandardString, getStandardString
Methods inherited from interface inet.ipaddr.format.IPAddressGenericDivision
isFullRange
-
Field Details
-
EXTENDED_DIGITS_RANGE_SEPARATOR
public static final char EXTENDED_DIGITS_RANGE_SEPARATOR- See Also:
-
EXTENDED_DIGITS_RANGE_SEPARATOR_STR
-
EXTENDED_DIGITS
public static final char[] EXTENDED_DIGITS
-
-
Constructor Details
-
IPAddressLargeDivision
public IPAddressLargeDivision(byte[] bytes, int bitCount, int defaultRadix) throws AddressValueException - Throws:
AddressValueException
-
IPAddressLargeDivision
public IPAddressLargeDivision(byte[] bytes, int bitCount, int defaultRadix, IPAddressNetwork<?, ?, throws AddressValueException?, ?, ?> network, Integer prefixLength) - Parameters:
bytes
-bitCount
-defaultRadix
-network
- can be null if prefixLength is nullprefixLength
-- Throws:
AddressValueException
-
IPAddressLargeDivision
public IPAddressLargeDivision(byte[] bytes, byte[] upperBytes, int bitCount, int defaultRadix, IPAddressNetwork<?, ?, throws AddressValueException?, ?, ?> network, Integer prefixLength) - Throws:
AddressValueException
-
-
Method Details
-
getValue
Description copied from interface:AddressItem
Returns the lowest value represented by this address item, the lowest value included in the range of values- Specified by:
getValue
in interfaceAddressItem
- Returns:
- the lowest value represented by this address item
-
getUpperValue
Description copied from interface:AddressItem
Returns the highest value represented by this address item, the highest value included in the range of values- Specified by:
getUpperValue
in interfaceAddressItem
- Returns:
- the highest value represented by this address item
-
isBoundedBy
public boolean isBoundedBy(int val) Description copied from interface:AddressStringDivision
Returns true if the possible values of this division fall below the given boundary value.- Specified by:
isBoundedBy
in interfaceAddressStringDivision
-
getDigitCount
public int getDigitCount(int radix) Description copied from interface:AddressStringDivision
Returns the count of digits of the value, or if a range, the larger value in the range- Specified by:
getDigitCount
in interfaceAddressStringDivision
- Parameters:
radix
-- Returns:
-
getBitCount
public int getBitCount()Description copied from interface:AddressItem
Provides the number of bits comprising this address item- Specified by:
getBitCount
in interfaceAddressItem
- Specified by:
getBitCount
in interfaceIPAddressStringDivision
- Returns:
- the number of bits
-
isMultiple
public boolean isMultiple()Description copied from interface:AddressItem
Whether this represents multiple potential values (eg a prefixed address or a segment representing a range of values)- Specified by:
isMultiple
in interfaceAddressItem
-
includesZero
public boolean includesZero()Description copied from interface:AddressItem
Returns whether this item includes the value of zero within its range- Specified by:
includesZero
in interfaceAddressItem
- Returns:
- whether this item includes the value of zero within its range
-
includesMax
public boolean includesMax()Description copied from interface:AddressItem
Returns whether this item includes the maximum possible value for the address type or version within its range- Specified by:
includesMax
in interfaceAddressItem
- Returns:
- whether this item includes the maximum possible value within its range
-
isMax
public boolean isMax()Description copied from interface:AddressItem
Returns whether this item matches the maximum possible value for the address type or version- Specified by:
isMax
in interfaceAddressItem
- Returns:
- whether this item matches the maximum possible value
-
isZero
public boolean isZero()Description copied from interface:AddressItem
Returns whether this item matches the value of zero- Specified by:
isZero
in interfaceAddressItem
- Returns:
- whether this item matches the value of zero
-
getDefaultTextualRadix
public int getDefaultTextualRadix() -
getMaxDigitCount
public int getMaxDigitCount() -
getMaxDigitCount
public int getMaxDigitCount(int radix) Description copied from interface:AddressStringDivision
Returns the count of digits of the largest possible value- Specified by:
getMaxDigitCount
in interfaceAddressStringDivision
- Parameters:
radix
-- Returns:
-
getString
Produces a normalized string to represent the segment. If the segment CIDR prefix length covers the range, then it is assumed to be a CIDR, and the string has only the lower value of the CIDR range. Otherwise, the explicit range will be printed.- Returns:
-
getWildcardString
Produces a string to represent the segment, favouring wildcards and range characters over the network prefix to represent subnets. If it exists, the segment CIDR prefix is ignored and the explicit range is printed.- Returns:
-
getPrefixAdjustedRangeString
public int getPrefixAdjustedRangeString(int segmentIndex, AddressSegmentParams params, StringBuilder appendable) Description copied from interface:IPAddressStringDivision
Produces a string to represent the segment of the form a-b where the value b has been adjusted for the prefix, anything beyond the prefix length being zero.- Specified by:
getPrefixAdjustedRangeString
in interfaceIPAddressStringDivision
- Returns:
- if the supplied appendable is null, returns the length of the string that would have been appended, otherwise returns 0
-
isPrefixBlock
public boolean isPrefixBlock()Description copied from interface:IPAddressStringDivision
Returns whether the division range includes the block of values for its prefix length- Specified by:
isPrefixBlock
in interfaceIPAddressStringDivision
-
isSinglePrefixBlock
public boolean isSinglePrefixBlock()Returns whether the division range matches the block of values for its prefix length- Specified by:
isSinglePrefixBlock
in interfaceIPAddressStringDivision
-
getDivisionPrefixLength
- Specified by:
getDivisionPrefixLength
in interfaceIPAddressStringDivision
-
isPrefixed
public boolean isPrefixed()- Specified by:
isPrefixed
in interfaceIPAddressGenericDivision
-
equals
Description copied from class:AddressDivisionBase
Two divisions are equal if they: - they match type/version (ipv4, ipv6, mac, or a specific division class) - match bit counts - match values Prefix lengths, for those divisions that have them, are ignored.- Overrides:
equals
in classAddressDivisionBase
-