Module inet.ipaddr

Interface IPAddressRange

    • Method Detail

      • contains

        boolean contains​(IPAddressSeqRange other)
        Returns whether this range contains all addresses in the given sequential range
        Parameters:
        other -
        Returns:
      • contains

        boolean contains​(IPAddress other)
        Returns whether this range contains all addresses in the given address or subnet
        Parameters:
        other -
        Returns:
      • overlaps

        boolean overlaps​(IPAddressSeqRange other)
        Returns whether this range overlaps the given sequential range
        Parameters:
        other -
        Returns:
      • overlaps

        boolean overlaps​(IPAddress other)
        Returns whether this range overlaps the addresses in the given address or subnet
        Parameters:
        other -
        Returns:
      • enumerate

        java.math.BigInteger enumerate​(IPAddress other)
        Indicates where an address sits relative to the range ordering.

        Determines how many address elements of a range precede the given address element, if the address is in the range. If above the range, it is the distance to the upper boundary added to the range count less one, and if below the range, the distance to the lower boundary.

        In other words, if the given address is not in the range but above it, returns the number of addresses preceding the address from the upper range boundary, added to one less than the total number of range addresses. If the given address is not in the subnet but below it, returns the number of addresses following the address to the lower subnet boundary.

        Returns null when the argument is multi-valued. The argument must be an individual address.

        When this is also an individual address, the returned value is the distance (difference) between the two address values.

        If the given address does not have the same version or type, then null is returned.

        Parameters:
        other -
        Returns:
      • getIterable

        java.lang.Iterable<? extends IPAddress> getIterable()
        Useful for using an instance in a "for-each loop", as in for(addr : address.getIterable()) { ... }

        Otherwise just call iterator() directly.

        Specified by:
        getIterable in interface AddressComponentRange
        Returns:
      • prefixBlockIterator

        java.util.Iterator<? extends IPAddress> prefixBlockIterator​(int prefLength)
        Iterates through the range of prefix blocks in this range instance using the given prefix length.
        Parameters:
        prefLength -
        Returns:
      • prefixBlockStream

        java.util.stream.Stream<? extends IPAddress> prefixBlockStream​(int prefLength)
        Returns a sequential stream of the prefix blocks for the given prefix length. For a parallel stream, call BaseStream.parallel() on the returned stream.
        Returns:
      • prefixIterator

        java.util.Iterator<? extends IPAddressRange> prefixIterator​(int prefixLength)
        Iterates through the range of prefixes in this range instance using the given prefix length.
        Parameters:
        prefixLength -
        Returns:
      • prefixSpliterator

        AddressComponentSpliterator<? extends IPAddressRange> prefixSpliterator​(int prefLength)
        Partitions and traverses through the individual prefixes for the given prefix length.
        Returns:
      • prefixStream

        java.util.stream.Stream<? extends IPAddressRange> prefixStream​(int prefLength)
        Returns a sequential stream of the individual prefixes for the given prefix length. For a parallel stream, call BaseStream.parallel() on the returned stream.
        Returns:
      • coverWithPrefixBlock

        IPAddress coverWithPrefixBlock()
        Returns the minimal-size prefix block that covers all the addresses in this range. The resulting block will have a larger address count than this range, unless this range is already a prefix block.
      • spanWithPrefixBlocks

        IPAddress[] spanWithPrefixBlocks()
        Produces an array of prefix blocks that spans the same set of addresses.
      • spanWithSequentialBlocks

        IPAddress[] spanWithSequentialBlocks()
        Produces an array of blocks that are sequential that cover the same set of addresses. This array can be shorter than that produced by spanWithPrefixBlocks() and is never longer.
      • isSequential

        boolean isSequential()
        Returns whether this range represents a range of values that are sequential.
        Returns:
      • toSequentialRange

        IPAddressSeqRange toSequentialRange()
        Converts to a sequential range from the lowest and highest addresses in this range, returns "this" if one already

        The result will represent the same set of addresses if and only if isSequential() is true

      • toNormalizedString

        java.lang.String toNormalizedString()
        Produces a string that is unique and consistent for all instances.
        Returns:
      • toCanonicalString

        java.lang.String toCanonicalString()
        Produces a string that is unique and uses the canonical representation for all instances.
        Returns: