Package org.apache.uima.fit.util
Class ContainmentIndex<S extends org.apache.uima.cas.text.AnnotationFS,U extends org.apache.uima.cas.text.AnnotationFS>
java.lang.Object
org.apache.uima.fit.util.ContainmentIndex<S,U>
- Type Parameters:
S
- covering type.U
- covered type.
public class ContainmentIndex<S extends org.apache.uima.cas.text.AnnotationFS,U extends org.apache.uima.cas.text.AnnotationFS>
extends Object
Create a fast way of repeatedly checking whether instances of one type are contained within the
boundaries on another type.
-
Nested Class Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
ContainmentIndex
(org.apache.uima.cas.CAS cas, org.apache.uima.cas.Type aSuper, org.apache.uima.cas.Type aUnder, ContainmentIndex.Type aType) Create a new index on the given JCas using the specified two types. -
Method Summary
Modifier and TypeMethodDescriptioncontainedIn
(S aSuper) Get all instances of the covered type contained within the boundaries of the specified instance of the covering type.containing
(U aUnder) Get all instances of the covering type containing the the specified instance of the covered type.static ContainmentIndex<org.apache.uima.cas.text.AnnotationFS,
org.apache.uima.cas.text.AnnotationFS> create
(org.apache.uima.cas.CAS cas, org.apache.uima.cas.Type aSuper, org.apache.uima.cas.Type aUnder, ContainmentIndex.Type aType) Factory method to create an index instead of using the constructor.static <A extends org.apache.uima.cas.text.AnnotationFS,
B extends org.apache.uima.cas.text.AnnotationFS>
ContainmentIndex<A,B> create
(org.apache.uima.jcas.JCas aJcas, Class<A> aSuper, Class<B> aUnder, ContainmentIndex.Type aType) Factory method to create an index instead of using the constructor.boolean
isContainedIn
(S aSuper, U aUnder) Checks if the given covered type is contained in the specified covering type.boolean
isContainedInAny
(U aUnder) Checks if the given covered type is contained in any instance of the covering type.
-
Constructor Details
-
ContainmentIndex
protected ContainmentIndex(org.apache.uima.cas.CAS cas, org.apache.uima.cas.Type aSuper, org.apache.uima.cas.Type aUnder, ContainmentIndex.Type aType) Create a new index on the given JCas using the specified two types. The last argument indicates in which directions lookups to the index will be made.- Parameters:
cas
- the working JCas.aSuper
- the covering type.aUnder
- the covered type.aType
- the indexing strategy.
-
-
Method Details
-
containedIn
Get all instances of the covered type contained within the boundaries of the specified instance of the covering type.- Parameters:
aSuper
- a covering type instance.- Returns:
- a collection of covered type instances.
-
containing
Get all instances of the covering type containing the the specified instance of the covered type.- Parameters:
aUnder
- a covered type instance.- Returns:
- a collection of covering type instances.
-
isContainedIn
Checks if the given covered type is contained in the specified covering type.- Parameters:
aSuper
- the covering type instance.aUnder
- the covered type instance.- Returns:
- whether the covered instance is contained in the covering instance.
-
isContainedInAny
Checks if the given covered type is contained in any instance of the covering type.- Parameters:
aUnder
- the covered type instance.- Returns:
- whether the covered instance is contained in any instance of the covering type.
-
create
public static <A extends org.apache.uima.cas.text.AnnotationFS,B extends org.apache.uima.cas.text.AnnotationFS> ContainmentIndex<A,B> create(org.apache.uima.jcas.JCas aJcas, Class<A> aSuper, Class<B> aUnder, ContainmentIndex.Type aType) Factory method to create an index instead of using the constructor. This makes used of Java's type inference capabilities and results in less verbose code.- Type Parameters:
A
- covering type.B
- covered type.- Parameters:
aJcas
- the working JCas.aSuper
- the covering type.aUnder
- the covered type.aType
- the indexing strategy.- Returns:
- the index instance.
-
create
public static ContainmentIndex<org.apache.uima.cas.text.AnnotationFS,org.apache.uima.cas.text.AnnotationFS> create(org.apache.uima.cas.CAS cas, org.apache.uima.cas.Type aSuper, org.apache.uima.cas.Type aUnder, ContainmentIndex.Type aType) Factory method to create an index instead of using the constructor. This makes used of Java's type inference capabilities and results in less verbose code.- Parameters:
cas
- the working JCas.aSuper
- the covering type.aUnder
- the covered type.aType
- the indexing strategy.- Returns:
- the index instance.
-