Class JCoReSetAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation>

  • Type Parameters:
    E - The annotation type to index.
    All Implemented Interfaces:
    JCoReAnnotationIndex<E>

    public class JCoReSetAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation>
    extends Object
    implements JCoReAnnotationIndex<E>

    Use when: You just want an ordered set of annotations that can be retrieved according to an Comparator. If you want the search keys to be of another type than the annotations in the index or even keys not being annotations at all, look at JCoReMapAnnotationIndex and its subclasses.

    This class is actually more an ordered set than an index. It is backed by a TreeSet
    Author:
    faessler
    • Constructor Detail

      • JCoReSetAnnotationIndex

        public JCoReSetAnnotationIndex​(Comparator<? super E> comparator,
                                       org.apache.uima.jcas.JCas jCas,
                                       org.apache.uima.cas.Type type)
      • JCoReSetAnnotationIndex

        public JCoReSetAnnotationIndex​(Comparator<? super E> comparator,
                                       org.apache.uima.jcas.JCas jCas,
                                       int type)
      • JCoReSetAnnotationIndex

        public JCoReSetAnnotationIndex​(Comparator<? super E> comparator)
    • Method Detail

      • index

        public void index​(org.apache.uima.jcas.JCas jCas,
                          int type)
        Indexes the whole contents of the CAS annotation index of type type. For each annotation, the #indexTermGenerator is used to create terms with which the annotation will be associated in the index and can be retrieved by a search method.
        Specified by:
        index in interface JCoReAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation>
        Parameters:
        jCas - A CAS instance.
        type - The annotation type to index.
      • index

        public void index​(org.apache.uima.jcas.JCas jCas,
                          org.apache.uima.cas.Type type)
        Indexes the whole contents of the CAS annotation index of type type. For each annotation, the #indexTermGenerator is used to create terms with which the annotation will be associated in the index and can be retrieved by a search method.
        Specified by:
        index in interface JCoReAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation>
        Parameters:
        jCas - A CAS instance.
        type - The annotation type to index.
      • index

        public void index​(E annotation)
        Indexes the given annotation.
        Specified by:
        index in interface JCoReAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation>
        Parameters:
        annotation - The annotation to add to the index.
      • add

        public void add​(E annotation)
        The same as index(Annotation).
        Specified by:
        add in interface JCoReAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation>
        Parameters:
        annotation - The annotation to add to the index.
      • search

        public Stream<E> search​(E a)
      • get

        public E get​(E a)
      • contains

        public boolean contains​(org.apache.uima.jcas.tcas.Annotation a)
      • getIndex

        public TreeSet<E> getIndex()