Class FsIndex_flat<T extends FeatureStructure>

  • Type Parameters:
    T - the Java class type for this index
    All Implemented Interfaces:
    java.lang.Iterable<T>, java.util.Collection<T>, java.util.Comparator<FeatureStructure>, FSIndex<T>, LowLevelIndex<T>

    public class FsIndex_flat<T extends FeatureStructure>
    extends FsIndex_singletype<T>
    Common part of flattened indexes, used for both snapshot iterators and flattened sorted indexes built from passed in instance of FsIndex_iicp
    • Field Detail

      • indexedFSs

        private final TOP[] indexedFSs
      • comparatorWithoutId

        private final java.util.Comparator<TOP> comparatorWithoutId
      • maxAnnotSpan

        private final int maxAnnotSpan
    • Method Detail

      • fillFlatArray

        private TOP[] fillFlatArray()
        Flat array filled, ordered
        Parameters:
        flatArray - the array to fill
      • iterator

        public LowLevelIterator<T> iterator()
        Description copied from interface: LowLevelIndex
        Return an iterator over the index. The position of the iterator will be set to return the first item in the index. If the index is empty, the iterator position will be marked as invalid.
        Specified by:
        iterator in interface java.util.Collection<T extends FeatureStructure>
        Specified by:
        iterator in interface FSIndex<T extends FeatureStructure>
        Specified by:
        iterator in interface java.lang.Iterable<T extends FeatureStructure>
        Specified by:
        iterator in interface LowLevelIndex<T extends FeatureStructure>
        Specified by:
        iterator in class java.util.AbstractCollection<T extends FeatureStructure>
        Returns:
        An FSIterator positioned at the beginning, or an invalid iterator.
      • iterator

        public LowLevelIterator<T> iterator​(boolean orderNotNeeded,
                                            boolean ignoreType)
        Description copied from interface: LowLevelIndex
        Internal use, used by select framework. Return an iterator over the index. The position of the iterator will be set to return the first item in the index. If the index is empty, the iterator position will be marked as invalid.
        Parameters:
        orderNotNeeded - if true, skips work while iterating to keep iterators over multiple types in sync.
        ignoreType - if true, the comparator used for moveTo leftmost operations will ignore typeOrder keys, if the index happens to define these
        Returns:
        An FSIterator positioned at the beginning, or an invalid iterator.
      • insert

        void insert​(T fs)
        Description copied from class: FsIndex_singletype
        Adding FS to an index. not in upper interfaces because it's internal use only - called via addToIndexes etc.
        Specified by:
        insert in class FsIndex_singletype<T extends FeatureStructure>
        Parameters:
        fs - the fs to be added
      • contains

        public boolean contains​(FeatureStructure fs)
        Description copied from interface: FSIndex

        Check if the index contains an element equal to the given feature structure according to the comparators defined for this index. For bag indexes (which have no comparators), the equality test means the identical feature structure. Note that this is in general not the same as feature structure identity.

        The element is used as a template, and may be a supertype of the type of the index, as long as the keys specified for this index can be accessed.

        Parameters:
        fs - A Feature Structure used a template to match for equality with the FSs in the index.
        Returns:
        true if the index contains such an element.
      • find

        public T find​(FeatureStructure fs)
        Description copied from interface: FSIndex
        Find an entry in the index "equal to" the given feature structure according to the comparators specified for this index. Note that this is in general not the same as feature structure identity. For BAG indexes, it is identity, for others it means the found feature structure compares equal with the parameter in terms of the defined comparators for the index. If there are multiple different FSs in the index which compare equal with the given feature structure, an arbitrary one is returned. This differs from the moveTo(fs) operation which guarantees to move to the first feature structure occurring in the index in this case.
        Parameters:
        fs - A Feature Structure used a template to match with the Feature Structures in the index. It must have the keys needed to do the compare as specified for the index that it's in.
        Returns:
        A FS equal to the template argument, or null if no such FS exists.
        See Also:
        FSIterator.moveTo(FeatureStructure)
      • size

        public int size()
        Description copied from interface: FSIndex
        Return the number of feature structures in this index.
        Specified by:
        size in interface java.util.Collection<T extends FeatureStructure>
        Specified by:
        size in interface FSIndex<T extends FeatureStructure>
        Specified by:
        size in class java.util.AbstractCollection<T extends FeatureStructure>
        Returns:
        The number of FSs in this index.
        See Also:
        FSIndex.size()
      • deleteFS

        public boolean deleteFS​(T fs)
        Specified by:
        deleteFS in class FsIndex_singletype<T extends FeatureStructure>
        Parameters:
        fs - - the Feature Structure to be removed. Only this exact Feature Structure is removed (this is a stronger test than, for example, what moveTo(fs) does, where the fs in that case is used as a template). It is not an error if this exact Feature Structure is not in an index.
        Returns:
        true if something was removed, false if not found
        See Also:
        FsIndex_singletype.deleteFS(FeatureStructure)
      • bulkAddTo

        protected void bulkAddTo​(IntVector v)
      • ll_maxAnnotSpan

        public int ll_maxAnnotSpan()
        Returns:
        for annotation indexes, an conservative estimate the maximum span between begin and end The value may be larger than actual.