public class IPAddressSegmentGrouping extends java.lang.Object implements IPAddressPart, java.lang.Comparable<IPAddressSegmentGrouping>
With the IPAddressSection subclass, each division is one segment (eg either groupings of 4 like 1.2.3.4 or groupings of 8 like 1:2:3:4:5:6:7:8). For IPv6, a compressed segment still counts as one of the groupings, it is simply not printed as part of the text representation. Alternative groupings include ipv4 groupings define by inet_aton (eg groupings of 1, 2, or 3 divisions like 1, 1.2, and 1.2.3) and the mixed ipv6/ipv4 representation of ipv6 addresses (eg a grouping of 10 divisions like a:b:c:d:e:f:1.2.3.4) IPAddressSegmentGrouping objects are immutable. Some of the derived state is created upon demand and cached. This also makes them thread-safe.
Modifier and Type | Class and Description |
---|---|
static class |
IPAddressSegmentGrouping.Range |
static class |
IPAddressSegmentGrouping.RangeList |
Constructor and Description |
---|
IPAddressSegmentGrouping(IPAddressDivision[] divisions) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(IPAddressSegmentGrouping other) |
boolean |
equals(java.lang.Object o) |
int |
getBitCount() |
int |
getByteCount() |
java.math.BigInteger |
getCount()
gets the count of addresses that this address may represent
If this address is not a CIDR and it has no range, then there is only one such address.
|
IPAddressDivision |
getDivision(int index) |
int |
getDivisionCount() |
java.lang.Integer |
getNetworkPrefixLength()
Returns the network prefix, which is 16 for an address like 1.2.0.0/16
If there is no prefix length, returns null.
|
IPAddressSegmentGrouping.RangeList |
getZeroRangeSegments() |
IPAddressSegmentGrouping.RangeList |
getZeroSegments() |
int |
hashCode() |
boolean |
isMultiple()
whether this is a pat of more than one address.
|
boolean |
isMultipleByNetworkPrefix() |
boolean |
isPrefixed() |
boolean |
isRangeEquivalentToPrefix() |
boolean |
isZero() |
java.lang.String |
toString() |
getPrefixStringLength
public IPAddressSegmentGrouping(IPAddressDivision[] divisions)
public IPAddressDivision getDivision(int index)
getDivision
in interface IPAddressPart
public int getDivisionCount()
getDivisionCount
in interface IPAddressPart
public int getByteCount()
getByteCount
in interface IPAddressPart
public int getBitCount()
public boolean isPrefixed()
public java.lang.Integer getNetworkPrefixLength()
IPAddressPart
getNetworkPrefixLength
in interface IPAddressPart
public java.math.BigInteger getCount()
public boolean isMultiple()
IPAddressPart
isMultiple
in interface IPAddressPart
public boolean isMultipleByNetworkPrefix()
public boolean isRangeEquivalentToPrefix()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int compareTo(IPAddressSegmentGrouping other)
compareTo
in interface java.lang.Comparable<IPAddressSegmentGrouping>
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isZero()
public IPAddressSegmentGrouping.RangeList getZeroSegments()
public IPAddressSegmentGrouping.RangeList getZeroRangeSegments()