Package de.julielab.jcore.utility.index
Class JCoReSetAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation>
- java.lang.Object
-
- de.julielab.jcore.utility.index.JCoReSetAnnotationIndex<E>
-
- 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
This class is actually more an ordered set than an index. It is backed by aComparator. 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 atJCoReMapAnnotationIndexand its subclasses.TreeSet- Author:
- faessler
-
-
Constructor Summary
Constructors Constructor Description JCoReSetAnnotationIndex(Comparator<? super E> comparator)JCoReSetAnnotationIndex(Comparator<? super E> comparator, org.apache.uima.jcas.JCas jCas, int type)JCoReSetAnnotationIndex(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 voidadd(E annotation)The same asindex(Annotation).booleancontains(org.apache.uima.jcas.tcas.Annotation a)Eget(E a)TreeSet<E>getIndex()voidindex(E annotation)Indexes the given annotation.voidindex(org.apache.uima.jcas.JCas jCas, int type)Indexes the whole contents of the CAS annotation index of type type.voidindex(org.apache.uima.jcas.JCas jCas, org.apache.uima.cas.Type type)Indexes the whole contents of the CAS annotation index of type type.Stream<E>items()Stream<E>search(E a)NavigableSet<E>searchSubset(E a)
-
-
-
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#indexTermGeneratoris used to create terms with which the annotation will be associated in the index and can be retrieved by asearchmethod.- Specified by:
indexin interfaceJCoReAnnotationIndex<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#indexTermGeneratoris used to create terms with which the annotation will be associated in the index and can be retrieved by asearchmethod.- Specified by:
indexin interfaceJCoReAnnotationIndex<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:
indexin interfaceJCoReAnnotationIndex<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 asindex(Annotation).- Specified by:
addin interfaceJCoReAnnotationIndex<E extends org.apache.uima.jcas.tcas.Annotation>- Parameters:
annotation- The annotation to add to the index.
-
searchSubset
public NavigableSet<E> searchSubset(E a)
-
contains
public boolean contains(org.apache.uima.jcas.tcas.Annotation a)
-
-