|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.uima.cas.AbstractCas_ImplBase
org.apache.uima.jcas.impl.JCasImpl
public class JCasImpl
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. |
|
|
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). |
|
|
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 |
|---|
public FSIndexRepository getFSIndexRepository()
JCas
getFSIndexRepository in interface JCaspublic LowLevelIndexRepository getLowLevelIndexRepository()
getLowLevelIndexRepository in interface JCaspublic CAS getCas()
JCas
getCas in interface JCaspublic CASImpl getCasImpl()
JCas
getCasImpl in interface JCaspublic LowLevelCAS getLowLevelCas()
JCas
getLowLevelCas in interface JCaspublic TypeSystem getTypeSystem()
JCas
getTypeSystem in interface JCasnull if none is available.public TOP_Type getType(int i)
JCas
getType in interface JCasi - the CAS type constant, written as Foo.type
public Type getCasType(int i)
JCas
getCasType in interface JCasi - -
index returned by Foo.type
public TOP_Type getType(TOP instance)
JCas
getType in interface JCaspublic void switchClassLoader(java.lang.ClassLoader cl)
cl - class loader to switch to
CASExceptionpublic void instantiateJCas_Types(java.lang.ClassLoader cl)
public static JCas getJCas(CASImpl cas)
throws CASException
cas - a CAS instance
CASException
public Type getRequiredType(java.lang.String s)
throws CASException
getRequiredType in interface JCasCASException
public Feature getRequiredFeature(Type t,
java.lang.String s)
throws CASException
JCas
getRequiredFeature in interface JCasCASException
public Feature getRequiredFeatureDE(Type t,
java.lang.String s,
java.lang.String rangeName,
boolean featOkTst)
JCas
getRequiredFeatureDE in interface JCas
public void throwFeatMissing(java.lang.String feat,
java.lang.String type)
throwFeatMissing in interface JCasfeat - type -
public void putJfsFromCaddr(int casAddr,
FeatureStructure fs)
JCas
putJfsFromCaddr in interface JCaspublic TOP getJfsFromCaddr(int casAddr)
JCas
getJfsFromCaddr in interface JCaspublic void showJfsFromCaddrHistogram()
public static void clearData(CAS cas)
public void reset()
JCas
reset in interface JCasCASMgr
public final void checkArrayBounds(int fsRef,
int pos)
JCas
checkArrayBounds in interface JCaspublic Sofa getSofa(SofaID sofaID)
getSofa in interface JCaspublic Sofa getSofa()
JCas
getSofa in interface JCas
public JCas createView(java.lang.String sofaID)
throws CASException
JCas
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.
createView in interface JCassofaID - the local view name, before any sofa name mapping is done, for this view (note: this is the
same as the associated Sofa name).
CASException
public JCas getJCas(Sofa sofa)
throws CASException
JCas
getJCas in interface JCassofa - a Sofa feature structure in this CAS.
CASExceptionpublic FSIterator<SofaFS> getSofaIterator()
JCas
getSofaIterator in interface JCaspublic JFSIndexRepository getJFSIndexRepository()
JCasJCas.getFSIndexRepository() except that the methods that take a "type"
argument take type arguments obtainable easily from the JCas type.
getJFSIndexRepository in interface JCaspublic TOP getDocumentAnnotationFs()
JCasDocumentAnnotation.
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.
getDocumentAnnotationFs in interface JCasCAS.getDocumentAnnotation()public java.lang.String getDocumentText()
JCas
getDocumentText in interface JCaspublic java.lang.String getSofaDataString()
JCas
getSofaDataString in interface JCaspublic FeatureStructure getSofaDataArray()
JCas
getSofaDataArray in interface JCaspublic java.lang.String getSofaDataURI()
JCas
getSofaDataURI in interface JCaspublic java.lang.String getSofaMimeType()
JCas
getSofaMimeType in interface JCas
public void setDocumentText(java.lang.String text)
throws CASRuntimeException
JCas
setDocumentText in interface JCastext - The text to be analyzed.
CASRuntimeException - If the Sofa data has already been set.
public void setSofaDataString(java.lang.String text,
java.lang.String mime)
throws CASRuntimeException
JCas
setSofaDataString in interface JCastext - The text to be analyzed.mime - The mime type of the data
CASRuntimeException - If the Sofa data has already been set.
public void setSofaDataArray(FeatureStructure array,
java.lang.String mime)
throws CASRuntimeException
JCas
setSofaDataArray in interface JCasarray - The ArrayFS to be analyzed.mime - The mime type of the data
CASRuntimeException - If the Sofa data has already been set.
public void setSofaDataURI(java.lang.String uri,
java.lang.String mime)
throws CASRuntimeException
JCas
setSofaDataURI in interface JCasuri - The URI of the data to be analyzed.mime - The mime type of the data
CASRuntimeException - If the Sofa data has already been set.public java.lang.String getDocumentLanguage()
JCas
getDocumentLanguage in interface JCas
public void setDocumentLanguage(java.lang.String language)
throws CASRuntimeException
JCas
setDocumentLanguage in interface JCasCASRuntimeExceptionpublic java.io.InputStream getSofaDataStream()
JCas
getSofaDataStream in interface JCaspublic ConstraintFactory getConstraintFactory()
JCasFSMatchConstraints.
getConstraintFactory in interface JCaspublic FeaturePath createFeaturePath()
JCasFSMatchConstraints.
createFeaturePath in interface JCas
public <T extends FeatureStructure> FSIterator<T> createFilteredIterator(FSIterator<T> it,
FSMatchConstraint constraint)
JCasConstraintFactory and related classes.
createFilteredIterator in interface JCasit - The input iterator.constraint - The constraint specifying what structures should be returned.
public StringArray getStringArray0L()
JCas
getStringArray0L in interface JCaspublic IntegerArray getIntegerArray0L()
JCas
getIntegerArray0L in interface JCaspublic FloatArray getFloatArray0L()
JCas
getFloatArray0L in interface JCaspublic FSArray getFSArray0L()
JCas
getFSArray0L in interface JCaspublic void processInit()
JCas
processInit in interface JCaspublic void setOwner(CasOwner aCasOwner)
AbstractCas_ImplBase
setOwner in class AbstractCas_ImplBasepublic void release()
AbstractCas_ImplBaseCasOwner.releaseCas(AbstractCas).
release in interface AbstractCasrelease in class AbstractCas_ImplBase
public JCas getView(java.lang.String localViewName)
throws CASException
JCas
getView in interface JCaslocalViewName - the local name, before any sofa name mapping is done, for this view (note: this is the
same as the associated Sofa name).
CASException
public JCas getView(SofaFS aSofa)
throws CASException
JCas
getView in interface JCasaSofa - a Sofa feature structure in the CAS
CASExceptionpublic void addFsToIndexes(FeatureStructure instance)
JCas
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.
addFsToIndexes in interface JCasinstance - The Feature Structure to be added.public void removeFsFromIndexes(FeatureStructure instance)
JCas
removeFsFromIndexes in interface JCasinstance - The Feature Structure to be removed.public <T extends FeatureStructure> java.util.ListIterator<T> fs2listIterator(FSIterator<T> it)
JCasListIterator around an FSListIterator. Use
if you feel more comfortable with java style iterators.
fs2listIterator in interface JCasit - The FSListIterator to be wrapped.
ListIterator.CAS.fs2listIterator(FSIterator)
public FeatureValuePath createFeatureValuePath(java.lang.String featureValuePath)
throws CASRuntimeException
JCas
createFeatureValuePath in interface JCasfeatureValuePath - String representation of the feature-value path.
CASRuntimeException - If the input string is not well-formed.
public SofaFS createSofa(SofaID sofaID,
java.lang.String mimeType)
JCas
createSofa in interface JCaspublic FSIndexRepository getIndexRepository()
JCas
getIndexRepository in interface JCasnull if none is available.public java.lang.String getViewName()
JCas
getViewName in interface JCaspublic int size()
JCas
size in interface JCaspublic AnnotationIndex<Annotation> getAnnotationIndex()
JCas
getAnnotationIndex in interface JCas
public AnnotationIndex<Annotation> getAnnotationIndex(Type type)
throws CASRuntimeException
JCas
getAnnotationIndex in interface JCastype - The annotation type the index is restricted to.
type.
CASRuntimeException
public AnnotationIndex<Annotation> getAnnotationIndex(int type)
throws CASRuntimeException
JCas
getAnnotationIndex in interface JCastype - The annotation type the index is restricted to,
passed as an integer using the form
MyAnnotationType.type
type.
CASRuntimeException
public java.util.Iterator<JCas> getViewIterator()
throws CASException
JCas
getViewIterator in interface JCasCASException
public java.util.Iterator<JCas> getViewIterator(java.lang.String localViewNamePrefix)
throws CASException
JCas
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.
getViewIterator in interface JCaslocalViewNamePrefix - 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).
CASException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||