Class CopyOnWriteObjHashSet<T extends FeatureStructure>

    • Constructor Detail

      • CopyOnWriteObjHashSet

        public CopyOnWriteObjHashSet​(ObjHashSet<T> original)
    • Method Detail

      • 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
      • 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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • 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