public class MACAddressSegment extends AddressDivision implements AddressSegment, java.lang.Iterable<MACAddressSegment>
Modifier and Type | Field and Description |
---|---|
static MACAddressSegment |
ALL_RANGE_SEGMENT |
static MACAddressSegment |
FE_SEGMENT |
static MACAddressSegment |
FF_SEGMENT |
static int |
MAX_CHARS |
static MACAddressSegment |
ZERO_SEGMENT |
Constructor and Description |
---|
MACAddressSegment(int value)
Constructs a segment of an IPv4 or IPv6 address with the given value.
|
MACAddressSegment(int lower,
int upper)
Constructs a segment of a MAC address that represents a range of values.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(AddressSegment other) |
boolean |
contains(MACAddressSegment other) |
boolean |
equals(java.lang.Object other) |
int |
getBitCount() |
int |
getByteCount()
returns the number of bytes in each of the address components represented by this instance
|
int |
getDefaultTextualRadix() |
long |
getDivisionValueCount() |
java.lang.Iterable<MACAddressSegment> |
getIterable()
Useful for using an instance in a "for-each loop".
|
MACAddressSegment |
getLower()
If this segment represents a range of values, returns a segment representing just the lowest value in the range, otherwise returns this.
|
int |
getLowerSegmentValue()
returns the lower value
|
long |
getLowerValue() |
int |
getMaxDigitCount() |
int |
getMaxSegmentValue()
Gets the maximum possible value for this type of segment (for the highest range value of this particular segment, use
AddressSegment.getUpper() |
long |
getMaxValue() |
MACAddressSegment |
getUpper()
If this segment represents a range of values, returns a segment representing just the highest value in the range, otherwise returns this.
|
int |
getUpperSegmentValue()
returns the upper value
|
long |
getUpperValue() |
int |
getValueCount() |
int |
hashCode() |
boolean |
isBoundedBy(int value)
Returns true if the possible values of this division fall below the given value.
|
boolean |
isFullRange() |
java.util.Iterator<MACAddressSegment> |
iterator()
An address component can represent a single segment, address, or section, or it can represent multiple,
typically a subnet or range of segment, address, or section values.
|
boolean |
matches(int value) |
boolean |
matchesWithMask(int value,
int mask) |
MACAddressSegment |
reverseBits() |
MACAddressSegment |
reverseBits(boolean perByte)
Returns a new AddressComponent with the bits reversed.
|
MACAddressSegment |
reverseBytes()
Returns an AddressComponent with the bytes reversed.
|
java.lang.String |
toHexString(boolean with0xPrefix)
Writes this address component as a single hexadecimal value with always the exact same number of characters, with or without a preceding 0x prefix.
|
java.lang.String |
toNormalizedString()
Produces a string that is somewhat similar for all address components of the same type.
|
java.lang.String |
toNormalizedString(AddressDivisionGrouping.StringOptions options) |
compareTo, getCount, getDigitCount, getMaxDigitCount, hasUppercaseVariations, isMultiple, isZero, matches, matchesWithMask
getBytes, getBytes, getConfiguredString, getDigitCount, getPrefixAdjustedString, getStandardString, getString, getUpperBytes, getUpperBytes, toString
getBytes, getBytes, getCount, getUpperBytes, getUpperBytes, isMultiple, isZero
public static final MACAddressSegment ALL_RANGE_SEGMENT
public static final MACAddressSegment FF_SEGMENT
public static final MACAddressSegment FE_SEGMENT
public static final MACAddressSegment ZERO_SEGMENT
public static final int MAX_CHARS
public MACAddressSegment(int value)
value
- the value of the segmentpublic MACAddressSegment(int lower, int upper)
lower
- the lower value of the range of values represented by the segment.upper
- the upper value of the range of values represented by the segment.public int getValueCount()
getValueCount
in interface AddressSegment
AddressItem.getCount()
public long getDivisionValueCount()
getDivisionValueCount
in class AddressDivision
public int getBitCount()
getBitCount
in interface AddressItem
public int getByteCount()
AddressComponent
getByteCount
in interface AddressComponent
public long getMaxValue()
getMaxValue
in class AddressDivision
public long getLowerValue()
getLowerValue
in class AddressDivision
public long getUpperValue()
getUpperValue
in class AddressDivision
public int getLowerSegmentValue()
getLowerSegmentValue
in interface AddressSegment
public int getUpperSegmentValue()
getUpperSegmentValue
in interface AddressSegment
public MACAddressSegment getLower()
AddressSegment
getLower
in interface AddressComponent
getLower
in interface AddressSegment
public MACAddressSegment getUpper()
AddressSegment
getUpper
in interface AddressComponent
getUpper
in interface AddressSegment
public MACAddressSegment reverseBits(boolean perByte)
AddressComponent
reverseBits
in interface AddressComponent
reverseBits
in interface AddressSegment
perByte
- if true, only the bits in each byte are reversed, if false, then all bits in the component are reversedpublic MACAddressSegment reverseBits()
public MACAddressSegment reverseBytes()
AddressComponent
reverseBytes
in interface AddressComponent
reverseBytes
in interface AddressSegment
public boolean isBoundedBy(int value)
AddressDivision
isBoundedBy
in interface AddressStringDivision
isBoundedBy
in class AddressDivision
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in interface AddressSegment
equals
in class java.lang.Object
public boolean contains(MACAddressSegment other)
other
- public boolean isFullRange()
isFullRange
in interface AddressItem
isFullRange
in class AddressDivision
public int getDefaultTextualRadix()
getDefaultTextualRadix
in class AddressDivisionBase
public int getMaxDigitCount()
getMaxDigitCount
in class AddressDivisionBase
public boolean matches(int value)
matches
in interface AddressSegment
public boolean matchesWithMask(int value, int mask)
matchesWithMask
in interface AddressSegment
public java.lang.Iterable<MACAddressSegment> getIterable()
AddressComponent
AddressComponent.iterator()
directly.getIterable
in interface AddressComponent
getIterable
in interface AddressSegment
public java.util.Iterator<MACAddressSegment> iterator()
AddressComponent
AddressItem.isMultiple()
to determine if this instance represents multiple.
This method iterates through the individual elements.iterator
in interface AddressComponent
iterator
in interface AddressSegment
iterator
in interface java.lang.Iterable<MACAddressSegment>
public int getMaxSegmentValue()
AddressSegment
AddressSegment.getUpper()
getMaxSegmentValue
in interface AddressSegment
public boolean contains(AddressSegment other)
contains
in interface AddressSegment
public java.lang.String toHexString(boolean with0xPrefix)
AddressComponent
toHexString
in interface AddressComponent
public java.lang.String toNormalizedString()
AddressComponent
toNormalizedString
in interface AddressComponent
public java.lang.String toNormalizedString(AddressDivisionGrouping.StringOptions options)