Class MutableSharedBitVectorIntSet

  • All Implemented Interfaces:
    IntSet, MutableIntSet, java.io.Serializable

    public class MutableSharedBitVectorIntSet
    extends java.lang.Object
    implements MutableIntSet
    The shared bit vector implementation described by [Heintze 1999] TODO: much optimization possible.
    See Also:
    Serialized Form
    • Constructor Detail

      • MutableSharedBitVectorIntSet

        public MutableSharedBitVectorIntSet()
      • MutableSharedBitVectorIntSet

        public MutableSharedBitVectorIntSet​(MutableSharedBitVectorIntSet set)
        Throws:
        java.lang.IllegalArgumentException - if set is null
      • MutableSharedBitVectorIntSet

        public MutableSharedBitVectorIntSet​(SparseIntSet s)
        Throws:
        java.lang.IllegalArgumentException - if s is null
      • MutableSharedBitVectorIntSet

        public MutableSharedBitVectorIntSet​(BitVectorIntSet s)
        Throws:
        java.lang.IllegalArgumentException - if s is null
    • Method Detail

      • contains

        public boolean contains​(int i)
        Specified by:
        contains in interface IntSet
        Returns:
        true iff this set contains integer i
      • intersection

        public IntSet intersection​(IntSet that)
        Description copied from interface: IntSet
        This implementation must not despoil the original value of "this"
        Specified by:
        intersection in interface IntSet
        Returns:
        a new IntSet which is the intersection of this and that
      • union

        public IntSet union​(IntSet that)
        Description copied from interface: IntSet
        This implementation must not despoil the original value of "this"
        Specified by:
        union in interface IntSet
        Returns:
        a new IntSet containing all elements of this and that
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface IntSet
        Returns:
        true iff this set is empty
      • size

        public int size()
        Specified by:
        size in interface IntSet
        Returns:
        the number of elements in this set
      • foreach

        public void foreach​(IntSetAction action)
        Description copied from interface: IntSet
        Invoke an action on each element of the Set
        Specified by:
        foreach in interface IntSet
      • foreachExcluding

        public void foreachExcluding​(IntSet X,
                                     IntSetAction action)
        Description copied from interface: IntSet
        Invoke an action on each element of the Set, excluding elements of Set X
        Specified by:
        foreachExcluding in interface IntSet
      • max

        public int max()
        Specified by:
        max in interface IntSet
        Returns:
        maximum integer in this set.
      • isSubset

        public boolean isSubset​(IntSet that)
        Specified by:
        isSubset in interface IntSet
        Returns:
        true iff this is a subset of that.
      • copySet

        public void copySet​(IntSet set)
        Description copied from interface: MutableIntSet
        Set the value of this to be the same as the value of set
        Specified by:
        copySet in interface MutableIntSet
      • addAll

        public boolean addAll​(IntSet set)
                       throws java.lang.IllegalArgumentException
        Description copied from interface: MutableIntSet
        Add all members of set to this.
        Specified by:
        addAll in interface MutableIntSet
        Returns:
        true iff the value of this changes.
        Throws:
        java.lang.IllegalArgumentException
      • add

        public boolean add​(int i)
        Description copied from interface: MutableIntSet
        Add an integer value to this set.
        Specified by:
        add in interface MutableIntSet
        Parameters:
        i - integer to add
        Returns:
        true iff the value of this changes.
      • remove

        public boolean remove​(int i)
        Description copied from interface: MutableIntSet
        Remove an integer from this set.
        Specified by:
        remove in interface MutableIntSet
        Parameters:
        i - integer to remove
        Returns:
        true iff the value of this changes.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hasSharedPart

        public boolean hasSharedPart()
      • containsAny

        public boolean containsAny​(IntSet set)
        Specified by:
        containsAny in interface IntSet
        Returns:
        true iff this set contains integer i
      • clear

        public void clear()
        Description copied from interface: MutableIntSet
        remove all elements from this set
        Specified by:
        clear in interface MutableIntSet