Class CopyOnWriteObjHashSet<T extends FeatureStructure>

java.lang.Object
org.apache.uima.internal.util.CopyOnWriteObjHashSet<T>
All Implemented Interfaces:
CopyOnWriteIndexPart<T>

public class CopyOnWriteObjHashSet<T extends FeatureStructure> extends Object implements CopyOnWriteIndexPart<T>
implements ObjHashSet partially, for iterator use
  • Constructor Details

    • CopyOnWriteObjHashSet

      public CopyOnWriteObjHashSet(ObjHashSet<T> original)
  • Method Details

    • makeReadOnlyCopy

      public void makeReadOnlyCopy()
      Called by index when about to make an update
      Specified by:
      makeReadOnlyCopy in interface CopyOnWriteIndexPart<T extends FeatureStructure>
    • find

      public int find(T obj)
      Parameters:
      obj - the object to find in the table (if it is there)
      Returns:
      the position of obj in the table, or -1 if not in the table
    • get

      public T get(int index)
      For iterator use
      Parameters:
      index - a magic number returned by the internal find
      Returns:
      the T at that spot, or null if nothing there
    • moveToNextFilled

      public int moveToNextFilled(int pos)
      advance pos until it points to a non 0 or is 1 past end
      Parameters:
      pos - -
      Returns:
      updated pos
    • moveToPreviousFilled

      public int moveToPreviousFilled(int pos)
      decrement pos until it points to a non 0 or is -1
      Parameters:
      pos - -
      Returns:
      updated pos
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface CopyOnWriteIndexPart<T extends FeatureStructure>
      Returns:
      iterator over all the elements
    • moveTo

      public int moveTo(FeatureStructure fs)
      if the fs is in the set, the iterator should return it. if not, return -1 (makes iterator invalid)
      Parameters:
      fs - position to this fs
      Returns:
      the index if present, otherwise -1;
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getCapacity

      public int getCapacity()
      Returns:
      the capacity >= size
      See Also:
      • Common_hash_support.getCapacity()
    • size

      public final int size()
      Specified by:
      size in interface CopyOnWriteIndexPart<T extends FeatureStructure>
      Returns:
      the size
      See Also:
    • isOriginal

      public boolean isOriginal()
      Specified by:
      isOriginal in interface CopyOnWriteIndexPart<T extends FeatureStructure>
      Returns:
      true if this cow version is the same as the original. true means the index has not been updated
    • copyToArray

      public int copyToArray(T[] target, int startingIndexInTarget)
      Description copied from interface: CopyOnWriteIndexPart
      Copy FS refs to target from this index part
      Specified by:
      copyToArray in interface CopyOnWriteIndexPart<T extends FeatureStructure>
      Parameters:
      target - the target array to copy into
      startingIndexInTarget - the starting index in the target array
      Returns:
      startingIndexInTarget + size