Class Container

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String[] ContainerNames
      Name of the various possible containers
    • Constructor Summary

      Constructors 
      Constructor Description
      Container()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract Container add​(char x)
      Add a short to the container.
      abstract Container add​(int begin, int end)
      Return a new container with all shorts in [begin,end) added using an unsigned interpretation.
      abstract Container and​(ArrayContainer x)
      Computes the bitwise AND of this container with another (intersection).
      abstract Container and​(BitmapContainer x)
      Computes the bitwise AND of this container with another (intersection).
      Container and​(Container x)
      Computes the bitwise AND of this container with another (intersection).
      abstract Container and​(RunContainer x)
      Computes the bitwise AND of this container with another (intersection).
      protected abstract int andCardinality​(ArrayContainer x)  
      protected abstract int andCardinality​(BitmapContainer x)  
      int andCardinality​(Container x)
      Computes the bitwise AND of this container with another (intersection).
      protected abstract int andCardinality​(RunContainer x)  
      abstract Container andNot​(ArrayContainer x)
      Computes the bitwise ANDNOT of this container with another (difference).
      abstract Container andNot​(BitmapContainer x)
      Computes the bitwise ANDNOT of this container with another (difference).
      Container andNot​(Container x)
      Computes the bitwise ANDNOT of this container with another (difference).
      abstract Container andNot​(RunContainer x)
      Computes the bitwise ANDNOT of this container with another (difference).
      protected void assertNonEmpty​(boolean condition)
      Throw if the container is empty
      abstract void clear()
      Empties the container
      abstract Container clone()  
      abstract boolean contains​(char x)
      Checks whether the contain contains the provided value
      abstract boolean contains​(int minimum, int supremum)
      Checks whether the container contains the entire range
      protected abstract boolean contains​(ArrayContainer arrayContainer)  
      protected abstract boolean contains​(BitmapContainer bitmapContainer)  
      boolean contains​(Container subset)
      Checks whether the container is a subset of this container or not
      protected abstract boolean contains​(RunContainer runContainer)  
      abstract void deserialize​(java.io.DataInput in)
      Deserialize (recover) the container.
      abstract void fillLeastSignificant16bits​(int[] x, int i, int mask)
      Fill the least significant 16 bits of the integer array, starting at index i, with the short values from this container.
      abstract int first()
      Get the first integer held in the container
      abstract Container flip​(char x)
      Add a short to the container if it is not present, otherwise remove it.
      abstract void forEach​(char msb, IntConsumer ic)
      Iterate through the values of this container and pass them along to the IntConsumer, using msb as the 16 most significant bits.
      abstract int getArraySizeInBytes()
      Size of the underlying array
      abstract ContainerBatchIterator getBatchIterator()
      Gets an iterator to visit the contents of the container in batches
      abstract int getCardinality()
      Computes the distinct number of char values in the container.
      abstract PeekableCharIterator getCharIterator()
      Iterator to visit the char values in the container in ascending order.
      abstract PeekableCharRankIterator getCharRankIterator()
      Iterator to visit the short values in container and pre-compute ranks
      java.lang.String getContainerName()
      Get the name of this container.
      abstract PeekableCharIterator getReverseCharIterator()
      Iterator to visit the char values in the container in descending order.
      abstract int getSizeInBytes()
      Computes an estimate of the memory usage of this container.
      abstract Container iadd​(int begin, int end)
      Add all shorts in [begin,end) using an unsigned interpretation.
      abstract Container iand​(ArrayContainer x)
      Computes the in-place bitwise AND of this container with another (intersection).
      abstract Container iand​(BitmapContainer x)
      Computes the in-place bitwise AND of this container with another (intersection).
      Container iand​(Container x)
      Computes the in-place bitwise AND of this container with another (intersection).
      abstract Container iand​(RunContainer x)
      Computes the in-place bitwise AND of this container with another (intersection).
      abstract Container iandNot​(ArrayContainer x)
      Computes the in-place bitwise ANDNOT of this container with another (difference).
      abstract Container iandNot​(BitmapContainer x)
      Computes the in-place bitwise ANDNOT of this container with another (difference).
      Container iandNot​(Container x)
      Computes the in-place bitwise ANDNOT of this container with another (difference).
      abstract Container iandNot​(RunContainer x)
      Computes the in-place bitwise ANDNOT of this container with another (difference).
      abstract Container inot​(int rangeStart, int rangeEnd)
      Computes the in-place bitwise NOT of this container (complement).
      abstract boolean intersects​(int minimum, int supremum)
      Checks if the container intersects with a range
      abstract boolean intersects​(ArrayContainer x)
      Returns true if the current container intersects the other container.
      abstract boolean intersects​(BitmapContainer x)
      Returns true if the current container intersects the other container.
      boolean intersects​(Container x)
      Returns true if the current container intersects the other container.
      abstract boolean intersects​(RunContainer x)
      Returns true if the current container intersects the other container.
      abstract Container ior​(ArrayContainer x)
      Computes the in-place bitwise OR of this container with another (union).
      abstract Container ior​(BitmapContainer x)
      Computes the in-place bitwise OR of this container with another (union).
      Container ior​(Container x)
      Computes the in-place bitwise OR of this container with another (union).
      abstract Container ior​(RunContainer x)
      Computes the in-place bitwise OR of this container with another (union).
      Container iorNot​(Container x, int endOfRange)
      Computes the in-place bitwise ORNOT of this container with another.
      abstract Container iremove​(int begin, int end)
      Remove shorts in [begin,end) using an unsigned interpretation.
      abstract boolean isEmpty()
      Checks whether the container is empty or not.
      abstract boolean isFull()
      Checks whether the container is full or not.
      abstract Container ixor​(ArrayContainer x)
      Computes the in-place bitwise XOR of this container with another (symmetric difference).
      abstract Container ixor​(BitmapContainer x)
      Computes the in-place bitwise XOR of this container with another (symmetric difference).
      Container ixor​(Container x)
      Computes the in-place bitwise OR of this container with another (union).
      abstract Container ixor​(RunContainer x)
      Computes the in-place bitwise XOR of this container with another (symmetric difference).
      abstract int last()
      Get the last integer held in the container
      Container lazyIOR​(Container x)
      Computes the in-place bitwise OR of this container with another (union).
      Container lazyOR​(Container x)
      Computes the bitwise OR of this container with another (union).
      abstract Container limit​(int maxcardinality)
      Create a new Container containing at most maxcardinality integers.
      abstract int nextAbsentValue​(char fromValue)
      Gets the first absent value greater than or equal to the lower bound.
      abstract int nextValue​(char fromValue)
      Gets the first value greater than or equal to the lower bound, or -1 if no such value exists.
      abstract Container not​(int rangeStart, int rangeEnd)
      Computes the bitwise NOT of this container (complement).
      abstract Container or​(ArrayContainer x)
      Computes the bitwise OR of this container with another (union).
      abstract Container or​(BitmapContainer x)
      Computes the bitwise OR of this container with another (union).
      Container or​(Container x)
      Computes the bitwise OR of this container with another (union).
      abstract Container or​(RunContainer x)
      Computes the bitwise OR of this container with another (union).
      Container orNot​(Container x, int endOfRange)
      Computes the bitwise ORNOT of this container with another.
      abstract int previousAbsentValue​(char fromValue)
      Gets the last value less than or equal to the upper bound.
      abstract int previousValue​(char fromValue)
      Gets the last value less than or equal to the upper bound, or -1 if no such value exists.
      static Container rangeOfOnes​(int start, int last)
      Create a container initialized with a range of consecutive values
      abstract int rank​(char lowbits)
      Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).
      abstract Container remove​(char x)
      Remove the char from this container.
      abstract Container remove​(int begin, int end)
      Return a new container with all chars in [begin,end) remove using an unsigned interpretation.
      abstract Container repairAfterLazy()
      The output of a lazyOR or lazyIOR might be an invalid container, this should be called on it.
      abstract Container runOptimize()
      Convert to RunContainers, when the result is smaller.
      abstract char select​(int j)
      Return the jth value
      abstract void serialize​(java.io.DataOutput out)
      Serialize the container.
      abstract int serializedSizeInBytes()
      Report the number of bytes required to serialize this container.
      abstract BitmapContainer toBitmapContainer()
      Convert the current container to a BitmapContainer, if a conversion is needed.
      abstract MappeableContainer toMappeableContainer()
      Convert to a mappeable container.
      abstract void trim()
      If possible, recover wasted memory.
      abstract void writeArray​(java.io.DataOutput out)
      Write just the underlying array.
      abstract void writeArray​(java.nio.ByteBuffer buffer)
      Write just the underlying array.
      abstract Container xor​(ArrayContainer x)
      Computes the bitwise XOR of this container with another (symmetric difference).
      abstract Container xor​(BitmapContainer x)
      Computes the bitwise XOR of this container with another (symmetric difference).
      Container xor​(Container x)
      Computes the bitwise OR of this container with another (symmetric difference).
      abstract Container xor​(RunContainer x)
      Computes the bitwise XOR of this container with another (symmetric difference).
      int xorCardinality​(Container other)
      Returns the cardinality of the XOR between the passed container and this container without materialising a temporary container.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.io.Externalizable

        readExternal, writeExternal
      • Methods inherited from interface java.lang.Iterable

        forEach, iterator, spliterator
    • Field Detail

      • ContainerNames

        public static final java.lang.String[] ContainerNames
        Name of the various possible containers
    • Constructor Detail

      • Container

        public Container()
    • Method Detail

      • rangeOfOnes

        public static Container rangeOfOnes​(int start,
                                            int last)
        Create a container initialized with a range of consecutive values
        Parameters:
        start - first index
        last - last index (range is exclusive)
        Returns:
        a new container initialized with the specified values
      • add

        public abstract Container add​(int begin,
                                      int end)
        Return a new container with all shorts in [begin,end) added using an unsigned interpretation.
        Parameters:
        begin - start of range (inclusive)
        end - end of range (exclusive)
        Returns:
        the new container
      • add

        public abstract Container add​(char x)
        Add a short to the container. May generate a new container.
        Specified by:
        add in interface WordStorage<Container>
        Parameters:
        x - short to be added
        Returns:
        the new container
      • and

        public abstract Container and​(ArrayContainer x)
        Computes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • and

        public abstract Container and​(BitmapContainer x)
        Computes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • and

        public Container and​(Container x)
        Computes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • and

        public abstract Container and​(RunContainer x)
        Computes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • andCardinality

        protected abstract int andCardinality​(ArrayContainer x)
      • andCardinality

        protected abstract int andCardinality​(BitmapContainer x)
      • andCardinality

        protected abstract int andCardinality​(RunContainer x)
      • andCardinality

        public int andCardinality​(Container x)
        Computes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • xorCardinality

        public int xorCardinality​(Container other)
        Returns the cardinality of the XOR between the passed container and this container without materialising a temporary container.
        Parameters:
        other - other container
        Returns:
        the cardinality of the symmetric difference of the two containers
      • andNot

        public abstract Container andNot​(ArrayContainer x)
        Computes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • andNot

        public abstract Container andNot​(BitmapContainer x)
        Computes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • andNot

        public Container andNot​(Container x)
        Computes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • andNot

        public abstract Container andNot​(RunContainer x)
        Computes the bitwise ANDNOT of this container with another (difference). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • orNot

        public Container orNot​(Container x,
                               int endOfRange)
        Computes the bitwise ORNOT of this container with another. This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        endOfRange - end of range (size of the universe)
        Returns:
        aggregated container
      • clear

        public abstract void clear()
        Empties the container
      • clone

        public abstract Container clone()
        Overrides:
        clone in class java.lang.Object
      • isEmpty

        public abstract boolean isEmpty()
        Checks whether the container is empty or not.
        Specified by:
        isEmpty in interface WordStorage<Container>
        Returns:
        true if the container is empty.
      • isFull

        public abstract boolean isFull()
        Checks whether the container is full or not.
        Returns:
        true if the container is full.
      • contains

        public abstract boolean contains​(char x)
        Checks whether the contain contains the provided value
        Parameters:
        x - value to check
        Returns:
        whether the value is in the container
      • contains

        public abstract boolean contains​(int minimum,
                                         int supremum)
        Checks whether the container contains the entire range
        Parameters:
        minimum - the inclusive lower bound of the range
        supremum - the exclusive upper bound of the range
        Returns:
        true if the container contains the range
      • contains

        public boolean contains​(Container subset)
        Checks whether the container is a subset of this container or not
        Parameters:
        subset - the container to be tested
        Returns:
        true if the parameter is a subset of this container
      • contains

        protected abstract boolean contains​(RunContainer runContainer)
      • contains

        protected abstract boolean contains​(ArrayContainer arrayContainer)
      • contains

        protected abstract boolean contains​(BitmapContainer bitmapContainer)
      • deserialize

        public abstract void deserialize​(java.io.DataInput in)
                                  throws java.io.IOException
        Deserialize (recover) the container.
        Parameters:
        in - the DataInput stream
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • fillLeastSignificant16bits

        public abstract void fillLeastSignificant16bits​(int[] x,
                                                        int i,
                                                        int mask)
        Fill the least significant 16 bits of the integer array, starting at index i, with the short values from this container. The caller is responsible to allocate enough room. The most significant 16 bits of each integer are given by the most significant bits of the provided mask.
        Parameters:
        x - provided array
        i - starting index
        mask - indicates most significant bits
      • flip

        public abstract Container flip​(char x)
        Add a short to the container if it is not present, otherwise remove it. May generate a new container.
        Parameters:
        x - short to be added
        Returns:
        the new container
      • getArraySizeInBytes

        public abstract int getArraySizeInBytes()
        Size of the underlying array
        Returns:
        size in bytes
      • getCardinality

        public abstract int getCardinality()
        Computes the distinct number of char values in the container. Can be expected to run in constant time.
        Returns:
        the cardinality
      • getContainerName

        public java.lang.String getContainerName()
        Get the name of this container.
        Returns:
        name of the container
      • forEach

        public abstract void forEach​(char msb,
                                     IntConsumer ic)
        Iterate through the values of this container and pass them along to the IntConsumer, using msb as the 16 most significant bits.
        Parameters:
        msb - 16 most significant bits
        ic - consumer
      • getReverseCharIterator

        public abstract PeekableCharIterator getReverseCharIterator()
        Iterator to visit the char values in the container in descending order.
        Returns:
        iterator
      • getCharIterator

        public abstract PeekableCharIterator getCharIterator()
        Iterator to visit the char values in the container in ascending order.
        Returns:
        iterator
      • getCharRankIterator

        public abstract PeekableCharRankIterator getCharRankIterator()
        Iterator to visit the short values in container and pre-compute ranks
        Returns:
        iterator
      • getBatchIterator

        public abstract ContainerBatchIterator getBatchIterator()
        Gets an iterator to visit the contents of the container in batches
        Returns:
        iterator
      • getSizeInBytes

        public abstract int getSizeInBytes()
        Computes an estimate of the memory usage of this container. The estimate is not meant to be exact.
        Returns:
        estimated memory usage in bytes
      • iadd

        public abstract Container iadd​(int begin,
                                       int end)
        Add all shorts in [begin,end) using an unsigned interpretation. May generate a new container.
        Parameters:
        begin - start of range (inclusive)
        end - end of range (exclusive)
        Returns:
        the new container
      • iand

        public abstract Container iand​(ArrayContainer x)
        Computes the in-place bitwise AND of this container with another (intersection). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • iand

        public abstract Container iand​(BitmapContainer x)
        Computes the in-place bitwise AND of this container with another (intersection). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • iand

        public Container iand​(Container x)
        Computes the in-place bitwise AND of this container with another (intersection). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • iand

        public abstract Container iand​(RunContainer x)
        Computes the in-place bitwise AND of this container with another (intersection). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • iandNot

        public abstract Container iandNot​(ArrayContainer x)
        Computes the in-place bitwise ANDNOT of this container with another (difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • iandNot

        public abstract Container iandNot​(BitmapContainer x)
        Computes the in-place bitwise ANDNOT of this container with another (difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • iandNot

        public Container iandNot​(Container x)
        Computes the in-place bitwise ANDNOT of this container with another (difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • iandNot

        public abstract Container iandNot​(RunContainer x)
        Computes the in-place bitwise ANDNOT of this container with another (difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • iorNot

        public Container iorNot​(Container x,
                                int endOfRange)
        Computes the in-place bitwise ORNOT of this container with another. The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        endOfRange - the exclusive end
        Returns:
        aggregated container
      • inot

        public abstract Container inot​(int rangeStart,
                                       int rangeEnd)
        Computes the in-place bitwise NOT of this container (complement). Only those bits within the range are affected. The current container is generally modified. May generate a new container.
        Parameters:
        rangeStart - beginning of range (inclusive); 0 is beginning of this container.
        rangeEnd - ending of range (exclusive)
        Returns:
        (partially) complemented container
      • intersects

        public abstract boolean intersects​(ArrayContainer x)
        Returns true if the current container intersects the other container.
        Parameters:
        x - other container
        Returns:
        whether they intersect
      • intersects

        public abstract boolean intersects​(BitmapContainer x)
        Returns true if the current container intersects the other container.
        Parameters:
        x - other container
        Returns:
        whether they intersect
      • intersects

        public boolean intersects​(Container x)
        Returns true if the current container intersects the other container.
        Parameters:
        x - other container
        Returns:
        whether they intersect
      • intersects

        public abstract boolean intersects​(RunContainer x)
        Returns true if the current container intersects the other container.
        Parameters:
        x - other container
        Returns:
        whether they intersect
      • intersects

        public abstract boolean intersects​(int minimum,
                                           int supremum)
        Checks if the container intersects with a range
        Parameters:
        minimum - the inclusive unsigned lower bound of the range
        supremum - the exclusive unsigned upper bound of the range
        Returns:
        true if the container intersects the range
      • ior

        public abstract Container ior​(ArrayContainer x)
        Computes the in-place bitwise OR of this container with another (union). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • ior

        public abstract Container ior​(BitmapContainer x)
        Computes the in-place bitwise OR of this container with another (union). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • ior

        public Container ior​(Container x)
        Computes the in-place bitwise OR of this container with another (union). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • ior

        public abstract Container ior​(RunContainer x)
        Computes the in-place bitwise OR of this container with another (union). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • iremove

        public abstract Container iremove​(int begin,
                                          int end)
        Remove shorts in [begin,end) using an unsigned interpretation. May generate a new container.
        Parameters:
        begin - start of range (inclusive)
        end - end of range (exclusive)
        Returns:
        the new container
      • ixor

        public abstract Container ixor​(ArrayContainer x)
        Computes the in-place bitwise XOR of this container with another (symmetric difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • ixor

        public abstract Container ixor​(BitmapContainer x)
        Computes the in-place bitwise XOR of this container with another (symmetric difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • ixor

        public Container ixor​(Container x)
        Computes the in-place bitwise OR of this container with another (union). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • ixor

        public abstract Container ixor​(RunContainer x)
        Computes the in-place bitwise XOR of this container with another (symmetric difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • lazyIOR

        public Container lazyIOR​(Container x)
        Computes the in-place bitwise OR of this container with another (union). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container. The resulting container may not track its cardinality correctly. The resulting container may not track its cardinality correctly. This can be fixed as follows: if(c.getCardinality()<0) ((BitmapContainer)c).computeCardinality();
        Parameters:
        x - other container
        Returns:
        aggregated container
      • lazyOR

        public Container lazyOR​(Container x)
        Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected. The resulting container may not track its cardinality correctly. This can be fixed as follows: if(c.getCardinality()<0) ((BitmapContainer)c).computeCardinality();
        Parameters:
        x - other container
        Returns:
        aggregated container
      • limit

        public abstract Container limit​(int maxcardinality)
        Create a new Container containing at most maxcardinality integers.
        Parameters:
        maxcardinality - maximal cardinality
        Returns:
        a new bitmap with cardinality no more than maxcardinality
      • not

        public abstract Container not​(int rangeStart,
                                      int rangeEnd)
        Computes the bitwise NOT of this container (complement). Only those bits within the range are affected. The current container is left unaffected.
        Parameters:
        rangeStart - beginning of range (inclusive); 0 is beginning of this container.
        rangeEnd - ending of range (exclusive)
        Returns:
        (partially) complemented container
      • or

        public abstract Container or​(ArrayContainer x)
        Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • or

        public abstract Container or​(BitmapContainer x)
        Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • or

        public Container or​(Container x)
        Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • or

        public abstract Container or​(RunContainer x)
        Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • rank

        public abstract int rank​(char lowbits)
        Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).
        Parameters:
        lowbits - upper limit
        Returns:
        the rank
      • remove

        public abstract Container remove​(int begin,
                                         int end)
        Return a new container with all chars in [begin,end) remove using an unsigned interpretation.
        Parameters:
        begin - start of range (inclusive)
        end - end of range (exclusive)
        Returns:
        the new container
      • remove

        public abstract Container remove​(char x)
        Remove the char from this container. May create a new container.
        Parameters:
        x - to be removed
        Returns:
        New container
      • repairAfterLazy

        public abstract Container repairAfterLazy()
        The output of a lazyOR or lazyIOR might be an invalid container, this should be called on it.
        Returns:
        a new valid container
      • runOptimize

        public abstract Container runOptimize()
        Convert to RunContainers, when the result is smaller. Overridden by RunContainer to possibility switch from RunContainer to a smaller alternative. Overridden by BitmapContainer with a more efficient approach.
        Specified by:
        runOptimize in interface WordStorage<Container>
        Returns:
        the new container
      • select

        public abstract char select​(int j)
        Return the jth value
        Parameters:
        j - index of the value
        Returns:
        the value
      • serialize

        public abstract void serialize​(java.io.DataOutput out)
                                throws java.io.IOException
        Serialize the container.
        Parameters:
        out - the DataOutput stream
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • serializedSizeInBytes

        public abstract int serializedSizeInBytes()
        Report the number of bytes required to serialize this container.
        Returns:
        the size in bytes
      • toMappeableContainer

        public abstract MappeableContainer toMappeableContainer()
        Convert to a mappeable container.
        Returns:
        the mappeable container
      • trim

        public abstract void trim()
        If possible, recover wasted memory.
      • writeArray

        public abstract void writeArray​(java.io.DataOutput out)
                                 throws java.io.IOException
        Write just the underlying array.
        Parameters:
        out - output stream
        Throws:
        java.io.IOException - in case of failure
      • writeArray

        public abstract void writeArray​(java.nio.ByteBuffer buffer)
        Write just the underlying array.
        Parameters:
        buffer - ByteBuffer to write to
      • xor

        public abstract Container xor​(ArrayContainer x)
        Computes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • xor

        public abstract Container xor​(BitmapContainer x)
        Computes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • xor

        public Container xor​(Container x)
        Computes the bitwise OR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.
        Parameters:
        x - other parameter
        Returns:
        aggregated container
      • xor

        public abstract Container xor​(RunContainer x)
        Computes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.
        Parameters:
        x - other container
        Returns:
        aggregated container
      • toBitmapContainer

        public abstract BitmapContainer toBitmapContainer()
        Convert the current container to a BitmapContainer, if a conversion is needed. If the container is already a bitmap, the container is returned unchanged.
        Returns:
        a bitmap container
      • nextValue

        public abstract int nextValue​(char fromValue)
        Gets the first value greater than or equal to the lower bound, or -1 if no such value exists.
        Parameters:
        fromValue - the lower bound (inclusive)
        Returns:
        the next value
      • previousValue

        public abstract int previousValue​(char fromValue)
        Gets the last value less than or equal to the upper bound, or -1 if no such value exists.
        Parameters:
        fromValue - the upper bound (inclusive)
        Returns:
        the previous value
      • nextAbsentValue

        public abstract int nextAbsentValue​(char fromValue)
        Gets the first absent value greater than or equal to the lower bound.
        Parameters:
        fromValue - the lower bound (inclusive)
        Returns:
        the next absent value
      • previousAbsentValue

        public abstract int previousAbsentValue​(char fromValue)
        Gets the last value less than or equal to the upper bound.
        Parameters:
        fromValue - the upper bound (inclusive)
        Returns:
        the previous absent value
      • first

        public abstract int first()
        Get the first integer held in the container
        Returns:
        the first integer in the container
        Throws:
        java.util.NoSuchElementException - if empty
      • last

        public abstract int last()
        Get the last integer held in the container
        Returns:
        the last integer in the container
        Throws:
        java.util.NoSuchElementException - if empty
      • assertNonEmpty

        protected void assertNonEmpty​(boolean condition)
        Throw if the container is empty
        Parameters:
        condition - a boolean expression
        Throws:
        java.util.NoSuchElementException - if empty