org.apache.uima.jcas.impl
Class JCasImpl

java.lang.Object
  extended by org.apache.uima.cas.AbstractCas_ImplBase
      extended by org.apache.uima.jcas.impl.JCasImpl
All Implemented Interfaces:
AbstractCas, JCas

public class JCasImpl
extends AbstractCas_ImplBase
implements AbstractCas, JCas

implements the supporting infrastructure for JCas model linked with a Cas. There is one logical instance of this instantiated per Cas or CasView. If you hold a reference to a CAS, to get a reference to the corresponding JCas, use the method getJCas(). Likewise, if you hold a reference to this object, you can get a reference to the corresponding CAS object using the method getCas().

There are variables here that hold references to constant, frequently needed Cas values, such as 0-length FSArrays, 0-length Strings, etc. These can be used to improve efficiency, since the same object can be shared and used for all instances because it is unchangeable. These objects are reset when the CAS is reset, and are initialized lazily, on first use.


Field Summary
 
Fields inherited from interface org.apache.uima.jcas.JCas
INVALID_FEATURE_CODE
 
Method Summary
 void addFsToIndexes(FeatureStructure instance)
          Add a feature structure to all appropriate indexes in the repository associated with this CAS View.
 void checkArrayBounds(int fsRef, int pos)
          Internal Use.
static void clearData(CAS cas)
          (Internal Use only) called by the CAS reset function - clears the hashtable holding the associations.
 FeaturePath createFeaturePath()
          Create a feature path.
 FeatureValuePath createFeatureValuePath(java.lang.String featureValuePath)
          Create a feature-value path from a string.
<T extends FeatureStructure>
FSIterator<T>
createFilteredIterator(FSIterator<T> it, FSMatchConstraint constraint)
          Create an iterator over structures satisfying a given constraint.
 SofaFS createSofa(SofaID sofaID, java.lang.String mimeType)
          Create a Subject of Analysis.
 JCas createView(java.lang.String sofaID)
          Create a view and its underlying Sofa (subject of analysis).
<T extends FeatureStructure>
java.util.ListIterator<T>
fs2listIterator(FSIterator<T> it)
          Wrap a standard Java ListIterator around an FSListIterator.
 AnnotationIndex<Annotation> getAnnotationIndex()
          Get the standard annotation index.
 AnnotationIndex<Annotation> getAnnotationIndex(int type)
          Get the standard annotation index restricted to a specific annotation type.
 AnnotationIndex<Annotation> getAnnotationIndex(Type type)
          Get the standard annotation index restricted to a specific annotation type.
 CAS getCas()
          return the Cas object for this JCas instantiation
 CASImpl getCasImpl()
          internal use
 Type getCasType(int i)
          Given Foo.type, return the corresponding CAS Type object.
 ConstraintFactory getConstraintFactory()
          Get a constraint factory.
 TOP getDocumentAnnotationFs()
          Gets the document annotation.
 java.lang.String getDocumentLanguage()
          Gets the language code for this document from the language feature of the special instance of the DocumentationAnnotation associated with this CAS.
 java.lang.String getDocumentText()
          Get the document text.
 FloatArray getFloatArray0L()
          A constant for each cas which holds a 0-length instance.
 FSArray getFSArray0L()
          A constant for each cas which holds a 0-length instance.
 FSIndexRepository getFSIndexRepository()
          return the FSIndexRepository object for this Cas.
 FSIndexRepository getIndexRepository()
          Get the index repository.
 IntegerArray getIntegerArray0L()
          A constant for each cas which holds a 0-length instance.
