- java.lang.Object
-
- inet.ipaddr.format.AddressDivisionBase
-
- inet.ipaddr.format.large.IPAddressLargeDivision
-
- All Implemented Interfaces:
AddressGenericDivision,AddressItem,IPAddressGenericDivision,AddressStringDivision,IPAddressStringDivision,java.io.Serializable,java.lang.Comparable<AddressItem>
public class IPAddressLargeDivision extends AddressDivisionBase implements IPAddressGenericDivision
This class supports a segment or division of an arbitrary number of bits.For a bit count less than or equal to 63 bits,
AddressDivisionorIPAddressDivisionis a more efficient choice, which are based on arithmetic using longs and can be grouped withAddressDivisionGroupingandIPAddressDivisionGroupingrespectively.- Author:
- sfoley
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static charEXTENDED_DIGITS_RANGE_SEPARATORstatic java.lang.StringEXTENDED_DIGITS_RANGE_SEPARATOR_STR-
Fields inherited from class inet.ipaddr.format.AddressDivisionBase
EXTENDED_DIGITS
-
-
Constructor Summary
Constructors Constructor Description IPAddressLargeDivision(byte[] bytes, byte[] upperBytes, int bitCount, int defaultRadix, IPAddressNetwork<?,?,?,?,?> network, java.lang.Integer prefixLength)IPAddressLargeDivision(byte[] bytes, int bitCount, int defaultRadix)IPAddressLargeDivision(byte[] bytes, int bitCount, int defaultRadix, IPAddressNetwork<?,?,?,?,?> network, java.lang.Integer prefixLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object other)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.intgetBitCount()Provides the number of bits comprising this address itemintgetDefaultTextualRadix()intgetDigitCount(int radix)Returns the count of digits of the value, or if a range, the larger value in the rangejava.lang.IntegergetDivisionPrefixLength()intgetMaxDigitCount()intgetMaxDigitCount(int radix)Returns the count of digits of the largest possible valueintgetPrefixAdjustedRangeString(int segmentIndex, AddressSegmentParams params, java.lang.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.java.lang.StringgetString()Produces a normalized string to represent the segment.java.math.BigIntegergetUpperValue()Returns the highest value represented by this address item, the highest value included in the range of valuesjava.math.BigIntegergetValue()Returns the lowest value represented by this address item, the lowest value included in the range of valuesjava.lang.StringgetWildcardString()Produces a string to represent the segment, favouring wildcards and range characters over the network prefix to represent subnets.booleanincludesMax()Returns whether this item includes the maximum possible value for the address type or version within its rangebooleanincludesZero()Returns whether this item includes the value of zero within its rangebooleanisBoundedBy(int val)Returns true if the possible values of this division fall below the given boundary value.booleanisMax()Returns whether this item matches the maximum possible value for the address type or versionbooleanisMultiple()Whether this represents multiple potential values (eg a prefixed address or a segment representing a range of values)booleanisPrefixBlock()Returns whether the division range includes the block of values for its prefix lengthbooleanisPrefixed()booleanisSinglePrefixBlock()Returns whether the division range matches the block of values for its prefix lengthbooleanisZero()Returns whether this item matches the value of zero-
Methods inherited from class inet.ipaddr.format.AddressDivisionBase
getBytes, getBytes, getBytes, getDigitCount, 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 Detail
-
EXTENDED_DIGITS_RANGE_SEPARATOR
public static final char EXTENDED_DIGITS_RANGE_SEPARATOR
- See Also:
- Constant Field Values
-
EXTENDED_DIGITS_RANGE_SEPARATOR_STR
public static final java.lang.String EXTENDED_DIGITS_RANGE_SEPARATOR_STR
-
-
Constructor Detail
-
IPAddressLargeDivision
public IPAddressLargeDivision(byte[] bytes, int bitCount, int defaultRadix) throws AddressValueException- Throws:
AddressValueException
-
IPAddressLargeDivision
public IPAddressLargeDivision(byte[] bytes, int bitCount, int defaultRadix, IPAddressNetwork<?,?,?,?,?> network, java.lang.Integer prefixLength) throws AddressValueException- 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<?,?,?,?,?> network, java.lang.Integer prefixLength) throws AddressValueException- Throws:
AddressValueException
-
-
Method Detail
-
getValue
public java.math.BigInteger getValue()
Description copied from interface:AddressItemReturns the lowest value represented by this address item, the lowest value included in the range of values- Specified by:
getValuein interfaceAddressItem- Returns:
- the lowest value represented by this address item
-
getUpperValue
public java.math.BigInteger getUpperValue()
Description copied from interface:AddressItemReturns the highest value represented by this address item, the highest value included in the range of values- Specified by:
getUpperValuein interfaceAddressItem- Returns:
- the highest value represented by this address item
-
isBoundedBy
public boolean isBoundedBy(int val)
Description copied from interface:AddressStringDivisionReturns true if the possible values of this division fall below the given boundary value.- Specified by:
isBoundedByin interfaceAddressStringDivision
-
getDigitCount
public int getDigitCount(int radix)
Description copied from interface:AddressStringDivisionReturns the count of digits of the value, or if a range, the larger value in the range- Specified by:
getDigitCountin interfaceAddressStringDivision- Returns:
-
getBitCount
public int getBitCount()
Description copied from interface:AddressItemProvides the number of bits comprising this address item- Specified by:
getBitCountin interfaceAddressItem- Specified by:
getBitCountin interfaceIPAddressStringDivision- Returns:
- the number of bits
-
isMultiple
public boolean isMultiple()
Description copied from interface:AddressItemWhether this represents multiple potential values (eg a prefixed address or a segment representing a range of values)- Specified by:
isMultiplein interfaceAddressItem
-
includesZero
public boolean includesZero()
Description copied from interface:AddressItemReturns whether this item includes the value of zero within its range- Specified by:
includesZeroin interfaceAddressItem- Returns:
- whether this item includes the value of zero within its range
-
includesMax
public boolean includesMax()
Description copied from interface:AddressItemReturns whether this item includes the maximum possible value for the address type or version within its range- Specified by:
includesMaxin interfaceAddressItem- Returns:
- whether this item includes the maximum possible value within its range
-
isMax
public boolean isMax()
Description copied from interface:AddressItemReturns whether this item matches the maximum possible value for the address type or version- Specified by:
isMaxin interfaceAddressItem- Returns:
- whether this item matches the maximum possible value
-
isZero
public boolean isZero()
Description copied from interface:AddressItemReturns whether this item matches the value of zero- Specified by:
isZeroin 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:AddressStringDivisionReturns the count of digits of the largest possible value- Specified by:
getMaxDigitCountin interfaceAddressStringDivision- Returns:
-
getString
public java.lang.String 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
public java.lang.String 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, java.lang.StringBuilder appendable)Description copied from interface:IPAddressStringDivisionProduces 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:
getPrefixAdjustedRangeStringin 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:IPAddressStringDivisionReturns whether the division range includes the block of values for its prefix length- Specified by:
isPrefixBlockin interfaceIPAddressStringDivision
-
isSinglePrefixBlock
public boolean isSinglePrefixBlock()
Returns whether the division range matches the block of values for its prefix length- Specified by:
isSinglePrefixBlockin interfaceIPAddressStringDivision
-
getDivisionPrefixLength
public java.lang.Integer getDivisionPrefixLength()
- Specified by:
getDivisionPrefixLengthin interfaceIPAddressStringDivision
-
isPrefixed
public boolean isPrefixed()
- Specified by:
isPrefixedin interfaceIPAddressGenericDivision
-
equals
public boolean equals(java.lang.Object other)
Description copied from class:AddressDivisionBaseTwo 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:
equalsin classAddressDivisionBase
-
-