public abstract class AddressDivision extends AddressDivisionBase
Modifier and Type | Class and Description |
---|---|
static class |
AddressDivision.BitwiseOrResult
Represents the result of a bitwise or of a sequential range of values
|
static class |
AddressDivision.MaskResult
Represents the result of masking a sequential range of values
|
EXTENDED_DIGITS
Modifier and Type | Method and Description |
---|---|
static AddressDivision.BitwiseOrResult |
bitwiseOrRange(long value,
long upperValue,
long maskValue)
Applies bitwise or to a range of values.
|
boolean |
equals(Object o)
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 |
getDigitCount(int radix)
Returns the count of digits of the value, or if a range, the larger value in the range
|
abstract long |
getDivisionValue() |
int |
getMaxDigitCount(int radix)
Returns the count of digits of the largest possible value
|
long |
getMaxValue() |
int |
getMinPrefixLengthForBlock()
Returns the smallest prefix length possible such that this item includes the block of all values for that prefix length.
|
Integer |
getPrefixLengthForSingleBlock()
Returns a prefix length for which the range of this item matches the block of all values for that prefix length.
|
abstract long |
getUpperDivisionValue() |
BigInteger |
getUpperValue()
Returns the highest value represented by this address item, the highest value included in the range of values
|
BigInteger |
getValue()
Returns the lowest value represented by this address item, the lowest value included in the range of values
|
int |
hashCode() |
boolean |
hasUppercaseVariations(int radix,
boolean lowerOnly) |
boolean |
includesMax()
Returns whether this item includes the maximum possible value for the address type or version within its range
|
boolean |
includesZero()
Returns whether this item includes the value of zero within its range
|
boolean |
isBitwiseOrCompatibleWithRange(int maskValue)
Similar to masking, checks that the range resulting from the bitwise "or" operation is sequential.
|
boolean |
isBoundedBy(int value)
Returns true if the possible values of this division fall below the given value.
|
boolean |
isMaskCompatibleWithRange(int maskValue)
Check that the range resulting from the mask is contiguous, otherwise it cannot be represented by a division or segment instance.
|
boolean |
isMax()
Returns whether this item matches the maximum possible value for the address type or version
|
boolean |
isMultiple()
Whether this represents multiple potential values (eg a prefixed address or a segment representing a range of values)
|
boolean |
isZero()
Returns whether this item matches the value of zero
|
static AddressDivision.MaskResult |
maskRange(long value,
long upperValue,
long maskValue)
Returns an object that provides the masked values for a range,
which for subnets is an aggregation of all masked individual addresses in the subnet.
|
boolean |
matches(long value) |
boolean |
matchesWithMask(long value,
long mask) |
boolean |
matchesWithMask(long lowerValue,
long upperValue,
long mask)
returns whether masking with the given mask results in a valid contiguous range for this segment,
and if it does, if it matches the range obtained when masking the given values with the same mask.
|
getBytes, getBytes, getBytes, getDigitCount, getDigitCount, getLowerStandardString, getStandardString, getUpperBytes, getUpperBytes, getUpperBytes, toString
compareTo, containsPrefixBlock, containsSinglePrefixBlock, getBitCount, getBitsForCount, getBlockSize, getByteCount, getCount, getPrefixCount, isFullRange
public boolean isMultiple()
AddressItem
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.
public 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.
public long getMaxValue()
public boolean isZero()
AddressItem
public boolean includesZero()
AddressItem
public boolean isMax()
AddressItem
public boolean includesMax()
AddressItem
public abstract long getDivisionValue()
public abstract long getUpperDivisionValue()
public int hashCode()
hashCode
in class AddressDivisionBase
public BigInteger getValue()
AddressItem
public BigInteger getUpperValue()
AddressItem
public boolean isBoundedBy(int value)
public boolean matches(long value)
public boolean matchesWithMask(long value, long mask)
public boolean matchesWithMask(long lowerValue, long upperValue, long mask)
lowerValue
- upperValue
- mask
- public boolean equals(Object o)
AddressDivisionBase
equals
in class AddressDivisionBase
public boolean isMaskCompatibleWithRange(int maskValue)
maskValue
- public static AddressDivision.MaskResult maskRange(long value, long upperValue, long maskValue)
bitwiseOrRange(long, long, long)
value
- upperValue
- maskValue
- public boolean isBitwiseOrCompatibleWithRange(int maskValue)
maskValue
- public static AddressDivision.BitwiseOrResult bitwiseOrRange(long value, long upperValue, long maskValue)
maskRange(long, long, long)
maskValue
- public boolean hasUppercaseVariations(int radix, boolean lowerOnly)
public int getDigitCount(int radix)
AddressStringDivision
public int getMaxDigitCount(int radix)
AddressStringDivision