public class AddressDivisionGrouping extends java.lang.Object implements AddressDivisionSeries, java.lang.Comparable<AddressDivisionGrouping>
AddressDivisionGrouping objects are immutable. This also makes them thread-safe.
| Modifier and Type | Class and Description |
|---|---|
static class |
AddressDivisionGrouping.StringOptions
Represents a clear way to create a specific type of string.
|
| Constructor and Description |
|---|
AddressDivisionGrouping(AddressDivision[] divisions) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(AddressDivisionGrouping other) |
boolean |
equals(java.lang.Object o) |
int |
getBitCount() |
byte[] |
getBytes()
Gets the bytes for the lowest address in the range represented by this address.
|
byte[] |
getBytes(byte[] bytes)
Gets the value for the lowest address in the range represented by this address division.
|
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.
|
AddressDivision |
getDivision(int index) |
int |
getDivisionCount() |
java.lang.Integer |
getEquivalentPrefix()
Returns a prefix length for which the range of this segment grouping can be specified only using the section's lower value and the prefix length
If no such prefix exists, returns null
If this segment grouping represents a single value, returns the bit length
|
int |
getMinPrefix()
Returns the smallest prefix length possible
such that this address paired with that prefix length represents the exact same range of addresses.
|
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.
|
byte[] |
getUpperBytes()
Gets the bytes for the highest address in the range represented by this address.
|
byte[] |
getUpperBytes(byte[] bytes)
Copies the bytes of the largest address item represented by this address item into the supplied array,
and returns that array.
|
int |
hashCode() |
boolean |
isFullRange() |
int |
isMore(AddressDivisionSeries other)
Use this method to compare the counts of two address series.
|
boolean |
isMultiple()
Whether this represents multiple potential values (eg a prefixed address or a segment representing a range of values)
|
boolean |
isMultipleByPrefix()
whether there is a prefix and it is less than the bit-count
|
boolean |
isPrefixed()
Whether there exists a prefix.
|
boolean |
isRangeEquivalent(int prefix) |
boolean |
isRangeEquivalentToPrefix()
whether there is a prefix and the range of values is dictated entirely by the prefix.
|
boolean |
isZero() |
java.lang.String |
toString() |
public AddressDivisionGrouping(AddressDivision[] divisions)
public AddressDivision getDivision(int index)
getDivision in interface AddressDivisionSeriesgetDivision in interface AddressStringDivisionSeriespublic int getDivisionCount()
getDivisionCount in interface AddressStringDivisionSeriespublic int getBitCount()
getBitCount in interface AddressItempublic byte[] getBytes()
getBytes in interface AddressItempublic byte[] getBytes(byte[] bytes)
getBitCount() to determine the required array length for the bytes.
Since bytes are signed values while addresses are unsigned, values greater than 127 are
represented as the (negative) two's complement value of the actual value.
You can get the unsigned integer value i from byte b using i = 0xff & b.getBytes in interface AddressItempublic byte[] getUpperBytes()
getUpperBytes in interface AddressItempublic byte[] getUpperBytes(byte[] bytes)
AddressItemgetUpperBytes in interface AddressItempublic boolean isPrefixed()
AddressDivisionSeriesisPrefixed in interface AddressDivisionSeriespublic java.lang.Integer getPrefixLength()
AddressDivisionSeriesgetPrefixLength in interface AddressDivisionSeriespublic int getMinPrefix()
getMinPrefix in interface AddressDivisionSeriespublic java.lang.Integer getEquivalentPrefix()
getEquivalentPrefix in interface AddressDivisionSeriespublic java.math.BigInteger getCount()
getCount in interface AddressItempublic int isMore(AddressDivisionSeries other)
AddressDivisionSeriesisMore in interface AddressDivisionSeriespublic boolean isMultiple()
AddressItemisMultiple in interface AddressItempublic boolean isMultipleByPrefix()
AddressDivisionSeriesisMultipleByPrefix in interface AddressDivisionSeriespublic boolean isRangeEquivalentToPrefix()
AddressDivisionSeriesisRangeEquivalentToPrefix in interface AddressDivisionSeriespublic boolean isRangeEquivalent(int prefix)
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int compareTo(AddressDivisionGrouping other)
compareTo in interface java.lang.Comparable<AddressDivisionGrouping>public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isZero()
isZero in interface AddressItempublic boolean isFullRange()
isFullRange in interface AddressItem