public class MACAddressSection extends AddressDivisionGrouping implements AddressSection, Iterable<MACAddressSection>
Modifier and Type | Class and Description |
---|---|
static class |
MACAddressSection.MACStringOptions
Represents a clear way to create a specific type of string.
|
AddressDivisionGrouping.DivisionLengthProvider, AddressDivisionGrouping.DivisionValueProvider, AddressDivisionGrouping.StringOptions
Modifier and Type | Field and Description |
---|---|
int |
addressSegmentIndex |
boolean |
extended |
Constructor and Description |
---|
MACAddressSection(Address.SegmentValueProvider valueProvider) |
MACAddressSection(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
int startIndex,
boolean extended) |
MACAddressSection(Address.SegmentValueProvider valueProvider,
int startIndex,
boolean extended) |
MACAddressSection(byte[] bytes) |
MACAddressSection(byte[] bytes,
int startIndex,
boolean extended) |
MACAddressSection(long value) |
MACAddressSection(long value,
int startIndex,
boolean extended) |
MACAddressSection(MACAddressSegment segment)
Constructs a single segment section, the segment being the leading segment.
|
MACAddressSection(MACAddressSegment[] segments)
Use this constructor for any address section that includes the leading segment of a MAC address
|
MACAddressSection(MACAddressSegment[] segments,
int startIndex,
boolean extended) |
MACAddressSection(MACAddressSegment segment,
int startIndex,
boolean extended)
Constructs a single segment section with the segment at the given index in the address.
|
Modifier and Type | Method and Description |
---|---|
MACAddressSection |
adjustPrefixBySegment(boolean nextSegment)
Increases or decreases prefix length to the next segment boundary.
|
MACAddressSection |
adjustPrefixBySegment(boolean nextSegment,
boolean zeroed)
Increases or decreases prefix length to the next segment boundary.
|
MACAddressSection |
adjustPrefixLength(int adjustment)
Increases or decreases prefix length by the given increment.
|
MACAddressSection |
adjustPrefixLength(int adjustment,
boolean zeroed)
Increases or decreases prefix length by the given increment.
|
MACAddressSection |
append(MACAddressSection other) |
MACAddressSection |
appendToPrefix(MACAddressSection other) |
MACAddressSection |
applyPrefixLength(int prefixLength)
Deprecated.
|
boolean |
contains(AddressSection other)
Determines if one section contains another.
|
boolean |
contains(MACAddressSection other) |
BigInteger |
enumerate(AddressSection other)
Indicates where an address section sits relative to the ordering of individual address sections within this section.
|
boolean |
equals(Object o)
Two groupings are equal if:
- they match type/version (ipv4, ipv6, mac, or a specific grouping class)
- they match division counts
- each division matches bit counts
- each division matches their specific grouping class
- each division matches values
Prefix lengths, for those groupings and/or divisionsS that have them, are ignored.
|
int |
getBitCount()
Provides the number of bits comprising this address item
|
int |
getBitsPerSegment()
Returns the number of bits comprising each segment in this series.
|
BigInteger |
getBlockCount(int segmentCount)
Returns the count of values in the initial (higher) count of divisions.
|
int |
getByteCount()
Provides the number of bytes required for this address item, rounding up if the bit count is not a multiple of 8
|
int |
getBytesPerSegment()
Returns the number of bytes comprising each segment in this series.
|
MACAddressSegment |
getDivision(int index) |
AddressDivisionGrouping |
getDottedGrouping() |
IPv6AddressNetwork |
getIPv6Network() |
Iterable<MACAddressSection> |
getIterable()
Useful for using an instance in a "for-each loop".
|
MACAddressSection |
getLower()
If this represents a series with ranging values, returns a series representing the lower values of the range.
|
int |
getMaxSegmentValue()
Returns the maximum possible segment value for this type of address.
|
MACAddressNetwork |
getNetwork()
Returns the network object for components of the same version (eg IPv4, IPv6 and MAC each have their own network object)
|
MACAddressSection |
getODISection() |
int |
getODISegmentCount() |
MACAddressSection |
getOUISection() |
int |
getOUISegmentCount() |
BigInteger |
getPrefixCount(int prefixLength)
The count of the number of distinct values within the prefix part of the address item, the bits that appear within the prefix length.
|
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.
|
MACAddressSection |
getSection()
Gets the subsection from the series that comprises all segments
|
MACAddressSection |
getSection(int index)
Gets the subsection from the series starting from the given index
The first segment is at index 0.
|
MACAddressSection |
getSection(int index,
int endIndex)
Gets the subsection from the series starting from the given index and ending just before the give endIndex
The first segment is at index 0.
|
MACAddressSegment |
getSegment(int index)
Returns the segment from this series at the given index.
|
int |
getSegmentCount()
Returns the number of segments in this series.
|
MACAddressSegment[] |
getSegments()
Returns the segments of this series of segments as an array.
|
void |
getSegments(AddressSegment[] segs)
Copies the existing segments into the given array.
|
void |
getSegments(Collection<? super MACAddressSegment> segs) |
void |
getSegments(int start,
int end,
AddressSegment[] segs,
int destIndex)
get the segments from start to end and insert into the segs array at the given index
|
void |
getSegments(int start,
int end,
Collection<? super MACAddressSegment> segs) |
String[] |
getSegmentStrings()
Returns the an array with the values of each segment as they would appear in the normalized with wildcards string.
|
MACAddressSection |
getUpper()
If this represents a series with ranging values, returns a series representing the upper values of the range.
|
MACAddressSection |
increment(long increment)
Returns the series from the subnet that is the given increment upwards into the subnet range, with the increment of 0
returning the first address in the range.
|
MACAddressSection |
incrementBoundary(long increment)
If the given increment is positive, adds the value to the upper series (
AddressSegmentSeries.getUpper() ) in the subnet range to produce a new series. |
MACAddressSection |
insert(int index,
MACAddressSection other) |
boolean |
isEntireAddress(boolean extended) |
boolean |
isEUI64(boolean asMAC)
Equivalent to isEUI64(asMAC, false)
|
boolean |
isEUI64(boolean asMAC,
boolean partial)
Whether this section is consistent with an EUI64 section,
which means it came from an extended 8 byte address,
and the corresponding segments in the middle match 0xff and 0xff/fe for MAC/not-MAC
|
boolean |
isExtended() |
boolean |
isPrefixed()
Indicates if the address represents all devices with the same OUI segments.
|
Iterator<MACAddressSection> |
iterator()
Iterates through the individual address components.
|
long |
longValue() |
boolean |
overlaps(AddressSection other)
Determines if one section overlaps with another.
|
boolean |
overlaps(MACAddressSection other) |
Iterator<MACAddressSection> |
prefixBlockIterator()
Iterates through the individual prefix blocks.
|
AddressComponentSpliterator<MACAddressSection> |
prefixBlockSpliterator()
Partitions and traverses through the individual prefix blocks for the prefix length of this series.
|
Stream<MACAddressSection> |
prefixBlockStream()
Returns a sequential stream of the individual prefix blocks for the prefix length of this series.
|
boolean |
prefixEquals(AddressSection o)
Determines if the argument section matches this section up to the prefix length of this section.
|
Iterator<MACAddressSection> |
prefixIterator()
Iterates through the individual prefixes.
|
AddressComponentSpliterator<MACAddressSection> |
prefixSpliterator()
Partitions and traverses through the individual prefixes for the prefix length of this series.
|
Stream<MACAddressSection> |
prefixStream()
Returns a sequential stream of the individual prefixes for the prefix length of this series.
|
MACAddressSection |
removePrefixLength()
Deprecated.
|
MACAddressSection |
removePrefixLength(boolean zeroed)
Deprecated.
|
MACAddressSection |
replace(int startIndex,
int endIndex,
MACAddressSection replacement,
int replacementStartIndex,
int replacementEndIndex)
Replaces segments starting from startIndex and ending before endIndex with the segments starting at replacementStartIndex and
ending before replacementEndIndex from the replacement section
|
MACAddressSection |
replace(int index,
MACAddressSection replacement)
Replace the segments of this section starting at the given index with the given replacement segments
|
MACAddressSection |
reverseBits(boolean perByte)
Returns a new segment series with the bits reversed.
|
MACAddressSection |
reverseBytes()
Returns a new segment series with the bytes reversed.
|
MACAddressSection |
reverseBytesPerSegment()
Returns a new segment series with the bytes reversed within each segment.
|
MACAddressSection |
reverseSegments()
Returns a new segment series with the segments reversed.
|
Iterator<MACAddressSegment[]> |
segmentsIterator()
Iterates through the individual segments.
|
AddressComponentRangeSpliterator<MACAddressSection,MACAddressSegment[]> |
segmentsSpliterator()
Partitions and traverses through the individual segment arrays.
|
Stream<MACAddressSegment[]> |
segmentsStream()
Returns a sequential stream of the individual segment arrays.
|
MACAddressSection |
setPrefixLength(int prefixLength)
Sets the prefix length.
|
MACAddressSection |
setPrefixLength(int prefixLength,
boolean zeroed)
Sets the prefix length.
|
AddressComponentSpliterator<MACAddressSection> |
spliterator()
Partitions and traverses through the individual address components.
|
Stream<MACAddressSection> |
stream()
Returns a sequential stream of the individual address components.
|
String |
toCanonicalString()
This produces a canonical string using the canonical standardized IEEE 802 MAC address representation of xx-xx-xx-xx-xx-xx
For range segments, '..' is used: 11-22-33..44-55-66
|
String |
toColonDelimitedString() |
String |
toCompressedString()
This produces a shorter string for the address that uses the canonical representation but not using leading zeroes.
|
String |
toDashedString() |
String |
toDottedString()
This produces the dotted hexadecimal format aaaa.bbbb.cccc
|
MACAddressSection |
toEUI64(boolean asMAC)
If this section is part of a shorter 48 bit MAC or EUI-48 address see
isExtended() ,
then the required sections are inserted (FF-FF for MAC, FF-FE for EUI-48) to extend it to EUI-64. |
IPv6AddressSection |
toEUI64IPv6()
Converts to Ipv6.
|
String |
toHexString(boolean with0xPrefix)
Writes this address as a single hexadecimal value with always the exact same number of characters, with or without a preceding 0x prefix.
|
String |
toNormalizedString()
The normalized string returned by this method is the most common representation of MAC addresses: xx:xx:xx:xx:xx:xx
|
String |
toNormalizedString(AddressDivisionGrouping.StringOptions stringOptions) |
static String |
toNormalizedString(AddressDivisionGrouping.StringOptions opts,
AddressDivisionGrouping section) |
MACAddressSection |
toOUIPrefixBlock()
Returns a section in which the range of values match the block for the OUI (organizationally unique identifier) bytes
|
MACAddressSection |
toPrefixBlock()
If this series has a prefix length, returns the block for that prefix.
|
String |
toSpaceDelimitedString()
This produces a string delimited by spaces: aa bb cc dd ee ff
|
String |
toString() |
long |
upperLongValue() |
MACAddressSection |
withoutPrefixLength()
Provides the same address with no prefix.
|
containsPrefixBlock, containsSinglePrefixBlock, hashCode
getBytes, getBytes, getBytes, getCount, getDivisionCount, getDivisionStrings, getMinPrefixLengthForBlock, getPrefixCount, getPrefixLengthForSingleBlock, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, includesMax, includesZero, isFullRange, isMax, isMultiple, isPrefixBlock, isSequential, isSinglePrefixBlock, isZero
isOneBit, testBit
getCount, getDivisionStrings, getPrefixCount, getSequentialBlockIndex, isMore, isPrefixBlock, isSequential, isSinglePrefixBlock
getDivisionCount
stream, stream
compareTo, containsPrefixBlock, containsSinglePrefixBlock, getBitsForCount, getBlockSize, getBytes, getBytes, getBytes, getMinPrefixLengthForBlock, getPrefixLengthForSingleBlock, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, includesMax, includesZero, isFullRange, isMax, isMultiple, isZero
public final int addressSegmentIndex
public final boolean extended
public MACAddressSection(MACAddressSegment segment)
segment
- public MACAddressSection(MACAddressSegment segment, int startIndex, boolean extended)
segment
- public MACAddressSection(MACAddressSegment[] segments)
public MACAddressSection(MACAddressSegment[] segments, int startIndex, boolean extended)
public MACAddressSection(Address.SegmentValueProvider valueProvider)
public MACAddressSection(Address.SegmentValueProvider valueProvider, int startIndex, boolean extended)
public MACAddressSection(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, int startIndex, boolean extended)
public MACAddressSection(byte[] bytes, int startIndex, boolean extended)
public MACAddressSection(byte[] bytes)
public MACAddressSection(long value, int startIndex, boolean extended)
public MACAddressSection(long value)
public MACAddressNetwork getNetwork()
AddressComponent
getNetwork
in interface AddressComponent
public IPv6AddressNetwork getIPv6Network()
public boolean equals(Object o)
AddressDivisionGroupingBase
equals
in class AddressDivisionGrouping
public MACAddressSegment[] getSegments()
AddressSegmentSeries
AddressSegmentSeries.getSegment(int)
and AddressSegmentSeries.getSegmentCount()
instead when feasible.getSegments
in interface AddressSegmentSeries
public void getSegments(AddressSegment[] segs)
AddressSegmentSeries
AddressSegmentSeries.getSegmentCount()
getSegments
in interface AddressSegmentSeries
public void getSegments(int start, int end, AddressSegment[] segs, int destIndex)
AddressSegmentSeries
getSegments
in interface AddressSegmentSeries
start
- the first segment index from this series to be includedend
- the first segment index to be excludedsegs
- the target arraydestIndex
- where to insert the segments in the segs arraypublic boolean isExtended()
public int getSegmentCount()
AddressSegmentSeries
getSegmentCount
in interface AddressSegmentSeries
public boolean isEntireAddress(boolean extended)
public MACAddressSegment getDivision(int index)
getDivision
in interface AddressDivisionSeries
getDivision
in interface AddressStringDivisionSeries
getDivision
in class AddressDivisionGrouping
public MACAddressSegment getSegment(int index)
AddressSegmentSeries
AddressDivisionSeries.getDivision(int)
, the difference being that all segments in a given series are the same bit count, while divisions can have variable length.getSegment
in interface AddressSegmentSeries
public void getSegments(Collection<? super MACAddressSegment> segs)
public void getSegments(int start, int end, Collection<? super MACAddressSegment> segs)
public int getMaxSegmentValue()
AddressSegmentSeries
getMaxSegmentValue
in interface AddressSegmentSeries
public int getBitsPerSegment()
AddressSegmentSeries
getBitsPerSegment
in interface AddressSegmentSeries
public int getBytesPerSegment()
AddressSegmentSeries
getBytesPerSegment
in interface AddressSegmentSeries
public int getByteCount()
AddressItem
getByteCount
in interface AddressItem
public int getBitCount()
AddressItem
getBitCount
in interface AddressDivisionSeries
getBitCount
in interface AddressItem
public BigInteger getBlockCount(int segmentCount)
AddressDivisionSeries
getBlockCount
in interface AddressDivisionSeries
public BigInteger getPrefixCount(int prefixLength)
AddressItem
getPrefixCount
in interface AddressDivisionSeries
getPrefixCount
in interface AddressItem
public boolean isPrefixed()
isPrefixed
in interface AddressDivisionSeries
isPrefixed
in class AddressDivisionGroupingBase
public int getOUISegmentCount()
public int getODISegmentCount()
public Integer getPrefixLength()
AddressDivisionSeries
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 AddressItem.getMinPrefixLengthForBlock()
and AddressItem.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.
getPrefixLength
in interface AddressDivisionSeries
getPrefixLength
in class AddressDivisionGroupingBase
public MACAddressSection getSection()
AddressSegmentSeries
getSection
in interface AddressSegmentSeries
public MACAddressSection getSection(int index)
AddressSegmentSeries
getSection
in interface AddressSegmentSeries
public MACAddressSection getSection(int index, int endIndex)
AddressSegmentSeries
getSection
in interface AddressSegmentSeries
public MACAddressSection getOUISection()
public MACAddressSection getODISection()
public MACAddressSection toOUIPrefixBlock()
public IPv6AddressSection toEUI64IPv6()
public boolean isEUI64(boolean asMAC)
public boolean isEUI64(boolean asMAC, boolean partial)
partial
- whether missing segments are considered a match (this only has an effect if this section came from an extended 8 byte address),
or in other words, we don't consider 6 byte addresses to be "missing" the bytes that would make it 8 byte.asMAC
- whether to search for the ffff or fffe patternpublic MACAddressSection toEUI64(boolean asMAC)
isExtended()
,
then the required sections are inserted (FF-FF for MAC, FF-FE for EUI-48) to extend it to EUI-64.
However, if the section does not encompass the parts of the address where
the new sections should be placed, then the section is unchanged.
If the section is already part of an EUI-64 address, then it is checked
to see if it has the segments that identify it as extended to EUI-64 (FF-FF for MAC, FF-FE for EUI-48),
and if not, IncompatibleAddressException
is thrown.asMAC
- public MACAddressSection append(MACAddressSection other)
public MACAddressSection appendToPrefix(MACAddressSection other)
public MACAddressSection insert(int index, MACAddressSection other)
public MACAddressSection replace(int index, MACAddressSection replacement)
index
- replacement
- public MACAddressSection replace(int startIndex, int endIndex, MACAddressSection replacement, int replacementStartIndex, int replacementEndIndex)
startIndex
- endIndex
- replacement
- replacementStartIndex
- replacementEndIndex
- IndexOutOfBoundsException
AddressValueException
- if the resulting section would exceed the maximum segment count for this address type and versionpublic MACAddressSection getLower()
AddressSegmentSeries
getLower
in interface AddressSection
getLower
in interface AddressSegmentSeries
getLower
in interface AddressComponentRange
public MACAddressSection getUpper()
AddressSegmentSeries
getUpper
in interface AddressSection
getUpper
in interface AddressSegmentSeries
getUpper
in interface AddressComponentRange
public long longValue()
public long upperLongValue()
public MACAddressSection reverseBits(boolean perByte)
AddressSegmentSeries
reverseBits
in interface AddressComponent
reverseBits
in interface AddressSection
reverseBits
in interface AddressSegmentSeries
perByte
- if true, only the bits in each byte are reversed, if false, then all bits in the component are reversedpublic MACAddressSection reverseBytes()
AddressSegmentSeries
reverseBytes
in interface AddressComponent
reverseBytes
in interface AddressSection
reverseBytes
in interface AddressSegmentSeries
public MACAddressSection reverseBytesPerSegment()
AddressSegmentSeries
reverseBytesPerSegment
in interface AddressSection
reverseBytesPerSegment
in interface AddressSegmentSeries
public MACAddressSection reverseSegments()
AddressSegmentSeries
IncompatibleAddressException
since all address series can reverse their segments.reverseSegments
in interface AddressSection
reverseSegments
in interface AddressSegmentSeries
@Deprecated public MACAddressSection removePrefixLength()
AddressSegmentSeries
If the series already has a prefix length, the bits outside the prefix become zero.
Use AddressSegmentSeries.withoutPrefixLength()
to remove the prefix length without changing the series values.
Equivalent to calling removePrefixLength(true)
removePrefixLength
in interface AddressSection
removePrefixLength
in interface AddressSegmentSeries
for an alternative which does not change the address series values.
public MACAddressSection withoutPrefixLength()
AddressSegmentSeries
Use AddressSegmentSeries.removePrefixLength()
as an alternative that deletes the host at the same time by zeroing the host values.
withoutPrefixLength
in interface AddressSection
withoutPrefixLength
in interface AddressSegmentSeries
@Deprecated public MACAddressSection removePrefixLength(boolean zeroed)
AddressSegmentSeries
AddressSegmentSeries.removePrefixLength()
removePrefixLength
in interface AddressSection
removePrefixLength
in interface AddressSegmentSeries
zeroed
- whether the bits outside the prefix become zeropublic MACAddressSection adjustPrefixBySegment(boolean nextSegment)
AddressSegmentSeries
Follows the same rules as AddressSegmentSeries.adjustPrefixLength(int)
:
When prefix length is increased, the bits moved within the prefix become zero.
When a prefix length is decreased, the bits moved outside the prefix become zero.
To avoid the zeroing behaviour, use AddressSegmentSeries.adjustPrefixBySegment(boolean, boolean)
with second arg false.
adjustPrefixBySegment
in interface AddressSection
adjustPrefixBySegment
in interface AddressSegmentSeries
nextSegment
- whether to move prefix to previous or following segment boundarypublic MACAddressSection adjustPrefixBySegment(boolean nextSegment, boolean zeroed)
AddressSegmentSeries
adjustPrefixBySegment
in interface AddressSection
adjustPrefixBySegment
in interface AddressSegmentSeries
nextSegment
- whether to move prefix to previous or following segment boundaryzeroed
- whether the bits that move from one side of the prefix to the other become zero or retain their original valuespublic MACAddressSection adjustPrefixLength(int adjustment)
AddressSegmentSeries
When prefix length is increased, the bits moved within the prefix become zero.
When the prefix is extended beyond the segment series boundary, it is removed.
When a prefix length is decreased, the bits moved outside the prefix become zero.
To avoid the zeroing behaviour, use AddressSegmentSeries.adjustPrefixLength(int, boolean)
with second arg false.
adjustPrefixLength
in interface AddressSection
adjustPrefixLength
in interface AddressSegmentSeries
public MACAddressSection adjustPrefixLength(int adjustment, boolean zeroed)
AddressSegmentSeries
adjustPrefixLength
in interface AddressSection
adjustPrefixLength
in interface AddressSegmentSeries
adjustment
- the incrementzeroed
- whether the bits that move from one side of the prefix to the other become zero or retain their original values@Deprecated public MACAddressSection applyPrefixLength(int prefixLength)
AddressSegmentSeries
Similar to AddressSegmentSeries.setPrefixLength(int)
except that prefix lengths are never increased.
When this series already has a prefix length that is less than or equal to the requested prefix length, this series is returned.
Otherwise the returned series has the given prefix length.
The bits moved outside the prefix will become zero in the returned series.
applyPrefixLength
in interface AddressSection
applyPrefixLength
in interface AddressSegmentSeries
AddressSegmentSeries.setPrefixLength(int)
public MACAddressSection setPrefixLength(int prefixLength)
AddressSegmentSeries
If this series has a prefix length, and the prefix length is increased, the bits moved within the prefix become zero.
For an alternative that does not set bits to zero, use AddressSegmentSeries.setPrefixLength(int, boolean)
with the second argument as false.
When the prefix is extended beyond the segment series boundary, it is removed.
The bits that move from one side of the prefix length to the other (ie bits moved into the prefix or outside the prefix) are zeroed.
setPrefixLength
in interface AddressSection
setPrefixLength
in interface AddressSegmentSeries
public MACAddressSection setPrefixLength(int prefixLength, boolean zeroed)
AddressSegmentSeries
When the prefix is extended beyond the segment series boundary, it is removed.
setPrefixLength
in interface AddressSection
setPrefixLength
in interface AddressSegmentSeries
zeroed
- whether the bits that move from one side of the prefix length to the other (ie bits moved into the prefix or outside the prefix) are zeroed.public MACAddressSection toPrefixBlock()
AddressSegmentSeries
toPrefixBlock
in interface AddressSection
toPrefixBlock
in interface AddressSegmentSeries
public Iterable<MACAddressSection> getIterable()
AddressComponentRange
AddressComponentRange.iterator()
directly.getIterable
in interface AddressSection
getIterable
in interface AddressSegmentSeries
getIterable
in interface AddressComponentRange
public Iterator<MACAddressSection> iterator()
AddressComponentRange
An address component can represent an individual segment, address, or section, or it can represent multiple, typically a subnet of addresses or a range of segment or section values.
Call AddressItem.isMultiple()
to determine if this instance represents multiple, or AddressItem.getCount()
for the count.
iterator
in interface AddressSection
iterator
in interface AddressSegmentSeries
iterator
in interface AddressComponentRange
iterator
in interface Iterable<MACAddressSection>
public Iterator<MACAddressSection> prefixIterator()
AddressSegmentSeries
If the series has no prefix length, then this is equivalent to AddressSegmentSeries.iterator()
prefixIterator
in interface AddressSection
prefixIterator
in interface AddressSegmentSeries
public Iterator<MACAddressSection> prefixBlockIterator()
AddressSegmentSeries
If the series has no prefix length, then this is equivalent to AddressSegmentSeries.iterator()
prefixBlockIterator
in interface AddressSection
prefixBlockIterator
in interface AddressSegmentSeries
public Iterator<MACAddressSegment[]> segmentsIterator()
AddressSegmentSeries
segmentsIterator
in interface AddressSegmentSeries
public AddressComponentRangeSpliterator<MACAddressSection,MACAddressSegment[]> segmentsSpliterator()
AddressSegmentSeries
segmentsSpliterator
in interface AddressSegmentSeries
public Stream<MACAddressSegment[]> segmentsStream()
AddressSegmentSeries
BaseStream.parallel()
on the returned stream.segmentsStream
in interface AddressSegmentSeries
public AddressComponentSpliterator<MACAddressSection> spliterator()
AddressComponentRange
spliterator
in interface AddressComponent
spliterator
in interface AddressSection
spliterator
in interface AddressSegmentSeries
spliterator
in interface AddressComponentRange
spliterator
in interface Iterable<MACAddressSection>
public Stream<MACAddressSection> stream()
AddressComponentRange
BaseStream.parallel()
on the returned stream.stream
in interface AddressSection
stream
in interface AddressSegmentSeries
stream
in interface AddressComponentRange
public AddressComponentSpliterator<MACAddressSection> prefixSpliterator()
AddressSegmentSeries
prefixSpliterator
in interface AddressSection
prefixSpliterator
in interface AddressSegmentSeries
public Stream<MACAddressSection> prefixStream()
AddressSegmentSeries
BaseStream.parallel()
on the returned stream.prefixStream
in interface AddressSection
prefixStream
in interface AddressSegmentSeries
public AddressComponentSpliterator<MACAddressSection> prefixBlockSpliterator()
AddressSegmentSeries
prefixBlockSpliterator
in interface AddressSection
prefixBlockSpliterator
in interface AddressSegmentSeries
public Stream<MACAddressSection> prefixBlockStream()
AddressSegmentSeries
BaseStream.parallel()
on the returned stream.prefixBlockStream
in interface AddressSection
prefixBlockStream
in interface AddressSegmentSeries
public MACAddressSection incrementBoundary(long increment)
AddressSegmentSeries
AddressSegmentSeries.getUpper()
) in the subnet range to produce a new series.
If the given increment is negative, adds the value to the lower series (AddressSegmentSeries.getLower()
) in the subnet range to produce a new series.
If the increment is zero, returns this.
In the case where the series is a single value, this simply returns the address produced by adding the given increment to this address series.
incrementBoundary
in interface AddressSection
incrementBoundary
in interface AddressSegmentSeries
public MACAddressSection increment(long increment)
AddressSegmentSeries
If the subnet has multiple values and the increment exceeds the subnet size, then the amount by which it exceeds the size - 1 is added to the upper series of the range (the final iterator value).
If the increment is negative, it is added to the lower series of the range (the first iterator value).
If the subnet is just a single address values, the series is simply incremented by the given value, positive or negative.
If a subnet has multiple values, a positive increment value is equivalent to the same number of values from the AddressSegmentSeries.iterator()
For instance, a increment of 0 is the first value from the iterator, an increment of 1 is the second value from the iterator, and so on.
A negative increment added to the subnet count is equivalent to the same number of values preceding the upper bound of the iterator.
For instance, an increment of count - 1 is the last value from the iterator, an increment of count - 2 is the second last value, and so on.
An increment of size count gives you the series just above the highest series of the subnet. To get the series just below the lowest series of the subnet, use the increment -1.
increment
in interface AddressSection
increment
in interface AddressSegmentSeries
public String toHexString(boolean with0xPrefix) throws IncompatibleAddressException
toHexString
in interface AddressComponent
IncompatibleAddressException
public String toNormalizedString(AddressDivisionGrouping.StringOptions stringOptions)
public static String toNormalizedString(AddressDivisionGrouping.StringOptions opts, AddressDivisionGrouping section)
public String toNormalizedString()
toNormalizedString
in interface AddressComponent
public String toCanonicalString()
toCanonicalString
in interface AddressSegmentSeries
public String toCompressedString()
toCompressedString
in interface AddressSegmentSeries
public String toDottedString() throws IncompatibleAddressException
IncompatibleAddressException
public String toSpaceDelimitedString()
public String toDashedString()
public String toColonDelimitedString()
public String toString()
toString
in class AddressDivisionGroupingBase
public String[] getSegmentStrings()
AddressSegmentSeries
getSegmentStrings
in interface AddressSegmentSeries
public AddressDivisionGrouping getDottedGrouping()
public boolean overlaps(AddressSection other)
AddressSection
Sections must have the same number of segments to be comparable.
For sections which are aware of their position in an address (IPv6 and MAC), their respective positions must match to be comparable.
overlaps
in interface AddressSection
public boolean overlaps(MACAddressSection other)
other
- public boolean contains(AddressSection other)
AddressSection
Sections must have the same number of segments to be comparable.
For sections which are aware of their position in an address (IPv6 and MAC), their respective positions must match to be comparable.
contains
in interface AddressSection
public boolean contains(MACAddressSection other)
other
- public BigInteger enumerate(AddressSection other)
AddressSection
Determines how many address section elements precede the given address section element, if the given address section is within this address section. If above the range, it is the distance to the upper boundary added to the address section count, and if below the range, the distance to the lower boundary.
In other words, if the given address section is not in this section but above it, returns the number of individual address sections preceding the given address section from the upper section boundary, added to the total number of individual address sections within. If the given address section is not in this section but below it, returns the number of individual address sections following the given address section to the lower section boundary.
enumerate returns null when the argument is a multi-valued section. The argument must be an individual address section.
When this address section is also single-valued, the returned value is the distance (difference) between this address section and the argument address section.
enumerate is the inverse of the increment method:
enumerate
in interface AddressSection
public boolean prefixEquals(AddressSection o)
AddressSection
The entire prefix of this section must be present in the other section to be comparable.
For sections which are aware of their position in an address (IPv6 and MAC), the argument section must have the same or an earlier position in the address to match all prefix segments of this section, and the matching is lined up relative to the position.
prefixEquals
in interface AddressSection