- java.lang.Object
-
- inet.ipaddr.format.AddressDivisionGroupingBase
-
- inet.ipaddr.format.large.IPAddressLargeDivisionGrouping
-
- All Implemented Interfaces:
AddressDivisionSeries
,AddressItem
,IPAddressDivisionSeries
,AddressStringDivisionSeries
,IPAddressStringDivisionSeries
,java.io.Serializable
,java.lang.Comparable<AddressItem>
public class IPAddressLargeDivisionGrouping extends AddressDivisionGroupingBase implements IPAddressDivisionSeries
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IPAddressLargeDivisionGrouping(IPAddressLargeDivision[] divisions, IPAddressNetwork<?,?,?,?,?> network)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsPrefixBlock(int prefixLength)
Returns whether the values of this series contains the prefix block for the given prefix length.boolean
containsSinglePrefixBlock(int prefixLength)
Returns whether the values of this series contains a single prefix block for the given prefix length.boolean
equals(java.lang.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.IPAddressLargeDivision
getDivision(int index)
IPAddressNetwork<?,?,?,?,?>
getNetwork()
java.lang.Integer
getNetworkPrefixLength()
Returns the CIDR network prefix length of the series, or null if the series has no associated prefix length.java.lang.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.java.lang.Integer
getPrefixLengthForSingleBlock()
Returns a prefix length for which the range of this segment grouping matches the block of addresses for that prefix.-
Methods inherited from class inet.ipaddr.format.AddressDivisionGroupingBase
getBytes, getBytes, getBytes, getCount, getDivisionCount, getDivisionStrings, getMinPrefixLengthForBlock, getPrefixCount, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, hashCode, includesMax, includesZero, isFullRange, isMax, isMultiple, isPrefixBlock, isPrefixed, isSequential, isSinglePrefixBlock, isZero, toString
-
Methods inherited from interface inet.ipaddr.format.AddressDivisionSeries
getBitCount, getBlockCount, getCount, getDivisionStrings, getPrefixCount, getPrefixCount, getSequentialBlockIndex, isMore, isPrefixBlock, isPrefixed, isSequential, isSinglePrefixBlock
-
Methods inherited from interface inet.ipaddr.format.AddressItem
compareTo, getByteCount, getBytes, getBytes, getBytes, getMinPrefixLengthForBlock, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, includesMax, includesZero, isFullRange, isMax, isMultiple, isZero
-
Methods inherited from interface inet.ipaddr.format.string.AddressStringDivisionSeries
getDivisionCount
-
Methods inherited from interface inet.ipaddr.format.string.IPAddressStringDivisionSeries
isPrefixBlock, isPrefixed
-
-
-
-
Constructor Detail
-
IPAddressLargeDivisionGrouping
public IPAddressLargeDivisionGrouping(IPAddressLargeDivision[] divisions, IPAddressNetwork<?,?,?,?,?> network)
-
-
Method Detail
-
getNetwork
public IPAddressNetwork<?,?,?,?,?> getNetwork()
- Specified by:
getNetwork
in interfaceIPAddressStringDivisionSeries
-
getDivision
public IPAddressLargeDivision getDivision(int index)
- Specified by:
getDivision
in interfaceAddressDivisionSeries
- Specified by:
getDivision
in interfaceAddressStringDivisionSeries
- Specified by:
getDivision
in interfaceIPAddressDivisionSeries
- Specified by:
getDivision
in interfaceIPAddressStringDivisionSeries
- Overrides:
getDivision
in classAddressDivisionGroupingBase
- Returns:
- the given division in this series. The first is at index 0.
-
containsPrefixBlock
public boolean containsPrefixBlock(int prefixLength)
Description copied from interface:AddressItem
Returns whether the values of this series contains the prefix block for the given prefix length.Use
AddressItem.getMinPrefixLengthForBlock()
to determine the smallest prefix length for which this method returns true.- Specified by:
containsPrefixBlock
in interfaceAddressItem
- Returns:
-
containsSinglePrefixBlock
public boolean containsSinglePrefixBlock(int prefixLength) throws PrefixLenException
Description copied from interface:AddressItem
Returns whether the values of this series contains a single prefix block for the given prefix length.Use
AddressItem.getPrefixLengthForSingleBlock()
to determine whether there is a prefix length for which this method returns true.- Specified by:
containsSinglePrefixBlock
in interfaceAddressItem
- Returns:
- Throws:
PrefixLenException
- if prefixLength exceeds the bit count or is negative
-
getPrefixLengthForSingleBlock
public java.lang.Integer getPrefixLengthForSingleBlock()
Description copied from class:AddressDivisionGroupingBase
Returns a prefix length for which the range of this segment grouping matches the block of addresses for that prefix. If no such prefix exists, returns null If this segment grouping represents a single value, returns the bit length- Specified by:
getPrefixLengthForSingleBlock
in interfaceAddressItem
- Overrides:
getPrefixLengthForSingleBlock
in classAddressDivisionGroupingBase
- Returns:
- the prefix length or null
-
getPrefixLength
public java.lang.Integer getPrefixLength()
Description copied from interface:AddressDivisionSeries
The bit-length of the portion of the address that is not specific to an individual address but common amongst a group of addresses.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()
andAddressItem.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.
- Specified by:
getPrefixLength
in interfaceAddressDivisionSeries
- Specified by:
getPrefixLength
in interfaceIPAddressStringDivisionSeries
- Overrides:
getPrefixLength
in classAddressDivisionGroupingBase
- Returns:
- the prefix length or null if there is none
-
getNetworkPrefixLength
public java.lang.Integer getNetworkPrefixLength()
Description copied from interface:IPAddressDivisionSeries
Returns the CIDR network prefix length of the series, or null if the series has no associated prefix length.Equivalent to
AddressDivisionSeries.getPrefixLength()
, which is the more general concept of set of address series that share the same set of leading bits. For IP addresses and sections the prefix length and the CIDR network prefix length are the same thing.For IP addresses and sections each individual segment has an associated prefix length which is determine by the network prefix length. The segment prefix lengths follow the pattern: null, null, ...., null, x, 0, 0, ..., 0
For instance, an IPv4 address 1.2.3.4/16 has the network prefix length 16. The segment prefix lengths are [null, 8, 0, 0] The segment prefix lengths of 1.2.3.4/22 are [null, null, 6, 0]
- Specified by:
getNetworkPrefixLength
in interfaceIPAddressDivisionSeries
- Returns:
-
equals
public boolean equals(java.lang.Object o)
Description copied from class:AddressDivisionGroupingBase
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.- Overrides:
equals
in classAddressDivisionGroupingBase
-
-