public abstract class IPAddressSection extends IPAddressDivisionGrouping implements IPAddressSegmentSeries, AddressSection
IPAddressSection objects are immutable. Some of the derived state is created upon demand and cached. This also makes them thread-safe. Almost all operations that can be performed on IPAddress objects can also be performed on IPAddressSection objects and vice-versa.
Modifier and Type | Class and Description |
---|---|
static class |
IPAddressSection.IPStringBuilderOptions
This user-facing class is designed to be a clear way to create a collection of strings.
|
static class |
IPAddressSection.IPStringOptions
Represents a clear way to create a specific type of string.
|
static interface |
IPAddressSection.SegFunction<R,S> |
static class |
IPAddressSection.WildcardOptions |
IPAddressDivisionGrouping.Range, IPAddressDivisionGrouping.RangeList
AddressDivisionGrouping.StringOptions
Modifier and Type | Method and Description |
---|---|
abstract IPAddressSection |
adjustPrefixBySegment(boolean nextSegment)
Increases or decreases prefix length to the next segment boundary.
|
IPAddressSection |
adjustPrefixBySegment(boolean nextSegment,
boolean zeroed)
Increases or decreases prefix length to the next segment boundary.
|
abstract IPAddressSection |
adjustPrefixLength(int adjustment)
Increases or decreases prefix length by the given increment.
|
abstract IPAddressSection |
adjustPrefixLength(int adjustment,
boolean zeroed)
Increases or decreases prefix length by the given increment.
|
abstract IPAddressSection |
applyPrefixLength(int networkPrefixLength)
Applies the given prefix length to create a new segment series.
|
IPAddressSection |
assignMinPrefixForBlock()
Constructs an equivalent address section with the smallest CIDR prefix possible (largest network),
such that the range of values are a set of subnet blocks for that prefix.
|
IPAddressSection |
assignPrefixForSingleBlock()
Returns the equivalent CIDR address section with a prefix length for which the subnet block for that prefix matches the range of values in this section.
|
static int |
bitsPerSegment(IPAddress.IPVersion version) |
static int |
bytesPerSegment(IPAddress.IPVersion version) |
boolean |
contains(AddressSection other)
Determines if one section contains another.
|
boolean |
containsPrefixBlock(int prefixLength)
Returns whether the values of this division grouping contain the prefix block for the given prefix length
|
int |
getBitCount() |
java.lang.Integer |
getBlockMaskPrefixLength(boolean network)
If this address section is equivalent to the mask for a CIDR prefix block, it returns that prefix length.
|
int |
getByteCount()
returns the number of bytes in each of the address components represented by this instance
|
java.math.BigInteger |
getCountImpl() |
IPAddressSegment |
getDivision(int index) |
java.lang.Integer |
getHostBitCount() |
java.lang.Integer |
getHostSegmentCount() |
abstract java.lang.Iterable<? extends IPAddressSection> |
getIterable()
Useful for using an instance in a "for-each loop".
|
abstract IPAddressSection |
getLower()
If this represents a series with ranging values, returns a series representing the lower values of the range.
|
abstract IPAddressSection |
getLowerNonZeroHost()
Similar to
IPAddressSegmentSeries.getLower() , but will not return a series that has a prefix length and whose host value is zero. |
int |
getMinPrefixLengthForBlock()
Returns the smallest CIDR prefix length possible (largest network) for which this includes the block of address sections for that prefix.
|
java.lang.Integer |
getNetworkSegmentCount() |
java.math.BigInteger |
getNonZeroHostCount()
Gets the count of single value series that this series may represent.
|
IPAddressStringDivisionSeries[] |
getParts(IPAddressSection.IPStringBuilderOptions options)
Get all representations of this address including this IPAddressSection.
|
java.lang.Integer |
getPrefixLengthForSingleBlock()
Returns a prefix length for which the range of this address section matches the the block of addresses for that prefix.
|
abstract IPAddressSection |
getSection(int index)
Gets the subsection from the series starting from the given index
|
abstract IPAddressSection |
getSection(int index,
int endIndex)
Gets the subsection from the series starting from the given index and ending just before the give endIndex
|
IPAddressSegment |
getSegment(int index)
Returns the segment from this series at the given index.
|
int |
getSegmentCount()
Returns the number of segments in this series.
|
static java.lang.Integer |
getSegmentPrefixLength(int bitsPerSegment,
java.lang.Integer prefixLength,
int segmentIndex)
Across the address prefixes are:
IPv6: (null):...:(null):(1 to 16):(0):...:(0)
or IPv4: ...(null).(1 to 8).(0)...
|
void |
getSegments(AddressSegment[] segs)
Copies the existing segments into the given array.
|
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 the given index
|
java.lang.String[] |
getSegmentStrings()
Returns the an array with the values of each segment as they would appear in the normalized with wildcards string.
|
void |
getStartsWithSQLClause(java.lang.StringBuilder builder,
java.lang.String expression)
This method gives you an SQL clause that allows you to search the database for the front part of an address or
addresses in a given network.
|
void |
getStartsWithSQLClause(java.lang.StringBuilder builder,
java.lang.String expression,
IPAddressSQLTranslator translator) |
abstract IPAddressSection |
getUpper()
If this represents a series with ranging values, returns a series representing the upper values of the range
If this represents a series with a single value in each segment, returns this.
|
boolean |
includesMaxHost()
Returns whether the series has a host of all ones.
|
boolean |
includesMaxHost(int networkPrefixLength)
Returns whether all bits past the given prefix length are all ones.
|
boolean |
includesZeroHost()
Returns whether the series has a host of zero.
|
boolean |
includesZeroHost(int networkPrefixLength)
Returns whether all bits past the given prefix length are zero.
|
abstract IPAddressSection |
increment(long increment)
Returns the series from the subnet that is the given increment upwards into the subnet range,
or if the given increment is negative the given increment downwards into the subnet range,
or if this is just an individual series, it simply adds the increment to this.
|
boolean |
isEntireAddress() |
boolean |
isFullRange() |
boolean |
isIPv4() |
boolean |
isIPv6() |
boolean |
isSingleNetwork() |
abstract java.util.Iterator<? extends IPAddressSection> |
iterator()
Iterates through the individual segment series.
|
boolean |
matchesWithMask(IPAddressSection other,
IPAddressSection mask)
Applies the mask to this address section and then compares values with the given address section
|
abstract java.util.Iterator<? extends IPAddressSection> |
nonZeroHostIterator() |
abstract java.util.Iterator<? extends IPAddressSection> |
prefixBlockIterator()
Iterates through the individual prefix blocks.
|
abstract IPAddressSection |
removePrefixLength()
Removes the prefix length.
|
abstract IPAddressSection |
removePrefixLength(boolean zeroed)
Removes the prefix length.
|
abstract IPAddressSection |
reverseBits(boolean perByte)
Returns a new series which has the bits reversed.
|
abstract IPAddressSection |
reverseBytes()
Returns a new segment series with the bytes reversed.
|
abstract IPAddressSection |
reverseBytesPerSegment()
Returns a new segment series with the bytes reversed within each segment.
|
abstract IPAddressSection |
reverseSegments()
Returns a new segment series with the segments reversed.
|
abstract IPAddressSection |
setPrefixLength(int prefixLength)
Sets the prefix length.
|
abstract IPAddressSection |
setPrefixLength(int prefixLength,
boolean zeroed)
Sets the prefix length.
|
IPAddressPartStringCollection |
toAllStringCollection()
Use this method with care...
|
java.lang.String |
toBinaryString()
Writes this IP address segment series as a single binary value with always the exact same number of characters
If this section represents a range of values outside of the network prefix length, then this is printed as a range of two hex values.
|
IPAddressPartStringCollection |
toDatabaseSearchStringCollection()
Returns a set of strings for search the standard string representations in a database
-compress the largest compressible segments or no compression (a:0:0:c:d:0:e:f or a::c:d:0:e:f)
-upper/lowercase is not considered because many databases are case-insensitive
|
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.
|
abstract IPAddressSection |
toMaxHost()
Returns the segment series with a host of all ones.
|
abstract IPAddressSection |
toMaxHost(int prefixLength)
Produces the series with host values of all one bits for the given prefix length.
|
java.lang.String |
toNormalizedString(IPAddressSection.IPStringOptions stringOptions)
Creates a customized string from this series.
|
static java.lang.String |
toNormalizedString(IPAddressSection.IPStringOptions opts,
IPAddressStringDivisionSeries section) |
java.lang.String |
toOctalString(boolean with0Prefix)
Writes this IP address segment series as a single octal value with always the exact same number of characters, with or without a preceding 0 prefix.
|
abstract IPAddressSection |
toPrefixBlock()
If this series has a prefix length, returns the subnet block for that prefix.
|
abstract IPAddressSection |
toPrefixBlock(int networkPrefixLength)
Returns the segment series of the same length that spans all hosts.
|
IPAddressPartStringCollection |
toStandardStringCollection()
Returns at most a couple dozen string representations:
-mixed (1:2:3:4:5:6:1.2.3.4)
-upper and lower case
-full compressions or no compression (a:0:0:c:d:0:e:f or a::c:d:0:e:f or a:0:b:c:d::e:f)
-full leading zeros (000a:0000:000b:000c:000d:0000:000e:000f)
-combinations thereof
|
java.lang.String |
toString() |
abstract IPAddressSection |
toZeroHost()
Returns the segment series with a host of zero.
|
abstract IPAddressSection |
toZeroHost(int prefixLength)
Produces the series with host values of 0 for the given prefix length.
|
containsSinglePrefixBlock, equals, getNetwork, getNetworkPrefixLength, getPrefixLength, getZeroRangeSegments, getZeroSegments, isMore, isPrefixBlock, isPrefixed, isSinglePrefixBlock
compareTo, getBytes, getBytes, getCount, getDivisionCount, getDivisionStrings, getPrefixCount, getUpperBytes, getUpperBytes, getUpperValue, getValue, hashCode, includesMax, includesZero, isMax, isMultiple, isZero
getHostSection, getHostSection, getIPVersion, getNetwork, getNetworkPrefixLength, getNetworkSection, getNetworkSection, getNetworkSection, getSection, getSegments, segmentsIterator, segmentsNonZeroHostIterator, toCanonicalWildcardString, toCompressedWildcardString, toFullString, toNormalizedWildcardString, toPrefixLengthString, toReverseDNSLookupString, toSQLWildcardString, toStringCollection, toSubnetString
getBitsPerSegment, getBytesPerSegment, toCanonicalString, toCompressedString
containsSinglePrefixBlock, getDivisionStrings, getPrefixCount, getPrefixLength, getUpperValue, getValue, isMore, isPrefixBlock, isPrefixed, isSinglePrefixBlock
getDivisionCount
toNormalizedString
getBytes, getBytes, getCount, getUpperBytes, getUpperBytes, includesMax, includesZero, isMax, isMultiple, isZero
public int getBitCount()
getBitCount
in interface AddressItem
getBitCount
in class AddressDivisionGrouping
public int getByteCount()
AddressComponent
getByteCount
in interface AddressComponent
public static int bitsPerSegment(IPAddress.IPVersion version)
public static int bytesPerSegment(IPAddress.IPVersion version)
public java.math.BigInteger getNonZeroHostCount()
IPAddressSegmentSeries
AddressItem.getCount()
.getNonZeroHostCount
in interface IPAddressSegmentSeries
public java.math.BigInteger getCountImpl()
public boolean isIPv4()
public boolean isIPv6()
public java.lang.Integer getBlockMaskPrefixLength(boolean network)
network
- whether to check for a network mask or a host maskpublic java.lang.Integer getNetworkSegmentCount()
public java.lang.Integer getHostSegmentCount()
public java.lang.Integer getHostBitCount()
public static java.lang.Integer getSegmentPrefixLength(int bitsPerSegment, java.lang.Integer prefixLength, int segmentIndex)
public int getSegmentCount()
AddressSegmentSeries
getSegmentCount
in interface AddressSegmentSeries
public IPAddressSegment getSegment(int index)
AddressSegmentSeries
getSegment
in interface AddressSegmentSeries
getSegment
in interface IPAddressSegmentSeries
public IPAddressSegment getDivision(int index)
getDivision
in interface AddressDivisionSeries
getDivision
in interface AddressStringDivisionSeries
getDivision
in interface IPAddressStringDivisionSeries
getDivision
in class IPAddressDivisionGrouping
public boolean containsPrefixBlock(int prefixLength)
AddressDivisionGrouping
containsPrefixBlock
in interface AddressDivisionSeries
containsPrefixBlock
in class IPAddressDivisionGrouping
public boolean contains(AddressSection other)
AddressSection
contains
in interface AddressSection
other
- public boolean isFullRange()
isFullRange
in interface AddressItem
isFullRange
in class AddressDivisionGrouping
public abstract IPAddressSection toZeroHost()
IPAddressSegmentSeries
The resultant series will have the same prefix length if AddressNetwork.getPrefixConfiguration()
is not AddressNetwork.PrefixConfiguration.ALL_PREFIXED_ADDRESSES_ARE_SUBNETS
,
otherwise it will no longer have a prefix length.
For instance, you can get the network address for a subnet as follows:
String addrStr = "1.2.3.4/16";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress networkAddress = address.toZeroHost(); //1.2.0.0
toZeroHost
in interface IPAddressSegmentSeries
public abstract IPAddressSection toZeroHost(int prefixLength)
IPAddressSegmentSeries
If this series has the same prefix length, then the resulting series will too, otherwise the resulting series will have no prefix length.
This is nearly equivalent to doing the mask (bitwise conjunction) of this address series with the network mask for the given prefix length, but without the possibility of IncompatibleAddressException that can occur when applying a mask to a range of values. Instead, in this case, if the resulting series has a range of values, then the resulting series range boundaries will have host values of 0, but not necessarily the intervening values.
For instance, you can get the network address for a subnet of prefix length 16 as follows:
String addrStr = "1.2.3.4";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress networkAddress = address.toZeroHost(16); //1.2.0.0
toZeroHost
in interface IPAddressSegmentSeries
public abstract IPAddressSection toMaxHost()
IPAddressSegmentSeries
The resultant series will have the same prefix length if AddressNetwork.getPrefixConfiguration()
is not AddressNetwork.PrefixConfiguration.ALL_PREFIXED_ADDRESSES_ARE_SUBNETS
,
otherwise it will no longer have a prefix length.
For instance, you can get the broadcast address for a subnet as follows:
String addrStr = "1.2.3.4/16";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress broadcastAddress = address.toMaxHost(); //1.2.255.255
toMaxHost
in interface IPAddressSegmentSeries
public abstract IPAddressSection toMaxHost(int prefixLength)
IPAddressSegmentSeries
If this series has the same prefix length, then the resulting series will too, otherwise the resulting series will have no prefix length.
This is nearly equivalent to doing the bitwise or (bitwise disjunction) of this address series with the network mask for the given prefix length, but without the possibility of IncompatibleAddressException that can occur when applying a mask to a range of values. Instead, in this case, if the resulting series has a range of values, then the resulting series range boundaries will have host values of all ones, but not necessarily the intervening values.
For instance, you can get the broadcast address for a subnet of prefix length 16 as follows:
String addrStr = "1.2.3.4";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress broadcastAddress = address.toMaxHost(16); //1.2.255.255
toMaxHost
in interface IPAddressSegmentSeries
public abstract IPAddressSection applyPrefixLength(int networkPrefixLength) throws PrefixLenException
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
applyPrefixLength
in interface IPAddressSegmentSeries
PrefixLenException
AddressSegmentSeries.setPrefixLength(int)
public abstract IPAddressSection toPrefixBlock()
IPAddressSegmentSeries
toPrefixBlock
in interface AddressSection
toPrefixBlock
in interface AddressSegmentSeries
toPrefixBlock
in interface IPAddressSegmentSeries
public abstract IPAddressSection toPrefixBlock(int networkPrefixLength)
IPAddressSegmentSeries
toPrefixBlock
in interface IPAddressSegmentSeries
public IPAddressSection assignPrefixForSingleBlock()
If no such prefix length exists, returns null.
If this address represents just a single address, "this" is returned.
assignPrefixForSingleBlock
in interface IPAddressSegmentSeries
IPAddressSegmentSeries.toPrefixBlock()
,
IPAddressSegmentSeries.assignMinPrefixForBlock()
public IPAddressSection assignMinPrefixForBlock()
assignMinPrefixForBlock
in interface IPAddressSegmentSeries
IPAddressSegmentSeries.toPrefixBlock()
,
IPAddressSegmentSeries.assignPrefixForSingleBlock()
public boolean includesZeroHost()
IPAddressSegmentSeries
includesZeroHost
in interface IPAddressSegmentSeries
includesZeroHost
in class IPAddressDivisionGrouping
public boolean includesZeroHost(int networkPrefixLength)
IPAddressSegmentSeries
includesZeroHost
in interface IPAddressSegmentSeries
public boolean includesMaxHost()
IPAddressSegmentSeries
includesMaxHost
in interface IPAddressSegmentSeries
public boolean includesMaxHost(int networkPrefixLength)
IPAddressSegmentSeries
includesMaxHost
in interface IPAddressSegmentSeries
public boolean isSingleNetwork()
public boolean matchesWithMask(IPAddressSection other, IPAddressSection mask)
mask
- other
- public abstract IPAddressSection removePrefixLength(boolean zeroed)
IPAddressSegmentSeries
IPAddressSegmentSeries.removePrefixLength()
removePrefixLength
in interface AddressSection
removePrefixLength
in interface AddressSegmentSeries
removePrefixLength
in interface IPAddressSegmentSeries
zeroed
- whether the host bits become zero.public abstract IPAddressSection removePrefixLength()
IPAddressSegmentSeries
removePrefixLength
in interface AddressSection
removePrefixLength
in interface AddressSegmentSeries
removePrefixLength
in interface IPAddressSegmentSeries
IPAddressSegmentSeries.removePrefixLength(boolean)
public IPAddressSection adjustPrefixBySegment(boolean nextSegment, boolean zeroed)
AddressSegmentSeries
adjustPrefixBySegment
in interface AddressSection
adjustPrefixBySegment
in interface AddressSegmentSeries
adjustPrefixBySegment
in interface IPAddressSegmentSeries
nextSegment
- whether to move prefix to previous or following segment coundaryzeroed
- whether the bits that move from one side of the prefix to the other become zero or retain their original valuespublic abstract IPAddressSection 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.
adjustPrefixBySegment
in interface AddressSection
adjustPrefixBySegment
in interface AddressSegmentSeries
adjustPrefixBySegment
in interface IPAddressSegmentSeries
nextSegment
- whether to move prefix to previous or following segment coundarypublic abstract IPAddressSection 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.
adjustPrefixLength
in interface AddressSection
adjustPrefixLength
in interface AddressSegmentSeries
adjustPrefixLength
in interface IPAddressSegmentSeries
public abstract IPAddressSection adjustPrefixLength(int adjustment, boolean zeroed)
AddressSegmentSeries
adjustPrefixLength
in interface AddressSection
adjustPrefixLength
in interface AddressSegmentSeries
adjustPrefixLength
in interface IPAddressSegmentSeries
adjustment
- the incrementzeroed
- whether the bits that move from one side of the prefix to the other become zero or retain their original valuespublic abstract IPAddressSection 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.
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
setPrefixLength
in interface IPAddressSegmentSeries
AddressSegmentSeries.applyPrefixLength(int)
public abstract IPAddressSection 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
setPrefixLength
in interface IPAddressSegmentSeries
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 int getMinPrefixLengthForBlock()
getMinPrefixLengthForBlock
in interface AddressDivisionSeries
getMinPrefixLengthForBlock
in class AddressDivisionGrouping
IPAddressDivision.getBlockMaskPrefixLength(boolean)
public java.lang.Integer getPrefixLengthForSingleBlock()
If no such prefix exists, returns null
If this address section represents a single value, returns the bit length
getPrefixLengthForSingleBlock
in interface AddressDivisionSeries
getPrefixLengthForSingleBlock
in class IPAddressDivisionGrouping
public abstract IPAddressSection getLowerNonZeroHost()
IPAddressSegmentSeries
IPAddressSegmentSeries.getLower()
, but will not return a series that has a prefix length and whose host value is zero.
If this series has no prefix length, returns the same series as IPAddressSegmentSeries.getLower()
.getLowerNonZeroHost
in interface IPAddressSegmentSeries
public abstract IPAddressSection getLower()
AddressSegmentSeries
getLower
in interface AddressComponent
getLower
in interface AddressSection
getLower
in interface AddressSegmentSeries
getLower
in interface IPAddressSegmentSeries
public abstract IPAddressSection getUpper()
AddressSegmentSeries
getUpper
in interface AddressComponent
getUpper
in interface AddressSection
getUpper
in interface AddressSegmentSeries
getUpper
in interface IPAddressSegmentSeries
public abstract IPAddressSection reverseSegments()
AddressSegmentSeries
IncompatibleAddressException
since all address series can reverse their segments.reverseSegments
in interface AddressSection
reverseSegments
in interface AddressSegmentSeries
reverseSegments
in interface IPAddressSegmentSeries
public abstract IPAddressSection reverseBits(boolean perByte)
IPAddressSegmentSeries
If this has an associated prefix length, then the prefix length is dropped in the reversed series.
If this represents a range of values that cannot be reversed,
because reversing the range results in a set of addresses that cannot be described by a range, then this throws IncompatibleAddressException
.
In such cases you can call IPAddressSegmentSeries.iterator()
, IPAddressSegmentSeries.getLower()
, IPAddressSegmentSeries.getUpper()
or some other method to transform the address
into an address representing a single value before reversing.
reverseBits
in interface AddressComponent
reverseBits
in interface AddressSection
reverseBits
in interface AddressSegmentSeries
reverseBits
in interface IPAddressSegmentSeries
perByte
- if true, only the bits in each byte are reversed, if false, then all bits in the address are reversedpublic abstract IPAddressSection reverseBytes()
AddressSegmentSeries
reverseBytes
in interface AddressComponent
reverseBytes
in interface AddressSection
reverseBytes
in interface AddressSegmentSeries
reverseBytes
in interface IPAddressSegmentSeries
public abstract IPAddressSection reverseBytesPerSegment()
AddressSegmentSeries
reverseBytesPerSegment
in interface AddressSection
reverseBytesPerSegment
in interface AddressSegmentSeries
reverseBytesPerSegment
in interface IPAddressSegmentSeries
public abstract IPAddressSection getSection(int index)
AddressSegmentSeries
getSection
in interface AddressSegmentSeries
getSection
in interface IPAddressSegmentSeries
public abstract IPAddressSection getSection(int index, int endIndex)
AddressSegmentSeries
getSection
in interface AddressSegmentSeries
getSection
in interface IPAddressSegmentSeries
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 abstract java.lang.Iterable<? extends IPAddressSection> getIterable()
AddressComponent
AddressComponent.iterator()
directly.getIterable
in interface AddressComponent
getIterable
in interface AddressSection
getIterable
in interface AddressSegmentSeries
getIterable
in interface IPAddressSegmentSeries
public abstract java.util.Iterator<? extends IPAddressSection> nonZeroHostIterator()
nonZeroHostIterator
in interface IPAddressSegmentSeries
public abstract java.util.Iterator<? extends IPAddressSection> iterator()
AddressSegmentSeries
iterator
in interface AddressComponent
iterator
in interface AddressSection
iterator
in interface AddressSegmentSeries
iterator
in interface IPAddressSegmentSeries
public abstract java.util.Iterator<? extends IPAddressSection> prefixBlockIterator()
AddressSegmentSeries
AddressSegmentSeries.iterator()
prefixBlockIterator
in interface AddressSection
prefixBlockIterator
in interface AddressSegmentSeries
prefixBlockIterator
in interface IPAddressSegmentSeries
public abstract IPAddressSection increment(long increment)
AddressSegmentSeries
If the subnet has multiple values and the increment exceeds the subnet size, then the amount by which is exceeds the size is added to the upper series of the range (the final iterator value) or is subtracted from the lower series of the range (the first iterator value) if negative.
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 iterator. For instance, a increment of 1 is value 1 from the iterator, an increment of 2 is the second value from the iterator, and so on. A negative increment is equivalent to the same number of values preceding the upper bound of the iterator. For instance, an increment of -1 is the last value from the iterator, and increment of -2 is the second last value, and so on.
Therefore, to get the series just above the highest series of the subnet, use an increment of size:count > 1 ? count + 1 : 1
where count is the subnet size.
To get the series just below the lowest series of the subnet, use an increment of size:-(count > 1 ? count + 1 : 1)
where count is the subnet size.
increment
in interface AddressSection
increment
in interface AddressSegmentSeries
increment
in interface IPAddressSegmentSeries
public boolean isEntireAddress()
public java.lang.String toString()
toString
in class AddressDivisionGrouping
public java.lang.String[] getSegmentStrings()
AddressSegmentSeries
getSegmentStrings
in interface AddressSegmentSeries
public java.lang.String toBinaryString()
IPAddressSegmentSeries
toBinaryString
in interface IPAddressSegmentSeries
public java.lang.String toOctalString(boolean with0Prefix)
IPAddressSegmentSeries
toOctalString
in interface IPAddressSegmentSeries
public java.lang.String toHexString(boolean with0xPrefix)
AddressComponent
If this component represents a range of values outside of the network prefix length, then this is printed as a range of two hex values.
For instance, for IPv4 addresses there are 8 hex characters, for IPv6 addresses there are 32 hex characters.
toHexString
in interface AddressComponent
public java.lang.String toNormalizedString(IPAddressSection.IPStringOptions stringOptions)
IPAddressSegmentSeries
toNormalizedString
in interface IPAddressSegmentSeries
public static java.lang.String toNormalizedString(IPAddressSection.IPStringOptions opts, IPAddressStringDivisionSeries section)
public IPAddressPartStringCollection toStandardStringCollection()
public IPAddressPartStringCollection toAllStringCollection()
public IPAddressPartStringCollection toDatabaseSearchStringCollection()
public IPAddressStringDivisionSeries[] getParts(IPAddressSection.IPStringBuilderOptions options)
IPAddressDivisionGrouping
options
- public void getStartsWithSQLClause(java.lang.StringBuilder builder, java.lang.String expression)
getStartsWithSQLClause(StringBuilder, String, IPAddressSQLTranslator)
builder
- expression
- the expression that must match the condition, whether a column name or otherpublic void getStartsWithSQLClause(java.lang.StringBuilder builder, java.lang.String expression, IPAddressSQLTranslator translator)