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

  • Type Parameters:
    E -
    All Implemented Interfaces:
    JCoReAnnotationIndex<E>

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

    Use when: You need access to annotations between a given begin- and end-offset or completely covered by another annotation.

    Allows efficient access to annotation which are covered completely by a given begin - end offset span.
    Author:
    faessler
    • Constructor Summary

      Constructors 
      Constructor Description
      JCoReCoverIndex()  
      JCoReCoverIndex​(org.apache.uima.jcas.JCas jcas, int type)  
      JCoReCoverIndex​(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 a)  
      void freeze()
      Freeze the index to allow searching it.
      void index​(E annotation)
      Adds annotation into the index data structure.
      void index​(org.apache.uima.jcas.JCas jCas, int type)
      Adds the whole contents of the CAS annotation index of type type into the index data structure.
      void index​(org.apache.uima.jcas.JCas jCas, org.apache.uima.cas.Type type)
      Adds the whole contents of the CAS annotation index of type type into the index data structure.
      void melt()
      Un-freeze the index to allow new elements to be added.
      Stream<E> search​(int begin, int end)
      Returns all annotations in this index that are completely covered by the span given by begin and end.
      Stream<E> search​(org.apache.uima.jcas.tcas.Annotation a)
      Returns all annotations in this index that are completely covered by the annotation a.
    • Constructor Detail

      • JCoReCoverIndex

        public JCoReCoverIndex()
      • JCoReCoverIndex

        public JCoReCoverIndex​(org.apache.uima.jcas.JCas jcas,
                               int type)
      • JCoReCoverIndex

        public JCoReCoverIndex​(org.apache.uima.jcas.JCas jcas,
                               org.apache.uima.cas.Type type)
    • Method Detail

      • freeze

        public void freeze()
        Freeze the index to allow searching it. The index can only be searched if frozen.
      • melt

        public void melt()
        Un-freeze the index to allow new elements to be added.
      • index

        public void index​(org.apache.uima.jcas.JCas jCas,
                          int type)
        Adds the whole contents of the CAS annotation index of type type into the index data structure. To access the indexed annotations, first freeze() the index and then search(int, int) it.
        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)
        Adds the whole contents of the CAS annotation index of type type into the index data structure. To access the indexed annotations, first freeze() the index and then search(int, int) it.
        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)
        Adds annotation into the index data structure. To access the indexed annotations, first freeze() the index and then search(int, int) it.
        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.
      • search

        public Stream<E> search​(org.apache.uima.jcas.tcas.Annotation a)
        Returns all annotations in this index that are completely covered by the annotation a.
        Parameters:
        a - The annotation for which contained annotations should be returned.
        Returns:
        Indexed annotations whose offsets lie between the offsets of a, including the exact begin and end offsets.
      • search

        public Stream<E> search​(int begin,
                                int end)
        Returns all annotations in this index that are completely covered by the span given by begin and end.
        Parameters:
        begin - The lowest offset where returned annotations may begin.
        end - The largest offset where returned annotations may end.
        Returns:
        Indexed annotations whose offsets lie between begin and end, inclusive.
      • add

        public void add​(E a)
        Specified by:
        add in interface JCoReAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation>