efxtools.filtering
Class Scope

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<org.apache.uima.jcas.tcas.Annotation>
              extended by efxtools.filtering.Scope
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<org.apache.uima.jcas.tcas.Annotation>, java.util.Collection<org.apache.uima.jcas.tcas.Annotation>, java.util.List<org.apache.uima.jcas.tcas.Annotation>, java.util.RandomAccess

public class Scope
extends java.util.ArrayList<org.apache.uima.jcas.tcas.Annotation>

This class represents the set of all scopes. A scope defines a set of portions of an input text that are possibly relevant with respect to one or more types of information that refer to an extraction problem.

Technically, a scope is realized as an ordered list of instances of the most general UIMA annotation type Annotation. The ordering ensures that the original ordering of the portions of the input text is maintained.

The filtering framework uses scopes that permanently refer to one or more information types of a given query as well as temporary scopes that are e.g. used to compute the portions of text that have to be analyzed by a concrete (primitive) analysis engine.

All scopes have a unique scope ID. If a scope refers to the information types of a query, its text units have an explicitly defined annotation type. Moreover, a scope has a root scope and a set of descendant scopes according to the hierarchical structure of AScopedQuery.

Author:
Author of EfXTools
See Also:
Serialized Form

Constructor Summary
Scope()
          The constructor creates an empty scope.
 
Method Summary
 void addDescendants(java.util.Collection<Scope> descendants)
          Adds all given descendant scopes to the descendant scopes of this scope.
 boolean equals(java.lang.Object object)
           
 java.util.Set<Scope> getAllDescendants()
          Returns all descendant scopes of this scope in the tree structure of the query this scope refers to.
 int getCoveredCharacters()
          Returns the number of characters currently covered by this scope.
 Scope getRoot()
          Returns the root scope of this scope in the tree structure of the query this scope refers to.
 long getScopeID()
          Returns the scope ID of this scope.
 org.apache.uima.cas.Type getType()
          Returns the annotation type of the text units of this scope.
 void setDescendants(java.util.Set<Scope> descendants)
          Sets the descendant scopes of this scope in the tree structure of the query this scope refers to.
 void setRoot(Scope root)
          Sets the root scope of this scope in the tree structure of the query the scope refers to.
 void setScopeID(long scopeID)
          Sets the scope ID of the scope.
 void setType(org.apache.uima.cas.Type type)
          Sets the annotation type of the text units of this scope to the given type.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

Scope

public Scope()
The constructor creates an empty scope. By default, the scope is its own root scope and it has no child scopes. Changes to this default can be made via the corresponding setter methods.

Method Detail

setScopeID

public void setScopeID(long scopeID)
Sets the scope ID of the scope.

Parameters:
scopeID - The scope ID

setRoot

public void setRoot(Scope root)
Sets the root scope of this scope in the tree structure of the query the scope refers to.

Parameters:
root - The root scope

setType

public void setType(org.apache.uima.cas.Type type)
Sets the annotation type of the text units of this scope to the given type.

Parameters:
type - The type to be set

setDescendants

public void setDescendants(java.util.Set<Scope> descendants)
Sets the descendant scopes of this scope in the tree structure of the query this scope refers to.

Parameters:
descendants - The descendant scopes

addDescendants

public void addDescendants(java.util.Collection<Scope> descendants)
Adds all given descendant scopes to the descendant scopes of this scope.

Parameters:
descendants - The descendant scopes to be added

getScopeID

public long getScopeID()
Returns the scope ID of this scope.

Returns:
The scope ID

getRoot

public Scope getRoot()
Returns the root scope of this scope in the tree structure of the query this scope refers to.

Returns:
The root scope

getType

public org.apache.uima.cas.Type getType()
Returns the annotation type of the text units of this scope. Notice that the filtering framework also uses temporary scopes, which do not have an explicit annotation type. In this case, null is returned.

Returns:
The type of this scope

getAllDescendants

public java.util.Set<Scope> getAllDescendants()
Returns all descendant scopes of this scope in the tree structure of the query this scope refers to. Notice that the filtering framework also uses temporary scopes, which do not have descendant scopes.

Returns:
The descendant scopes

equals

public boolean equals(java.lang.Object object)
Specified by:
equals in interface java.util.Collection<org.apache.uima.jcas.tcas.Annotation>
Specified by:
equals in interface java.util.List<org.apache.uima.jcas.tcas.Annotation>
Overrides:
equals in class java.util.AbstractList<org.apache.uima.jcas.tcas.Annotation>

getCoveredCharacters

public int getCoveredCharacters()
Returns the number of characters currently covered by this scope.

Returns:
The number of characters