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 java.lang.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 Summary

      Constructors 
      Constructor Description
      JCoReSetAnnotationIndex​(java.util.Comparator<? super E> comparator)  
      JCoReSetAnnotationIndex​(java.util.Comparator<? super E> comparator, org.apache.uima.jcas.JCas jCas, int type)  
      JCoReSetAnnotationIndex​(java.util.Comparator<? super E> comparator, org.apache.uima.jcas.JCas jCas, org.apache.uima.cas.Type type)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(E annotation)
      The same as index(Annotation).
      boolean contains​(org.apache.uima.jcas.tcas.Annotation a)  
      E get​(E a)  
      java.util.TreeSet<E> getIndex()  
      void index​(E annotation)
      Indexes the given annotation.
      void index​(org.apache.uima.jcas.JCas jCas, int type)
      Indexes the whole contents of the CAS annotation index of type type.
      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.
      java.util.stream.Stream<E> items()  
      java.util.stream.Stream<E> search​(E a)  
      java.util.NavigableSet<E> searchSubset​(E a)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JCoReSetAnnotationIndex

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

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

        public JCoReSetAnnotationIndex​(java.util.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 java.util.stream.Stream<E> search​(E a)
      • searchSubset

        public java.util.NavigableSet<E> searchSubset​(E a)
      • get

        public E get​(E a)
      • contains

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

        public java.util.stream.Stream<E> items()
      • getIndex

        public java.util.TreeSet<E> getIndex()