Module inet.ipaddr

Interface AddressDivisionSeries

    • Method Detail

      • isMore

        default int isMore​(AddressDivisionSeries other)
        Use this method to compare the counts of two address series. Rather than calculating counts with getCount(), there can be more efficient ways of comparing whether one series represents more individual address series than another.
        Returns:
        a positive integer if this AddressDivisionSeries has a larger count than the provided, 0 if they are the same, a negative integer if the other has a larger count.
      • getDivisionStrings

        java.lang.String[] getDivisionStrings()
        Get standard-format strings for each of the divisions in the series.
        Returns:
      • getPrefixLength

        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.

        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.

      • isPrefixed

        boolean isPrefixed()
        Whether there exists a prefix length associated with this series.
      • isPrefixBlock

        boolean isPrefixBlock()
        Returns whether this address segment series represents a block of addresses associated with its prefix length.

        This returns false if it has no prefix length or if it is a range of addresses that does not include the entire subnet block for the prefix length.

        If AddressNetwork.getPrefixConfiguration() is set to consider all prefixes as subnets, this returns true for any series with a prefix length.

        An important distinction of AddressItem.containsPrefixBlock(int) with this method is that this method returns false if the series does not have a prefix length assigned to it, even if there exists one or more prefix lengths for which AddressItem.containsPrefixBlock(int) returns true.

        Returns:
      • isSinglePrefixBlock

        boolean isSinglePrefixBlock()
        Returns whether the range of values matches a single subnet block for the prefix length

        An important distinction of this method with AddressItem.containsSinglePrefixBlock(int) is that this method returns false if the series does not have a prefix length assigned to it, even if there exists a prefix length for which AddressItem.containsSinglePrefixBlock(int) returns true.

        Returns:
      • getPrefixCount

        default java.math.BigInteger getPrefixCount()
        If this has a prefix length, the count of the range of values in the prefix.

        If this has no prefix length, returns the same value as getCount()

        Returns:
      • getPrefixCount

        default java.math.BigInteger getPrefixCount​(int prefixLength)
        Description copied from interface: AddressItem
        The count of the number of distinct values within the prefix part of the address item, the bits that appear within the prefix length.
        Specified by:
        getPrefixCount in interface AddressItem
        Returns:
      • getCount

        default java.math.BigInteger getCount()
        Description copied from interface: AddressItem
        The count of possible distinct values for this AddressComponent. If not multiple, this is 1. Note that an AddressDivisionSeries with no divisions or AddressSection with no segments has a single value of 0. For instance, if this is the ip address series subnet 0::/64, then the count is 2 to the power of 64. If this is a the segment 3-7, then the count is 5.
        Specified by:
        getCount in interface AddressItem
        Returns:
      • getBlockCount

        default java.math.BigInteger getBlockCount​(int divCount)
        Returns the count of values in the initial (higher) count of divisions.
        Returns:
      • getBitCount

        default int getBitCount()
        Description copied from interface: AddressItem
        Provides the number of bits comprising this address item
        Specified by:
        getBitCount in interface AddressItem
        Returns:
        the number of bits
      • isSequential

        default boolean isSequential()
        Returns whether the series represents a range of values that are sequential.

        Generally, this means that any division covering a range of values must be followed by divisions that are full range, covering all values.

        Returns:
      • getSequentialBlockIndex

        default int getSequentialBlockIndex()
        Gets the minimal segment index for which all following segments are full-range blocks.

        The segment at this index is not a full-range block unless all segments are full-range. The segment at this index and all following segments form a sequential range. For the full series to be sequential, the preceding segments must be single-valued.

        Returns: