Interface PositiveIntSet

All Known Implementing Classes:
IntBitSet, IntHashSet, IntSet, PositiveIntSet_impl

public interface PositiveIntSet
An set of non-zero integers, ability to iterate over them (possibly in a sorted way), with O(1) operations for adding, removing, and testing for contains.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final boolean
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(int key)
     
    void
    add all elements in this set to the IntVector v as a bulk operation
    void
    remove all members of the set
    boolean
    contains(int key)
     
    int
    find(int element)
     
    default void
    Iterate over the positive int set in sort order, and run the consumer on each value
    int
    get(int position)
    For FSBagIndex low level iterator use DOESN"T WORK WITH INCREMENTING position VALUES
    boolean
    isValid(int position)
    For FSBagIndex low level iterator use
     
    int
    For FSBagIndex low level iterator use
    int
    For FSBagIndex low level iterator use
    int
    moveToNext(int position)
    For FSBagIndex low level iterator use
    int
    moveToPrevious(int position)
    For FSBagIndex low level iterator use
    boolean
    remove(int key)
     
    int
     
    int[]
     
  • Field Details

  • Method Details

    • clear

      void clear()
      remove all members of the set
    • contains

      boolean contains(int key)
      Parameters:
      key - -
      Returns:
      true if key is in the set
    • add

      boolean add(int key)
      Parameters:
      key - -
      Returns:
      true if this set did not already contain the specified element
    • bulkAddTo

      void bulkAddTo(IntVector v)
      add all elements in this set to the IntVector v as a bulk operation
      Parameters:
      v - - to be added to
    • remove

      boolean remove(int key)
      Parameters:
      key - -
      Returns:
      true if the set had this element before the remove
    • size

      int size()
      Returns:
      number of elements in the set
    • toIntArray

      int[] toIntArray()
      Returns:
      the set as an arbitrarily ordered int array
    • iterator

      IntListIterator iterator()
      Returns:
      an iterator (may be ordered or unordered) over the members of the set
    • find

      int find(int element)
      Parameters:
      element - an item which may be in the set
      Returns:
      -1 if the item is not in the set, or a position value that can be used with iterators to start at that item.
    • get

      int get(int position)
      For FSBagIndex low level iterator use DOESN"T WORK WITH INCREMENTING position VALUES
      Parameters:
      position - - get the element at this position. This is for iterator use only, and is not related to any key
      Returns:
      the element
    • moveToFirst

      int moveToFirst()
      For FSBagIndex low level iterator use
      Returns:
      the position of the first element, or -1;
    • moveToLast

      int moveToLast()
      For FSBagIndex low level iterator use
      Returns:
      the position of the last element, or -1;
    • moveToNext

      int moveToNext(int position)
      For FSBagIndex low level iterator use
      Parameters:
      position - -
      Returns:
      the position of the next element, or -1;
    • moveToPrevious

      int moveToPrevious(int position)
      For FSBagIndex low level iterator use
      Parameters:
      position - -
      Returns:
      the position of the next element, or -1;
    • isValid

      boolean isValid(int position)
      For FSBagIndex low level iterator use
      Parameters:
      position - -
      Returns:
      true if the position is between the first and last element inclusive.
    • forAllInts

      default void forAllInts(IntConsumer v)
      Iterate over the positive int set in sort order, and run the consumer on each value
      Parameters:
      v - the consumer to run