static JCas getJCas(CASImpl cas)
          creates a new JCas instance that corresponds to a CAS instance.
 JCas getJCas(Sofa sofa)
          Create a JCas view for a Sofa.
 TOP getJfsFromCaddr(int casAddr)
          Internal Use - sets the corresponding Java instance for a Cas instance
 JFSIndexRepository getJFSIndexRepository()
          Gets the JCas-based interface to the Index Repository.
 LowLevelCAS getLowLevelCas()
          internal use
 LowLevelIndexRepository getLowLevelIndexRepository()
           
 Feature getRequiredFeature(Type t, java.lang.String s)
          Internal use - look up a feature-name-string in the CAS type system and returns the Cas Feature object.
 Feature getRequiredFeatureDE(Type t, java.lang.String s, java.lang.String rangeName, boolean featOkTst)
          Internal Use - look up a feature-name-string in the CAS type system and returns the Cas Feature object.
 Type getRequiredType(java.lang.String s)
          Make the instance of the JCas xxx_Type class for this CAS.
 Sofa getSofa()
          Get the Sofa feature structure associated with this JCas view.
 Sofa getSofa(SofaID sofaID)
           
 FeatureStructure getSofaDataArray()
          Get the Sofa data array.
 java.io.InputStream getSofaDataStream()
          Get the Sofa data as a byte stream.
 java.lang.String getSofaDataString()
          Get the Sofa Data String (a.k.a.
 java.lang.String getSofaDataURI()
          Get the Sofa data array.
 FSIterator<SofaFS> getSofaIterator()
          Get iterator for all SofaFS in the CAS.
 java.lang.String getSofaMimeType()
          Get the mime type of the Sofa data being analyzed.
 StringArray getStringArray0L()
          A constant for each cas which holds a 0-length instance.
 TOP_Type getType(int i)
          get the JCas _Type instance for a particular CAS type constant
 TOP_Type getType(TOP instance)
          get the JCas x_Type instance for a particular Java instance of a type
 TypeSystem getTypeSystem()
          Return the type system of this CAS instance.
 JCas getView(SofaFS aSofa)
          Get the view for a Sofa (subject of analysis).
 JCas getView(java.lang.String localViewName)
          Get the view for a Sofa (subject of analysis).
 java.util.Iterator<JCas> getViewIterator()
          Get iterator over all views in this JCas.
 java.util.Iterator<JCas> getViewIterator(java.lang.String localViewNamePrefix)
          Get iterator over all views with the given name prefix.
 java.lang.String getViewName()
          Get the view name.
 void instantiateJCas_Types(java.lang.ClassLoader cl)
           
 void processInit()
          initialize the JCas for new Cas content.
 void putJfsFromCaddr(int casAddr, FeatureStructure fs)
          Internal Use - sets the corresponding Java instance for a Cas instance
 void release()
          Default implementation that returns this CAS to its CasManager by calling CasOwner.releaseCas(AbstractCas).
 void removeFsFromIndexes(FeatureStructure instance)
          Remove a feature structure from all indexes in the repository associated with this CAS View.
 void reset()
          Reset the CAS, emptying it of all content.
 void setDocumentLanguage(java.lang.String language)
          Sets the language for this document.
 void setDocumentText(java.lang.String text)
          Set the document text.
 void setOwner(CasOwner aCasOwner)
          Provides this CAS with a handle to the CASOwner that owns it.
 void setSofaDataArray(FeatureStructure array, java.lang.String mime)
          Set the Sofa data as an ArrayFS.
 void setSofaDataString(java.lang.String text, java.lang.String mime)
          Set the document text.
 void setSofaDataURI(java.lang.String uri, java.lang.String mime)
          Set the Sofa data as a URI.
 void showJfsFromCaddrHistogram()
           
 int size()
          Estimate the memory consumption of this CAS instance (in bytes).
 void switchClassLoader(java.lang.ClassLoader cl)
          This is only called when the JCas is already set up
 void throwFeatMissing(java.lang.String feat, java.lang.String type)
          Internal - throw missing feature exception at runtime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFSIndexRepository

public FSIndexRepository getFSIndexRepository()
Description copied from interface: JCas
return the FSIndexRepository object for this Cas.

Specified by:
getFSIndexRepository in interface JCas

getLowLevelIndexRepository

public LowLevelIndexRepository getLowLevelIndexRepository()
Specified by:
getLowLevelIndexRepository in interface JCas

getCas

public CAS getCas()
Description copied from interface: JCas
return the Cas object for this JCas instantiation

Specified by:
getCas in interface JCas

getCasImpl

public CASImpl getCasImpl()
Description copied from interface: JCas
internal use

Specified by:
getCasImpl in interface JCas

getLowLevelCas

public LowLevelCAS getLowLevelCas()
Description copied from interface: JCas
internal use

Specified by:
getLowLevelCas in interface JCas

getTypeSystem

public TypeSystem getTypeSystem()
Description copied from interface: JCas
Return the type system of this CAS instance.

Specified by:
getTypeSystem in interface JCas
Returns:
The type system, or null if none is available.

getType

public TOP_Type getType(int i)
Description copied from interface: JCas
get the JCas _Type instance for a particular CAS type constant

Specified by:
getType in interface JCas
Parameters:
i - the CAS type constant, written as Foo.type
Returns:
the instance of the JCas xxx_Type object for the specified type

getCasType

public Type getCasType(int i)
Description copied from interface: JCas
Given Foo.type, return the corresponding CAS Type object. This is useful in the methods which require a CAS Type, for instance iterator creation.

Specified by:
getCasType in interface JCas
Parameters:
i - - index returned by Foo.type
Returns:
the CAS Java Type object for this CAS Type.

getType

public TOP_Type getType(TOP instance)
Description copied from interface: JCas
get the JCas x_Type instance for a particular Java instance of a type

Specified by:
getType in interface JCas
Returns:
the associated xxx_Type instance

switchClassLoader

public void switchClassLoader(java.lang.ClassLoader cl)
This is only called when the JCas is already set up

Parameters:
cl - class loader to switch to
Throws:
CASException

instantiateJCas_Types

public void instantiateJCas_Types(java.lang.ClassLoader cl)

getJCas

public static JCas getJCas(CASImpl cas)
                    throws CASException
creates a new JCas instance that corresponds to a CAS instance. Will be called once by the UIMA framework when it creates the CAS.

Parameters:
cas - a CAS instance
Returns:
newly created and initialized JCas
Throws:
CASException

getRequiredType

public Type getRequiredType(java.lang.String s)
                     throws CASException
Make the instance of the JCas xxx_Type class for this CAS. Note: not all types will have xxx_Type. Instance creation does the typeSystemInit kind of function, as well.

Specified by:
getRequiredType in interface JCas
Throws:
CASException

getRequiredFeature

public Feature getRequiredFeature(Type t,
                                  java.lang.String s)
                           throws CASException
Description copied from interface: JCas
Internal use - look up a feature-name-string in the CAS type system and returns the Cas Feature object. Throws CASException if the feature isn't found

Specified by:
getRequiredFeature in interface JCas
Throws:
CASException

getRequiredFeatureDE

public Feature getRequiredFeatureDE(Type t,
                                    java.lang.String s,
                                    java.lang.String rangeName,
                                    boolean featOkTst)
Description copied from interface: JCas
Internal Use - look up a feature-name-string in the CAS type system and returns the Cas Feature object. If the feature isn't found, adds an exception to the errorSet but doesn't throw

Specified by:
getRequiredFeatureDE in interface JCas

throwFeatMissing

public void throwFeatMissing(java.lang.String feat,
                             java.lang.String type)
Internal - throw missing feature exception at runtime

Specified by:
throwFeatMissing in interface JCas
Parameters:
feat -
type -

putJfsFromCaddr

public void putJfsFromCaddr(int casAddr,
                            FeatureStructure fs)
Description copied from interface: JCas
Internal Use - sets the corresponding Java instance for a Cas instance

Specified by:
putJfsFromCaddr in interface JCas

getJfsFromCaddr

public TOP getJfsFromCaddr(int casAddr)
Description copied from interface: JCas
Internal Use - sets the corresponding Java instance for a Cas instance

Specified by:
getJfsFromCaddr in interface JCas

showJfsFromCaddrHistogram

public void showJfsFromCaddrHistogram()

clearData

public static void clearData(CAS cas)
(Internal Use only) called by the CAS reset function - clears the hashtable holding the associations.


reset

public void reset()
Description copied from interface: JCas
Reset the CAS, emptying it of all content. Feature structures and iterators will no longer be valid. Note: this method may only be called from an application. Calling it from an annotator will trigger a runtime exception.

Specified by:
reset in interface JCas
See Also:
CASMgr

checkArrayBounds

public final void checkArrayBounds(int fsRef,
                                   int pos)
Description copied from interface: JCas
Internal Use.

Specified by:
checkArrayBounds in interface JCas

getSofa

public Sofa getSofa(SofaID sofaID)
Specified by:
getSofa in interface JCas

getSofa

public Sofa getSofa()
Description copied from interface: JCas
Get the Sofa feature structure associated with this JCas view.

Specified by:
getSofa in interface JCas
Returns:
The SofaFS associated with this JCas view.

createView

public JCas createView(java.lang.String sofaID)
                throws CASException
Description copied from interface: JCas
Create a view and its underlying Sofa (subject of analysis). The view provides access to the Sofa data and the index repository that contains metadata (annotations and other feature structures) pertaining to that Sofa.

This method creates the underlying Sofa feature structure, but does not set the Sofa data. Setting ths Sofa data must be done by calling JCas.setSofaDataArray(FeatureStructure, String), JCas.setSofaDataString(String, String) or JCas.setSofaDataURI(String, String) on the JCas view returned by this method.

Specified by:
createView in interface JCas
Parameters:
sofaID - the local view name, before any sofa name mapping is done, for this view (note: this is the same as the associated Sofa name).
Returns:
The view corresponding to this local name.
Throws:
CASException

getJCas

public JCas getJCas(Sofa sofa)
             throws CASException
Description copied from interface: JCas
Create a JCas view for a Sofa.

Specified by:
getJCas in interface JCas
Parameters:
sofa - a Sofa feature structure in this CAS.
Returns:
The JCas view for the given Sofa.
Throws:
CASException

getSofaIterator

public FSIterator<SofaFS> getSofaIterator()
Description copied from interface: JCas
Get iterator for all SofaFS in the CAS.

Specified by:
getSofaIterator in interface JCas
Returns:
an iterator over SofaFS.

getJFSIndexRepository

public JFSIndexRepository getJFSIndexRepository()
Description copied from interface: JCas
Gets the JCas-based interface to the Index Repository. Provides the same functionality as JCas.getFSIndexRepository() except that the methods that take a "type" argument take type arguments obtainable easily from the JCas type.

Specified by:
getJFSIndexRepository in interface JCas
Returns:
the JCas-based interface to the index repository

getDocumentAnnotationFs

public TOP getDocumentAnnotationFs()
Description copied from interface: JCas
Gets the document annotation. The object returned from this method can be typecast to DocumentAnnotation.

The reason that the return type of this method is not DocumentAnnotation is because of problems that arise when using the UIMA Extension ClassLoader to load annotator classes. The DocumentAnnotation type may be defined in the UIMA extension ClassLoader, differently than in the framework ClassLoader.

Specified by:
getDocumentAnnotationFs in interface JCas
Returns:
The one instance of the DocumentAnnotation annotation.
See Also:
CAS.getDocumentAnnotation()

getDocumentText

public java.lang.String getDocumentText()
Description copied from interface: JCas
Get the document text.

Specified by:
getDocumentText in interface JCas
Returns:
The text being analyzed.

getSofaDataString

public java.lang.String getSofaDataString()
Description copied from interface: JCas
Get the Sofa Data String (a.k.a. the document text).

Specified by:
getSofaDataString in interface JCas
Returns:
The Sofa data string.

getSofaDataArray

public FeatureStructure getSofaDataArray()
Description copied from interface: JCas
Get the Sofa data array.

Specified by:
getSofaDataArray in interface JCas
Returns:
The Sofa Data being analyzed.

getSofaDataURI

public java.lang.String getSofaDataURI()
Description copied from interface: JCas
Get the Sofa data array.

Specified by:
getSofaDataURI in interface JCas
Returns:
The Sofa Data being analyzed.

getSofaMimeType

public java.lang.String getSofaMimeType()
Description copied from interface: JCas
Get the mime type of the Sofa data being analyzed.

Specified by:
getSofaMimeType in interface JCas
Returns:
the mime type of the Sofa

setDocumentText

public void setDocumentText(java.lang.String text)
                     throws CASRuntimeException
Description copied from interface: JCas
Set the document text. Once set, Sofa data is immutable, and cannot be set again until the CAS has been reset.

Specified by:
setDocumentText in interface JCas
Parameters:
text - The text to be analyzed.
Throws:
CASRuntimeException - If the Sofa data has already been set.

setSofaDataString

public void setSofaDataString(java.lang.String text,
                              java.lang.String mime)
                       throws CASRuntimeException
Description copied from interface: JCas
Set the document text. Once set, Sofa data is immutable, and cannot be set again until the CAS has been reset.

Specified by:
setSofaDataString in interface JCas
Parameters:
text - The text to be analyzed.
mime - The mime type of the data
Throws:
CASRuntimeException - If the Sofa data has already been set.

setSofaDataArray

public void setSofaDataArray(FeatureStructure array,
                             java.lang.String mime)
                      throws CASRuntimeException
Description copied from interface: JCas
Set the Sofa data as an ArrayFS. Once set, Sofa data is immutable, and cannot be set again until the CAS has been reset.

Specified by:
setSofaDataArray in interface JCas
Parameters:
array - The ArrayFS to be analyzed.
mime - The mime type of the data
Throws:
CASRuntimeException - If the Sofa data has already been set.

setSofaDataURI

public void setSofaDataURI(java.lang.String uri,
                           java.lang.String mime)
                    throws CASRuntimeException
Description copied from interface: JCas
Set the Sofa data as a URI. Once set, Sofa data is immutable, and cannot be set again until the CAS has been reset.

Specified by:
setSofaDataURI in interface JCas
Parameters:
uri - The URI of the data to be analyzed.
mime - The mime type of the data
Throws:
CASRuntimeException - If the Sofa data has already been set.

getDocumentLanguage

public java.lang.String getDocumentLanguage()
Description copied from interface: JCas
Gets the language code for this document from the language feature of the special instance of the DocumentationAnnotation associated with this CAS.

Specified by:
getDocumentLanguage in interface JCas
Returns:
language identifier

setDocumentLanguage

public void setDocumentLanguage(java.lang.String language)
                         throws CASRuntimeException
Description copied from interface: JCas
Sets the language for this document. This value sets the language feature of the special instance of DocumentAnnotation associated with this CAS.

Specified by:
setDocumentLanguage in interface JCas
Throws:
CASRuntimeException

getSofaDataStream

public java.io.InputStream getSofaDataStream()
Description copied from interface: JCas
Get the Sofa data as a byte stream.

Specified by:
getSofaDataStream in interface JCas
Returns:
A stream handle to the Sofa Data.

getConstraintFactory

public ConstraintFactory getConstraintFactory()
Description copied from interface: JCas
Get a constraint factory. A constraint factory is a simple way of creating FSMatchConstraints.

Specified by:
getConstraintFactory in interface JCas
Returns:
A constraint factory to create new FS constraints.

createFeaturePath

public FeaturePath createFeaturePath()
Description copied from interface: JCas
Create a feature path. This is mainly useful for creating FSMatchConstraints.

Specified by:
createFeaturePath in interface JCas
Returns:
A new, empty feature path.

createFilteredIterator

public <T extends FeatureStructure> FSIterator<T> createFilteredIterator(FSIterator<T> it,
                                                                         FSMatchConstraint constraint)
Description copied from interface: JCas
Create an iterator over structures satisfying a given constraint. Constraints are described in the javadocs for ConstraintFactory and related classes.

Specified by:
createFilteredIterator in interface JCas
Parameters:
it - The input iterator.
constraint - The constraint specifying what structures should be returned.
Returns:
An iterator over FSs.

getStringArray0L

public StringArray getStringArray0L()
Description copied from interface: JCas
A constant for each cas which holds a 0-length instance. Since this can be a common value, we avoid creating multiple copies of it. All uses can use the same valuee because it is not updatable (it has no subfields). This is initialized lazily on first reference, and reset when the CAS is reset.

Specified by:
getStringArray0L in interface JCas

getIntegerArray0L

public IntegerArray getIntegerArray0L()
Description copied from interface: JCas
A constant for each cas which holds a 0-length instance. Since this can be a common value, we avoid creating multiple copies of it. All uses can use the same valuee because it is not updatable (it has no subfields). This is initialized lazily on first reference, and reset when the CAS is reset.

Specified by:
getIntegerArray0L in interface JCas

getFloatArray0L

public FloatArray getFloatArray0L()
Description copied from interface: JCas
A constant for each cas which holds a 0-length instance. Since this can be a common value, we avoid creating multiple copies of it. All uses can use the same valuee because it is not updatable (it has no subfields). This is initialized lazily on first reference, and reset when the CAS is reset.

Specified by:
getFloatArray0L in interface JCas

getFSArray0L

public FSArray getFSArray0L()
Description copied from interface: JCas
A constant for each cas which holds a 0-length instance. Since this can be a common value, we avoid creating multiple copies of it. All uses can use the same valuee because it is not updatable (it has no subfields). This is initialized lazily on first reference, and reset when the CAS is reset.

Specified by:
getFSArray0L in interface JCas

processInit

public void processInit()
Description copied from interface: JCas
initialize the JCas for new Cas content. Not used, does nothing.

Specified by:
processInit in interface JCas

setOwner

public void setOwner(CasOwner aCasOwner)
Description copied from class: AbstractCas_ImplBase
Provides this CAS with a handle to the CASOwner that owns it. This is called by the framework when a CAS instance is created. This handle is used to implement the release() method by returning the CAS to its CasOwner.

Overrides:
setOwner in class AbstractCas_ImplBase

release

public void release()
Description copied from class: AbstractCas_ImplBase
Default implementation that returns this CAS to its CasManager by calling CasOwner.releaseCas(AbstractCas).

Specified by:
release in interface AbstractCas
Overrides:
release in class AbstractCas_ImplBase

getView

public JCas getView(java.lang.String localViewName)
             throws CASException
Description copied from interface: JCas
Get the view for a Sofa (subject of analysis). The view provides access to the Sofa data and the index repository that contains metadata (annotations and other feature structures) pertaining to that Sofa.

Specified by:
getView in interface JCas
Parameters:
localViewName - the local name, before any sofa name mapping is done, for this view (note: this is the same as the associated Sofa name).
Returns:
The view corresponding to this local name.
Throws:
CASException

getView

public JCas getView(SofaFS aSofa)
             throws CASException
Description copied from interface: JCas
Get the view for a Sofa (subject of analysis). The view provides access to the Sofa data and the index repository that contains metadata (annotations and other feature structures) pertaining to that Sofa.

Specified by:
getView in interface JCas
Parameters:
aSofa - a Sofa feature structure in the CAS
Returns:
The view for the given Sofa
Throws:
CASException

addFsToIndexes

public void addFsToIndexes(FeatureStructure instance)
Description copied from interface: JCas
Add a feature structure to all appropriate indexes in the repository associated with this CAS View.

Important: after you have called addFsToIndexes(...) on a FS, do not change the values of any features used for indexing. If you do, the index will become corrupted and may be unusable. If you need to change an index feature value, first call removeFsFromIndexes(...) on the FS, change the feature values, then call addFsToIndexes(...) again.

Specified by:
addFsToIndexes in interface JCas
Parameters:
instance - The Feature Structure to be added.

removeFsFromIndexes

public void removeFsFromIndexes(FeatureStructure instance)
Description copied from interface: JCas
Remove a feature structure from all indexes in the repository associated with this CAS View.

Specified by:
removeFsFromIndexes in interface JCas
Parameters:
instance - The Feature Structure to be removed.

fs2listIterator

public <T extends FeatureStructure> java.util.ListIterator<T> fs2listIterator(FSIterator<T> it)
Description copied from interface: JCas
Wrap a standard Java ListIterator around an FSListIterator. Use if you feel more comfortable with java style iterators.

Specified by:
fs2listIterator in interface JCas
Parameters:
it - The FSListIterator to be wrapped.
Returns:
An equivalent ListIterator.
See Also:
CAS.fs2listIterator(FSIterator)

createFeatureValuePath

public FeatureValuePath createFeatureValuePath(java.lang.String featureValuePath)
                                        throws CASRuntimeException
Description copied from interface: JCas
Create a feature-value path from a string.

Specified by:
createFeatureValuePath in interface JCas
Parameters:
featureValuePath - String representation of the feature-value path.
Returns:
Feature-value path object.
Throws:
CASRuntimeException - If the input string is not well-formed.

createSofa

public SofaFS createSofa(SofaID sofaID,
                         java.lang.String mimeType)
Description copied from interface: JCas
Create a Subject of Analysis. The new sofaFS is automatically added to the SofaIndex.

Specified by:
createSofa in interface JCas
Returns:
The sofaFS.

getIndexRepository

public FSIndexRepository getIndexRepository()
Description copied from interface: JCas
Get the index repository.

Specified by:
getIndexRepository in interface JCas
Returns:
The index repository, or null if none is available.

getViewName

public java.lang.String getViewName()
Description copied from interface: JCas
Get the view name. The view name is the same as the name of the view's Sofa, retrieved by getSofa().getSofaID(), except for the initial View before its Sofa has been created.

Specified by:
getViewName in interface JCas
Returns:
The name of the view

size

public int size()
Description copied from interface: JCas
Estimate the memory consumption of this CAS instance (in bytes).

Specified by:
size in interface JCas
Returns:
The estimated memory used by this CAS instance.

getAnnotationIndex

public AnnotationIndex<Annotation> getAnnotationIndex()
Description copied from interface: JCas
Get the standard annotation index.

Specified by:
getAnnotationIndex in interface JCas
Returns:
The standard annotation index.

getAnnotationIndex

public AnnotationIndex<Annotation> getAnnotationIndex(Type type)
                                               throws CASRuntimeException
Description copied from interface: JCas
Get the standard annotation index restricted to a specific annotation type.

Specified by:
getAnnotationIndex in interface JCas
Parameters:
type - The annotation type the index is restricted to.
Returns:
The standard annotation index, restricted to type.
Throws:
CASRuntimeException

getAnnotationIndex

public AnnotationIndex<Annotation> getAnnotationIndex(int type)
                                               throws CASRuntimeException
Description copied from interface: JCas
Get the standard annotation index restricted to a specific annotation type.

Specified by:
getAnnotationIndex in interface JCas
Parameters:
type - The annotation type the index is restricted to, passed as an integer using the form MyAnnotationType.type
Returns:
The standard annotation index, restricted to type.
Throws:
CASRuntimeException

getViewIterator

public java.util.Iterator<JCas> getViewIterator()
                                         throws CASException
Description copied from interface: JCas
Get iterator over all views in this JCas. Each view provides access to Sofa data and the index repository that contains metadata (annotations and other feature structures) pertaining to that Sofa.

Specified by:
getViewIterator in interface JCas
Returns:
an iterator which returns all views. Each object returned by the iterator is of type JCas.
Throws:
CASException

getViewIterator

public java.util.Iterator<JCas> getViewIterator(java.lang.String localViewNamePrefix)
                                         throws CASException
Description copied from interface: JCas
Get iterator over all views with the given name prefix. Each view provides access to Sofa data and the index repository that contains metadata (annotations and other feature structures) pertaining to that Sofa.

When passed the prefix namePrefix, the iterator will return all views who name is either exactly equal to namePrefix or is of the form namePrefix.suffix, where suffix can be any String.

Specified by:
getViewIterator in interface JCas
Parameters:
localViewNamePrefix - the local name prefix, before any sofa name mapping is done, for this view (note: this is the same as the associated Sofa name prefix).
Returns:
an iterator which returns all views with the given name prefix. Each object returned by the iterator is of type JCas.
Throws:
CASException


Copyright © 2011. All Rights Reserved.