Class CASImpl
- java.lang.Object
-
- org.apache.uima.cas.AbstractCas_ImplBase
-
- org.apache.uima.cas.impl.CASImpl
-
- All Implemented Interfaces:
AbstractCas
,CASMgr
,CAS
,LowLevelCAS
,TypeSystemConstants
public class CASImpl extends AbstractCas_ImplBase implements CAS, CASMgr, LowLevelCAS, TypeSystemConstants
Implements the CAS interfaces. This class must be public because we need to be able to create instance of it from outside the package. Use at your own risk. May change without notice.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CASImpl.FsChange
Journaling changes for computing delta cas.private static class
CASImpl.MeasureSwitchType
(package private) static class
CASImpl.SharedViewData
(package private) static class
CASImpl.SwitchControl
Instances are put into a Stack, to remember previous state to switch back to, when switching class loaders and locking the CAS https://issues.apache.org/jira/browse/UIMA-6057
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ALWAYS_HOLD_ONTO_FSS
(package private) static java.util.concurrent.atomic.AtomicInteger
casIdProvider
static int
DEFAULT_INITIAL_HEAP_SIZE
static int
DEFAULT_RESET_HEAP_SIZE
private static java.lang.ThreadLocal<java.lang.Boolean>
defaultV2IdRefs
private Annotation
deserialized_doc_annot_not_indexed
static java.lang.String
DISABLE_PROTECT_INDEXES
Set this JVM property to false for high performance, (no checking); insure you don't have the report flag (above) turned on - otherwise it will force this to "true".private static java.lang.String
DISABLE_SUBTYPE_FSARRAY_CREATION
private FSIterator<Annotation>
docAnnotIter
Optimization - keep a documentAnnotationIterator handy for getting a ref to the doc annot Initialized lazily, synchronized One per cas viewstatic int
FALSE
(package private) FSIndexRepositoryImpl
indexRepository
The index repository.(package private) static boolean
IS_ALWAYS_HOLD_ONTO_FSS
(package private) static boolean
IS_DISABLE_SUBTYPE_FSARRAY_CREATION
private static boolean
IS_DISABLED_PROTECT_INDEXES
the protect indexes flag is on by default, but may be turned of via setting the property.private static boolean
IS_REPORT_FS_UPDATE_CORRUPTS_INDEX
static boolean
IS_THROW_EXCEPTION_CORRUPT_INDEX
(package private) JCasImpl
jcas
the corresponding JCas objectprivate static boolean
MEASURE_SETINT
private static java.util.Map<CASImpl.MeasureSwitchType,CASImpl.MeasureSwitchType>
measureSwitches
private Sofa
mySofaRef
The Feature Structure for the sofa FS for this view, or null //-1 if the sofa FS is for the initial view, or // 0 if there is no sofa FS - for instance, in the "base cas"static int
NULL
(package private) FeatureStructureImplC
pearBaseFs
for Pear generation - set this to the base FS not in SharedViewData to reduce object traversal when generating FSsprivate FeatureImpl
prevFi
only used for tracing, enables tracing 2 slots for long/doublestatic java.lang.String
REPORT_FS_UPDATES_CORRUPTS
Define this JVM property to enable checking for invalid updates to features which are used as keys by any index.private static java.util.concurrent.atomic.AtomicInteger
strictTypeSourceCheckMessageCount
(package private) CASImpl.SharedViewData
svd
Non-shared instance data kept per CAS view incl base CASstatic java.lang.String
THROW_EXCEPTION_FS_UPDATES_CORRUPTS
The UIMA framework detects (unless disabled, for high performance) updates to indexed FS which update key values used as keys in indexes.private static boolean
trace
private static java.lang.String
TRACE_FSS
static boolean
traceCow
private static java.lang.String
traceFile
static boolean
traceFSs
private static java.io.PrintStream
traceOut
static int
TRUE
private TypeSystemImpl
tsi_local
Copies of frequently accessed data pulled up for locality of reference - only an optimization - each value needs to be reset appropriately - getters check for null, and if null, do the get.-
Fields inherited from interface org.apache.uima.cas.CAS
DEFAULT_LANGUAGE_NAME, FEATURE_BASE_NAME_BEGIN, FEATURE_BASE_NAME_END, FEATURE_BASE_NAME_FS_ARRAY, FEATURE_BASE_NAME_HEAD, FEATURE_BASE_NAME_INT_ARRAY, FEATURE_BASE_NAME_LANGUAGE, FEATURE_BASE_NAME_SOFA, FEATURE_BASE_NAME_SOFAARRAY, FEATURE_BASE_NAME_SOFAID, FEATURE_BASE_NAME_SOFAMIME, FEATURE_BASE_NAME_SOFANUM, FEATURE_BASE_NAME_SOFASTRING, FEATURE_BASE_NAME_SOFAURI, FEATURE_BASE_NAME_TAIL, FEATURE_FULL_NAME_BEGIN, FEATURE_FULL_NAME_END, FEATURE_FULL_NAME_FLOAT_LIST_HEAD, FEATURE_FULL_NAME_FLOAT_LIST_TAIL, FEATURE_FULL_NAME_FS_LIST_HEAD, FEATURE_FULL_NAME_FS_LIST_TAIL, FEATURE_FULL_NAME_INTEGER_LIST_HEAD, FEATURE_FULL_NAME_INTEGER_LIST_TAIL, FEATURE_FULL_NAME_LANGUAGE, FEATURE_FULL_NAME_SOFA, FEATURE_FULL_NAME_SOFAARRAY, FEATURE_FULL_NAME_SOFAID, FEATURE_FULL_NAME_SOFAMIME, FEATURE_FULL_NAME_SOFANUM, FEATURE_FULL_NAME_SOFASTRING, FEATURE_FULL_NAME_SOFAURI, FEATURE_FULL_NAME_STRING_LIST_HEAD, FEATURE_FULL_NAME_STRING_LIST_TAIL, NAME_DEFAULT_SOFA, NAME_DEFAULT_TEXT_SOFA, NAME_SPACE_UIMA_CAS, NAME_SPACE_UIMA_TCAS, SOFA_INDEX_NAME, STD_ANNOTATION_INDEX, TYPE_NAME_ANNOTATION, TYPE_NAME_ANNOTATION_BASE, TYPE_NAME_ARRAY_BASE, TYPE_NAME_BOOLEAN, TYPE_NAME_BOOLEAN_ARRAY, TYPE_NAME_BYTE, TYPE_NAME_BYTE_ARRAY, TYPE_NAME_DOCUMENT_ANNOTATION, TYPE_NAME_DOUBLE, TYPE_NAME_DOUBLE_ARRAY, TYPE_NAME_EMPTY_FLOAT_LIST, TYPE_NAME_EMPTY_FS_LIST, TYPE_NAME_EMPTY_INTEGER_LIST, TYPE_NAME_EMPTY_STRING_LIST, TYPE_NAME_FLOAT, TYPE_NAME_FLOAT_ARRAY, TYPE_NAME_FLOAT_LIST, TYPE_NAME_FS_ARRAY, TYPE_NAME_FS_LIST, TYPE_NAME_INTEGER, TYPE_NAME_INTEGER_ARRAY, TYPE_NAME_INTEGER_LIST, TYPE_NAME_LIST_BASE, TYPE_NAME_LONG, TYPE_NAME_LONG_ARRAY, TYPE_NAME_NON_EMPTY_FLOAT_LIST, TYPE_NAME_NON_EMPTY_FS_LIST, TYPE_NAME_NON_EMPTY_INTEGER_LIST, TYPE_NAME_NON_EMPTY_STRING_LIST, TYPE_NAME_SHORT, TYPE_NAME_SHORT_ARRAY, TYPE_NAME_SOFA, TYPE_NAME_STRING, TYPE_NAME_STRING_ARRAY, TYPE_NAME_STRING_LIST, TYPE_NAME_TOP, UIMA_CAS_PREFIX, UIMA_TCAS_PREFIX
-
Fields inherited from interface org.apache.uima.cas.impl.LowLevelCAS
NULL_FS_REF, TYPE_CLASS_BOOLEAN, TYPE_CLASS_BOOLEANARRAY, TYPE_CLASS_BYTE, TYPE_CLASS_BYTEARRAY, TYPE_CLASS_DOUBLE, TYPE_CLASS_DOUBLEARRAY, TYPE_CLASS_FLOAT, TYPE_CLASS_FLOATARRAY, TYPE_CLASS_FS, TYPE_CLASS_FSARRAY, TYPE_CLASS_INT, TYPE_CLASS_INTARRAY, TYPE_CLASS_INVALID, TYPE_CLASS_LONG, TYPE_CLASS_LONGARRAY, TYPE_CLASS_SHORT, TYPE_CLASS_SHORTARRAY, TYPE_CLASS_STRING, TYPE_CLASS_STRINGARRAY
-
Fields inherited from interface org.apache.uima.cas.impl.TypeSystemConstants
annotBaseSofaFeatAdjOffset, annotBaseSofaFeatCode, annotBaseTypeCode, annotTypeCode, arrayBaseTypeCode, beginFeatAdjOffset, beginFeatCode, booleanArrayTypeCode, booleanTypeCode, byteArrayTypeCode, byteTypeCode, docTypeCode, doubleArrayTypeCode, doubleTypeCode, endFeatAdjOffset, endFeatCode, floatArrayTypeCode, floatEListTypeCode, floatListTypeCode, floatNeListTypeCode, floatTypeCode, fsArrayTypeCode, fsEListTypeCode, fsListTypeCode, fsNeListTypeCode, intArrayTypeCode, intEListTypeCode, intListTypeCode, intNeListTypeCode, intTypeCode, langFeatAdjOffset, langFeatCode, longArrayTypeCode, longTypeCode, shortArrayTypeCode, shortTypeCode, sofaArrayFeatAdjOffset, sofaArrayFeatCode, sofaIdFeatAdjOffset, sofaIdFeatCode, sofaMimeFeatAdjOffset, sofaMimeFeatCode, sofaNumFeatAdjOffset, sofaNumFeatCode, sofaStringFeatAdjOffset, sofaStringFeatCode, sofaTypeCode, sofaUriFeatAdjOffset, sofaUriFeatCode, stringArrayTypeCode, stringEListTypeCode, stringListTypeCode, stringNeListTypeCode, stringTypeCode, topTypeCode
-
-
Constructor Summary
Constructors Constructor Description CASImpl()
CASImpl(CASImpl cas, SofaFS aSofa)
CASImpl(CASMgrSerializer ser)
CASImpl(TypeSystemImpl typeSystem, int initialHeapSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description (package private) void
addbackModifiedFSs(FSsTobeAddedback addbacks)
This design is to support normal operations where the addbacks could be nested It also handles cases where nested ones were inadvertently left open Three cases: 1) the addbacks are the last element in the stack - remove it from the stack 2) the addbacks are (no longer) in the list - leave stack alone 3) the addbacks are in the list but not at the end - remove it and all later ones, calling addback on each If the "withProtectedindexes" approach is used, it guarantees proper nesting, but the Runnable can't throw checked exceptions.(package private) void
addbackSingle(TOP fs)
(package private) void
addbackSingleIfWasRemoved(boolean wasRemoved, TOP fs)
void
addFsToIndexes(FeatureStructure fs)
Add a feature structure to all appropriate indexes in the repository associated with this CAS View.(package private) void
addSofaFsToIndex(SofaFS sofa)
(package private) void
addSofaViewName(java.lang.String id)
void
adjustLastFsV2Size_arrays(int arrayLength)
void
adjustLastFsV2size_nonHeapStoredArrays()
private void
assertTypeBelongsToCasTypesystem(TypeImpl ti)
void
captureLastFsIdForOtherThread()
Call this to capture the current value of fsIdGenerator and make it available to other threads.void
checkArrayBounds(int fsRef, int pos)
void
checkArrayBounds(int arrayLength, int pos, int length)
void
checkArrayPreconditions(int len)
private void
checkFeature(int featureCode)
private boolean
checkForInvalidFeatureSetting(TOP fs, int featCode)
This is the method all normal FS feature "setters" call before doing the set operation on values where the range could be used as an index key.(package private) boolean
checkForInvalidFeatureSetting(TOP fs, int featCode, FSsTobeAddedback toBeAdded)
version for deserializers, and for set document language, using their own store for toBeAdded Doesn't report updating of corruptable slots.(package private) boolean
checkForInvalidFeatureSetting(TOP fs, FSsTobeAddedback toBeAdded)
version for deserializers, using their own store for toBeAdded and not bothering to check for particular features Doesn't report updating of corruptable slots.private boolean
checkForInvalidFeatureSetting2(TOP fs)
private void
checkFsRan(FeatureImpl fi)
Validate a feature's range is a ref to a feature structureprivate void
checkFsRefConditions(int fsRef, int featureCode)
private void
checkInternalCodes(CASMgrSerializer ser)
private void
checkLowLevelParams(TOP fs, TypeImpl domType, int featCode)
private void
checkNonArrayConditions(int fsRef, int featureCode)
Check that the fsRef is valid.private void
checkPrimitiveArrayConditions(int fsRef, int typeCode, int position)
private void
checkTypeHasFeature(TypeImpl domainType, int featureCode)
Check that the featCode is a feature of the domain typeprivate void
checkTypeHasFeature(TypeImpl domainType, FeatureImpl feature)
void
checkTypingConditions(Type domType, Type ranType, Feature feat)
Check the range is appropriate for this type/feature.boolean
clearCasState(CasState state)
java.util.Collection<?>
collectNonPearVersions(java.util.Collection<?> c)
void
commitFS(FeatureStructure fs)
Deprecated.TypeSystemImpl
commitTypeSystem()
TypeSystemImpl
commitTypeSystem(boolean skip_loading_user_jcas)
boolean
containsCasState(CasState state)
static CommonArrayFS
copyArray(TOP srcArray)
static boolean
copyFeatureExceptFsRef(TOP fsSrc, FeatureImpl fiSrc, TOP fsTgt, FeatureImpl fiTgt)
Copies a feature from one fs to another FSs may be in different type systems Doesn't copy a feature ref, but instead returns false.Annotation
createAnnotation(Type type, int begin, int end)
Create a new annotation.TOP
createArray(TypeImpl array_type, int arrayLength)
ArrayFS
createArrayFS(int length)
Create a new feature structure array.private ArrayFS
createArrayFS(TypeImpl type, int length)
BooleanArrayFS
createBooleanArrayFS(int length)
Create a new Boolean array.ByteArrayFS
createByteArrayFS(int length)
Create a new Byte array.private <T extends AnnotationFS>
TcreateDocumentAnnotation(int length)
private <T extends Annotation>
TcreateDocumentAnnotationNoRemove(int length)
<T extends Annotation>
TcreateDocumentAnnotationNoRemoveNoIndex(int length)
DoubleArrayFS
createDoubleArrayFS(int length)
Create a new Double array.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 cons)
Create an iterator over structures satisfying a given constraint.FloatArrayFS
createFloatArrayFS(int length)
Create a new int array.<T extends TOP>
TcreateFS(int id)
This is your link from the low-level API to the high-level API.<T extends FeatureStructure>
TcreateFS(Type type)
Create the appropriate Feature Structure Java instance - from whatever the generator for this type specifies.private <T extends FeatureStructureImplC>
TcreateFSAnnotCheck(TypeImpl ti)
private TOP
createFsFromGenerator(FsGenerator3[] gs, TypeImpl ti)
private TOP
createFsWithExistingId(TypeImpl ti, int id)
used for ll_setIntValue which changes type codeprivate void
createIndexRepository()
(package private) Sofa
createInitialSofa(java.lang.String mimeType)
IntArrayFS
createIntArrayFS(int length)
Create a new int array.LongArrayFS
createLongArrayFS(int length)
Create a new Long array.Marker
createMarker()
The current implementation only supports 1 marker call per CAS.ShortArrayFS
createShortArrayFS(int length)
Create a new Short array.(package private) Sofa
createSofa(int sofaNum, java.lang.String sofaName, java.lang.String mimeType)
(package private) Sofa
createSofa(java.lang.String sofaName, java.lang.String mimeType)
SofaFS
createSofa(SofaID sofaID, java.lang.String mimeType)
Deprecated.StringArrayFS
createStringArrayFS(int length)
Create a new String array.int
createTempArray(int type, int len)
(for backwards compatibility with V2 CASImpl) Create a temporary (i.e., per document) array FS on the heap.CAS
createView(java.lang.String aSofaID)
Create a view and its underlying Sofa (subject of analysis).void
deltaMergesComplete()
A space-freeing optimization for use cases where (multiple) delta CASes are being deserialized into this CAS and merged.private boolean
doCorruptReport()
private boolean
doInvalidFeatSettingCheck(TOP fs)
static long
double2long(double d)
(package private) void
dropProtectIndexesLevel()
CommonArrayFS
emptyArray(Type type)
BooleanArray
emptyBooleanArray()
ByteArray
emptyByteArray()
DoubleArray
emptyDoubleArray()
FloatArray
emptyFloatArray()
EmptyFloatList
emptyFloatList()
<T extends FeatureStructure>
FSArray<T>emptyFSArray()
<T extends FeatureStructure>
FSArray<T>emptyFSArray(Type type)
<T extends TOP>
EmptyFSList<T>emptyFSList()
IntegerArray
emptyIntegerArray()
EmptyIntegerList
emptyIntegerList()
EmptyList
emptyList(int rangeCode)
EmptyList
emptyListFromTypeCode(int typeCode)
Get an empty list from the type code of a listLongArray
emptyLongArray()
ShortArray
emptyShortArray()
StringArray
emptyStringArray()
EmptyStringList
emptyStringList()
void
enableReset(boolean flag)
Enable/disable resetting the CAS withCAS.reset()
.private void
errorMultipleMarkers()
private void
featModWhileInIndexReport(FeatureStructure fs, int featCode)
private void
featModWhileInIndexReport(FeatureStructure fs, FeatureImpl fi)
(package private) void
featureCodes_inIndexKeysAdd(int featCode)
(package private) static java.util.List<TOP>
filterAboveMark(java.util.List<TOP> all, MarkerImpl mark)
static int
float2int(float f)
void
flush()
Deprecated.Usereset()
instead.(package private) void
forAllIndexRepos(java.util.function.Consumer<FSIndexRepositoryImpl> processIr)
Excludes base view's ir, Includes the initial view's ir only if it has a sofa defined(package private) void
forAllSofas(java.util.function.Consumer<Sofa> processSofa)
void
forAllViews(java.util.function.Consumer<CASImpl> processViews)
iterate over all views in view order (by view number)<T extends FeatureStructure>
java.util.ListIterator<T>fs2listIterator(FSIterator<T> it)
Wrap a standard JavaListIterator
around an FSListIterator.private FSsTobeAddedback
getAddback(int size)
(package private) FSsTobeAddedback.FSsTobeAddedbackSingle
getAddbackSingle()
<T extends AnnotationFS>
AnnotationIndex<T>getAnnotationIndex()
The generic spec T extends AnnotationFS (rather than AnnotationFS) allows the method JCasImpl getAnnotationIndex to return Annotation instead of AnnotationFS<T extends AnnotationFS>
AnnotationIndex<T>getAnnotationIndex(Type type)
Get the standard annotation index restricted to a specific annotation type.Type
getAnnotationType()
Get the type object for the annotation type.int
getArraySize(CommonArrayFS fs)
CASImpl
getBaseCAS()
(package private) <T extends TOP>
TgetBaseFsFromTrampoline(T fs)
Given a trampoline FS, return the corresponding base Fs Supports adding Fs (which must be a non-trampoline version) to indexes(package private) FSIndexRepository
getBaseIndexRepository()
(package private) FSIndexRepositoryImpl
getBaseIndexRepositoryImpl()
Feature
getBeginFeature()
Get the feature object for the annotation begin feature.BinaryCasSerDes
getBinaryCasSerDes()
CAS
getCAS()
Return a non-admin version of the CAS.java.lang.String
getCasId()
int
getCasResets()
private int
getCodeForLong(long s)
private int
getCodeForString(java.lang.String s)
ConstraintFactory
getConstraintFactory()
Get a constraint factory.(package private) CommonSerDesSequential
getCsds()
(package private) ComponentInfo
getCurrentComponentInfo()
MarkerImpl
getCurrentMark()
CAS
getCurrentView()
Get the Cas view that the current component should use.static java.lang.ThreadLocal<java.lang.Boolean>
getDefaultV2IdRefs()
private FSIterator<Annotation>
getDocAnnotIter()
<T extends AnnotationFS>
TgetDocumentAnnotation()
Generic issue: The returned document annotation could be either an instance of DocumentAnnotation or a subclass of it, or an instance of Annotation - the Java cover class used for annotations when JCas is not being used.<T extends AnnotationFS>
TgetDocumentAnnotationNoCreate()
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.Feature
getEndFeature()
Get the feature object for the annotation end feature.private FeatureImpl
getFeatFromCode_checked(int featureCode)
float
getFloatArrayValue(FloatArray array, int i)
FSClassRegistry
getFSClassRegistry()
<T extends TOP>
TgetFsFromId(int id)
<T extends TOP>
TgetFsFromId_checked(int fsRef)
private java.lang.String
geti2addr(int id)
(package private) Id2FS
getId2FSs()
FSIndexRepository
getIndexRepository()
Get the index repository.FSIndexRepositoryMgr
getIndexRepositoryMgr()
int
getInitialHeapSize()
(package private) CASImpl
getInitialView()
int
getIntArrayValue(IntegerArray array, int i)
JCas
getJCas()
Get the JCas view for this CAS viewJCas
getJCas(SofaFS aSofa)
Create a JCas view for a Sofa.JCas
getJCas(SofaID aSofaID)
Deprecated.java.lang.ClassLoader
getJCasClassLoader()
Gets the ClassLoader that should be used by the JCas to load the generated FS cover classes for this CAS.JCasImpl
getJCasImpl()
Get the JCasImpl view for this CAS viewint
getLastUsedFsId()
private java.lang.Long
getLongForCode(int i)
LowLevelCAS
getLowLevelCAS()
Get an instance of the low-level CAS.(package private) CASImpl.FsChange[]
getModifiedFSList()
int
getNextFsId(TOP fs)
int
getNumberOfSofas()
int
getNumberOfViews()
Creates the initial view (without a sofa) if not presentFeatureStructure
getRefArrayValue(FSArray array, int i)
Sofa
getSofa()
Get the Sofa feature structure associated with this CAS view.(package private) SofaFS
getSofa(int sofaRef)
private SofaFS
getSofa(java.lang.String sofaName)
SofaFS
getSofa(SofaID sofaID)
Deprecated.CASImpl
getSofaCasView(AnnotationBase fs)
FeatureStructure
getSofaDataArray()
Get the Sofa data array.java.io.InputStream
getSofaDataStream()
Get the Sofa data as a byte stream.java.io.InputStream
getSofaDataStream(SofaFS aSofa)
java.lang.String
getSofaDataString()
Get the Sofa Data String (a.k.a.java.lang.String
getSofaDataURI()
Get the Sofa data array.(package private) FSIndexRepositoryImpl
getSofaIndexRepository(int aSofaRef)
(package private) FSIndexRepository
getSofaIndexRepository(SofaFS aSofa)
<T extends SofaFS>
FSIterator<T>getSofaIterator()
Get iterator for all SofaFS in the CAS.java.lang.String
getSofaMimeType()
Get the mime type of the Sofa data being analyzed.Sofa
getSofaRef()
java.lang.String
getStringArrayValue(StringArray array, int i)
private java.lang.String
getStringForCode(int i)
private java.lang.String
getTraceRepOfObj(FeatureImpl fi, java.lang.Object v)
private TypeImpl
getTypeFromCode(int typeCode)
private TypeImpl
getTypeFromCode_checked(int typeCode)
TypeSystem
getTypeSystem()
Return the type system of this CAS instance.TypeSystemImpl
getTypeSystemImpl()
TypeSystemMgr
getTypeSystemMgr()
Return a writable version of the type system.CAS
getView(int sofaNum)
CAS
getView(java.lang.String aSofaID)
Get the view for a Sofa (subject of analysis).CASImpl
getView(SofaFS aSofa)
Get the view for a Sofa (subject of analysis).(package private) int
getViewCount()
java.util.Iterator<CASImpl>
getViewImplIterator()
excludes initial view if its sofa is not valid<T extends CAS>
java.util.Iterator<T>getViewIterator()
Get iterator over all views in this CAS.java.util.Iterator<CAS>
getViewIterator(java.lang.String localViewNamePrefix)
Get iterator over all views with the given name prefix.java.lang.String
getViewName()
Get the view name.(package private) boolean
hasView(java.lang.String name)
void
initCASIndexes()
Install the standard built-in indexes into the base CAS(package private) boolean
inPearContext()
(package private) void
installTypeSystemInAllViews(TypeSystemImpl ts)
Set the shared svd type system ref, in all viewsstatic float
int2float(int i)
boolean
is_ll_enableV2IdRefs()
(package private) boolean
is_readable()
(package private) boolean
is_updatable()
boolean
isAbstractArrayType(Type type)
boolean
isAnnotationType(Type t)
boolean
isArrayType(Type type)
boolean
isBackwardCompatibleCas()
boolean
isBaseCas()
boolean
isBooleanArrayType(Type type)
boolean
isBooleanType(Type type)
boolean
isByteArrayType(Type type)
boolean
isByteType(Type type)
boolean
isCasLocked()
boolean
isDoubleArrayType(Type type)
boolean
isDoubleType(Type type)
boolean
isFloatArrayType(Type type)
boolean
isFloatType(Type type)
boolean
isFSArrayType(Type type)
boolean
isId2Fs()
boolean
isInCAS(FeatureStructure fs)
(package private) boolean
isInitialSofaCreated()
(package private) boolean
isInModifiedPreexisting(TOP fs)
boolean
isIntArrayType(Type type)
boolean
isIntType(Type type)
boolean
isLogging()
boolean
isLoggingNeeded(FeatureStructureImplC fs)
boolean
isLongArrayType(Type type)
boolean
isLongType(Type type)
boolean
isPrimitiveArrayType(Type type)
static boolean
isSameCAS(CAS c1, CAS c2)
boolean
isShortArrayType(Type type)
boolean
isShortType(Type type)
boolean
isStringArrayType(Type type)
boolean
isStringType(Type type)
boolean
isSubtypeOfAnnotationBaseType(int t)
int
lastV2IdIncr()
int
ll_copyCharBufferValue(int fsRef, int featureCode, char[] buffer, int start)
int
ll_createAnnotation(int typeCode, int begin, int end)
int
ll_createArray(int typeCode, int arrayLength)
Create a new array.int
ll_createArray(int typeCode, int arrayLength, boolean doChecks)
Create a new array.int
ll_createBooleanArray(int arrayLength)
int
ll_createByteArray(int arrayLength)
int
ll_createDocumentAnnotation(int length)
int
ll_createDocumentAnnotationNoIndex(int begin, int end)
int
ll_createDoubleArray(int arrayLength)
int
ll_createFS(int typeCode)
Create a new FS on the heap.int
ll_createFS(int typeCode, boolean doCheck)
Create a new FS on the heap.int
ll_createLongArray(int arrayLength)
int
ll_createShortArray(int arrayLength)
AutoCloseableNoException
ll_enableV2IdRefs(boolean enable)
Enables or disables the id_to_fs_map mode.(package private) AutoCloseableNoException
ll_forceEnableV2IdRefs(boolean enable)
int
ll_getArraySize(int id)
Get the size of an array.boolean
ll_getBooleanArrayValue(int fsRef, int position)
boolean
ll_getBooleanArrayValue(int fsRef, int position, boolean doTypeChecks)
boolean
ll_getBooleanValue(int fsRef, int featureCode)
boolean
ll_getBooleanValue(int fsRef, int featureCode, boolean doTypeChecks)
byte
ll_getByteArrayValue(int fsRef, int position)
byte
ll_getByteArrayValue(int fsRef, int position, boolean doTypeChecks)
byte
ll_getByteValue(int fsRef, int featureCode)
byte
ll_getByteValue(int fsRef, int featureCode, boolean doTypeChecks)
int
ll_getCharBufferValueSize(int fsRef, int featureCode)
int
ll_getDocumentAnnotation()
double
ll_getDoubleArrayValue(int fsRef, int position)
double
ll_getDoubleArrayValue(int fsRef, int position, boolean doTypeChecks)
double
ll_getDoubleValue(int fsRef, int featureCode)
double
ll_getDoubleValue(int fsRef, int featureCode, boolean doTypeChecks)
float
ll_getFloatArrayValue(int fsRef, int position)
Get the value of a float array at a certain position.float
ll_getFloatArrayValue(int fsRef, int position, boolean doTypeChecks)
Get the value of a float array at a certain position.float
ll_getFloatValue(int fsRef, int featureCode)
Get the value of a float valued feature.float
ll_getFloatValue(int fsRef, int featureCode, boolean doTypeChecks)
Get the value of a float valued feature.<T extends TOP>
Tll_getFSForRef(int id)
Return a FS object that corresponds to a low-level reference.int
ll_getFSRef(FeatureStructure fs)
Safety - any time the low level API to a FS is requested, hold on to that FS until CAS reset to mimic how v2 works.int
ll_getFSRefType(int fsRef)
Get the type code for a FS reference.int
ll_getFSRefType(int fsRef, boolean doChecks)
Get the type code for a FS reference.LowLevelIndexRepository
ll_getIndexRepository()
Get the low-level version of the index repository.int
ll_getIntArrayValue(int fsRef, int position)
Get the value of an array at a certain position.int
ll_getIntArrayValue(int fsRef, int position, boolean doTypeChecks)
Get the value of an integer array at a certain position.int
ll_getIntValue(int fsRef, int featureCode)
Handle some unusual backwards compatibility cases featureCode = 0 - implies getting the type code feature range is int - normal feature range is a fs reference, return the id feature range is a string: add the string if not already present to the string heap, return the int handle.int
ll_getIntValue(int fsRef, int featureCode, boolean doTypeChecks)
Get the value of an integer valued feature.long
ll_getLongArrayValue(int fsRef, int position)
long
ll_getLongArrayValue(int fsRef, int position, boolean doTypeChecks)
long
ll_getLongValue(int fsRef, int featureCode)
long
ll_getLongValue(int fsRef, int featureCode, boolean doTypeChecks)
int
ll_getRefArrayValue(int fsRef, int position)
Get the value of a FS reference array at a certain position.int
ll_getRefArrayValue(int fsRef, int position, boolean doTypeChecks)
Get the value of a FS reference array at a certain position.int
ll_getRefValue(int fsRef, int featureCode)
Get the value of a FS reference valued feature.int
ll_getRefValue(int fsRef, int featureCode, boolean doTypeChecks)
Get the value of a FS reference valued feature.short
ll_getShortArrayValue(int fsRef, int position)
short
ll_getShortArrayValue(int fsRef, int position, boolean doTypeChecks)
short
ll_getShortValue(int fsRef, int featureCode)
short
ll_getShortValue(int fsRef, int featureCode, boolean doTypeChecks)
int
ll_getSofa()
CASImpl
ll_getSofaCasView(int id)
java.lang.String
ll_getSofaDataString(int sofaAddr)
java.lang.String
ll_getSofaID(int sofaRef)
int
ll_getSofaNum(int sofaRef)
java.lang.String
ll_getStringArrayValue(int fsRef, int position)
Get the value of a string array at a certain position.java.lang.String
ll_getStringArrayValue(int fsRef, int position, boolean doTypeChecks)
Get the value of a string array at a certain position.java.lang.String
ll_getStringValue(int fsRef, int featureCode)
Get the value of a string valued feature.java.lang.String
ll_getStringValue(int fsRef, int featureCode, boolean doTypeChecks)
Get the value of a string valued feature.int
ll_getTypeClass(int typeCode)
Determine the type class of a type.LowLevelTypeSystem
ll_getTypeSystem()
Get the low-level version of the type system object.boolean
ll_isRefType(int typeCode)
Checks if the type code is that of a reference type (anything that's not a basic type, currently Integer, String and Float).void
ll_setBooleanArrayValue(int fsRef, int position, boolean b)
void
ll_setBooleanArrayValue(int fsRef, int position, boolean value, boolean doTypeChecks)
void
ll_setBooleanValue(int fsRef, int featureCode, boolean value)
void
ll_setBooleanValue(int fsRef, int featureCode, boolean value, boolean doTypeChecks)
void
ll_setByteArrayValue(int fsRef, int position, byte value)
void
ll_setByteArrayValue(int fsRef, int position, byte value, boolean doTypeChecks)
void
ll_setByteValue(int fsRef, int featureCode, byte value)
void
ll_setByteValue(int fsRef, int featureCode, byte value, boolean doTypeChecks)
void
ll_setCharBufferValue(int fsRef, int featureCode, char[] buffer, int start, int length)
void
ll_setCharBufferValue(int fsRef, int featureCode, char[] buffer, int start, int length, boolean doTypeChecks)
void
ll_setDoubleArrayValue(int fsRef, int position, double d)
void
ll_setDoubleArrayValue(int fsRef, int position, double value, boolean doTypeChecks)
void
ll_setDoubleValue(int fsRef, int featureCode, double value)
void
ll_setDoubleValue(int fsRef, int featureCode, double value, boolean doTypeChecks)
void
ll_setFloatArrayValue(int fsRef, int position, float value)
Set the value of an integer array at a certain position.void
ll_setFloatArrayValue(int fsRef, int position, float value, boolean doTypeChecks)
Set the value of an integer array at a certain position.void
ll_setFloatValue(int fsRef, int featureCode, float value)
Set the value of a float feature.void
ll_setFloatValue(int fsRef, int featureCode, float value, boolean doTypeChecks)
Set the value of a float feature.void
ll_setIntArrayValue(int fsRef, int position, int value)
Set the value of an integer array at a certain position.void
ll_setIntArrayValue(int fsRef, int position, int value, boolean doTypeChecks)
Set the value of an integer array at a certain position.void
ll_setIntValue(int fsRef, int featureCode, int value)
Special considerations: Interface with corruption checking For backwards compatibility: handle cases where feature is: int - normal 0 - change type code a ref: treat int as FS "addr" not an int: handle like v2 where reasonablevoid
ll_setIntValue(int fsRef, int featureCode, int value, boolean doTypeChecks)
Set the value of an integer feature.void
ll_setLongArrayValue(int fsRef, int position, long value)
void
ll_setLongArrayValue(int fsRef, int position, long value, boolean doTypeChecks)
void
ll_setLongValue(int fsRef, int featureCode, long value)
void
ll_setLongValue(int fsRef, int featureCode, long value, boolean doTypeChecks)
void
ll_setRefArrayValue(int fsRef, int position, int value)
Set the value of an integer array at a certain position.void
ll_setRefArrayValue(int fsRef, int position, int value, boolean doTypeChecks)
Set the value of an integer array at a certain position.void
ll_setRefValue(int fsRef, int featureCode, int value)
Set the value of a FS reference feature.void
ll_setRefValue(int fsRef, int featureCode, int value, boolean doTypeChecks)
Set the value of a FS reference feature.void
ll_setShortArrayValue(int fsRef, int position, short value)
void
ll_setShortArrayValue(int fsRef, int position, short value, boolean doTypeChecks)
void
ll_setShortValue(int fsRef, int featureCode, short value)
void
ll_setShortValue(int fsRef, int featureCode, short value, boolean doTypeChecks)
void
ll_setStringArrayValue(int fsRef, int position, java.lang.String value)
Set the value of an integer array at a certain position.void
ll_setStringArrayValue(int fsRef, int position, java.lang.String value, boolean doTypeChecks)
Set the value of an integer array at a certain position.void
ll_setStringValue(int fsRef, int featureCode, java.lang.String value)
Set the value of a string feature.void
ll_setStringValue(int fsRef, int featureCode, java.lang.String value, boolean doTypeChecks)
Set the value of a string feature.private void
logFSUpdate(TOP fs, FeatureImpl fi)
private void
logFSUpdate(TOP fs, FeatureImpl fi, int arrayIndexStart, int nbrOfConsecutive)
private void
logFSUpdate(TOP fs, PositiveIntSet indexesPlus1)
static double
long2double(long l)
<T> java.util.Spliterator<T>
makePearAware(java.util.Spliterator<T> baseSi)
void
maybeAddback(TOP fs)
Only called if there was something removed that needs to be added back skip the addback (to defer it until later) if: - running in block mode (you can tell this if svd.fssTobeAddedback.size() > 0) or if running in block mode, the add back is delayed until the end of the block(package private) void
maybeHoldOntoFS(FeatureStructureImplC fs)
void
maybeLogArrayUpdate(FeatureStructureImplC fs, FeatureImpl feat, int i)
void
maybeLogArrayUpdates(FeatureStructureImplC fs, int startingIndex, int length)
void
maybeLogArrayUpdates(FeatureStructureImplC fs, PositiveIntSet indexesPlus1)
void
maybeLogUpdate(FeatureStructureImplC fs, int featCode)
void
maybeLogUpdate(FeatureStructureImplC fs, FeatureImpl feat)
(package private) boolean
maybeMakeBaseVersionForPear(FeatureStructureImplC fs, TypeImpl ti)
Called during construction of FS.private boolean
mySofaIsValid()
(package private) CommonSerDesSequential
newCsds()
private TOP
pearConvert(TOP fs, FsGenerator3 g)
Inner method - after determining there is a generator First see if already have generated the pear version, and if so, use that.(package private) static <T extends FeatureStructure>
TpearConvert(T aFs)
Convert base FS to Pear equivalent 3 cases: 1) no trampoline needed, no conversion, return the original fs 2) trampoline already exists - return that one 3) create new trampolineint
peekNextFsId()
AutoCloseableNoException
protectIndexes()
protectIndexes Within the scope of protectIndexes, feature updates are checked, and if found to be a key, and the FS is in a corruptible index, then the FS is removed from the indexes (in all necessary views) (perhaps multiple times if the FS was added to the indexes multiple times), and this removal is recorded on an new instance of FSsTobeReindexed appended to fssTobeAddedback.void
protectIndexes(java.lang.Runnable r)
Runs the code in the runnable inside a protection block, where any modifications to features done while in this block will be done in a way to protect any indexes which otherwise might become corrupted by the update action; the protection is achieved by temporarily removing the FS (if it is in the indexes), before the update happens.(package private) void
refreshView(CAS cas, SofaFS aSofa)
(package private) void
registerInitialSofa()
(package private) void
registerView(Sofa aSofa)
SerialFormat
reinit(java.io.InputStream istream)
--------------------------------------------------------------------- see Blob Format in CASSerializer This reads in and deserializes CAS data from a stream.void
reinit(CASCompleteSerializer casCompSer)
Deserializer for CASCompleteSerializer instances - includes type system and index definitions Never deltavoid
reinit(CASSerializer ser)
Deserializer for Java-object serialized instance of CASSerializer.void
release()
Default implementation that returns this CAS to its CasManager by callingCasOwner.releaseCas(AbstractCas)
.private boolean
removeAndRecord(TOP fs, FSIndexRepositoryImpl ir, FSsTobeAddedback toBeAdded, boolean isSkipBagIndex)
remove a FS from all indexes in this view (except bag indexes, if isSkipBagIndex is true)(package private) boolean
removeFromCorruptableIndexAnyView(TOP fs, FSsTobeAddedback toBeAdded)
(package private) boolean
removeFromIndexAnyView(TOP fs, FSsTobeAddedback toBeAdded, boolean isSkipBagIndexes)
This might be called from low level set int value, if we support switching types, and we want to remove the old type from all indexes.void
removeFsFromIndexes(FeatureStructure fs)
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
resetNoQuestions()
void
restoreClassLoaderUnlockCas()
private void
restorePearContext()
void
set_deserialized_doc_annot_not_indexed(Annotation doc_annot)
(package private) void
set_id2fs(TOP fs)
(package private) void
set_reuseId(int id)
void
setCAS(CAS cas)
Deprecated.boolean
setCasState(CasState state)
boolean
setCasState(CasState state, java.lang.Thread thread)
(package private) void
setCsds(CommonSerDesSequential csds)
void
setCurrentComponentInfo(ComponentInfo info)
Informs the CAS of relevant information about the component that is currently processing it.(package private) void
setDocTextFromDeserializtion(java.lang.String text)
void
setDocumentLanguage(java.lang.String languageCode)
Sets the language for this document.void
setDocumentText(java.lang.String text)
Set the document text.(package private) void
setFeatureValue(int fsRef, int featureCode, TOP value)
static void
setFeatureValueFromString(FeatureStructureImplC fs, FeatureImpl feat, java.lang.String s)
Supports setting slots to "0" for null valuesstatic void
setFeatureValueFromStringNoDocAnnotUpdate(FeatureStructureImplC fs, FeatureImpl feat, java.lang.String s)
Internal use, for cases where deserializing - special case setting sofString to skip updating the document annotationstatic void
setFeatureValueMaybeSofa(TOP fs, FeatureImpl feat, TOP value)
internal use - special setter for setting feature values, including special handling if the feature is for the sofaArray, when deserializingprivate void
setId2FsMaybeUnconditionally(TOP fs)
void
setId2FSsMaybeUnconditionally(FeatureStructure... fss)
Test case usevoid
setJCasClassLoader(java.lang.ClassLoader classLoader)
Sets the ClassLoader that should be used by the JCas to load the generated FS cover classes for this CAS.(package private) void
setLastFsV2Size(int size)
(package private) void
setLastUsedFsId(int id)
void
setLongValue(FeatureStructureImplC fsIn, FeatureImpl feat, long v)
version for longs, uses two slots Only called from FeatureStructureImplC after determining there is no local field to use Is here because of 3 calls to things in this classvoid
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.(package private) void
setSofaIndexRepository(int aSofaRef, FSIndexRepositoryImpl indxRepos)
(package private) void
setSofaIndexRepository(SofaFS aSofa, FSIndexRepositoryImpl indxRepos)
private void
setSofaThingsMime(java.util.function.Consumer<Sofa> c, java.lang.String msg)
(package private) void
setViewCount(int n)
void
setWithCheckAndJournal(TOP fs, int featCode, java.lang.Runnable setter)
(package private) void
setWithCheckAndJournal(TOP fs, FeatureImpl fi, java.lang.Runnable setter)
void
setWithJournal(FeatureStructureImplC fs, FeatureImpl fi, java.lang.Runnable setter)
This method called by setters in JCas gen'd classes when the setter must check for journalingint
size()
Estimate the memory consumption of this CAS instance (in bytes).private void
suspendPearContext()
Pear context suspended while creating a base version, when we need to create a new FS (we need to create both the base and the trampoline version)void
swapInPearVersion(java.lang.Object[] a)
void
switchClassLoader(java.lang.ClassLoader newClassLoader, boolean wasLocked)
void
switchClassLoaderLockCas(java.lang.Object userCode)
void
switchClassLoaderLockCasCL(java.lang.ClassLoader newClassLoader)
private void
switchFsType(TOP fs, int value)
private void
throwAccessTypeError(int fsRef, int typeCode)
java.lang.String
toString()
(package private) void
traceCowCopy(FsIndex_singletype<?> index)
(package private) void
traceCowCopyUse(FsIndex_singletype<?> index)
(package private) void
traceCowReinit(java.lang.String kind, FsIndex_singletype<?> index)
void
traceFSCreate(FeatureStructureImplC fs)
(package private) void
traceFSfeat(FeatureStructureImplC fs, FeatureImpl fi, java.lang.Object v)
(package private) void
traceFSfeatUpdate(FeatureStructureImplC fs)
java.lang.StringBuilder
traceFSflush()
(package private) void
traceFSfs(FeatureStructureImplC fs)
(package private) void
traceIndexMod(boolean isAdd, TOP fs, boolean isAddbackOrSkipBag)
void
updateDocumentAnnotation()
updates the document annotation (only if the sofa's local string data != null) setting the end feature to be the length of the sofa string, if any.void
validateArraySize(int length)
private void
verifySofaNameUniqueIfDeserializedViewAdded(int sofaNbr, SofaFS aSofa)
java.util.List<TOP>
walkReachablePlusFSsSorted(java.util.function.Consumer<TOP> action_filtered, MarkerImpl mark, java.util.function.Predicate<TOP> includeFilter, CasTypeSystemMapper typeMapper)
find all of the FSs via the indexes plus what's reachable.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.uima.cas.CAS
emptyArray, emptyList, getAllIndexedFS, getAllIndexedFS, getAnnotationIndex, getCasType, getIndexedFSs, getIndexedFSs, getIndexedFSs, select, select, select, select, select
-
Methods inherited from interface org.apache.uima.cas.impl.LowLevelCAS
ll_enableV2IdRefs
-
-
-
-
Field Detail
-
DISABLE_SUBTYPE_FSARRAY_CREATION
private static final java.lang.String DISABLE_SUBTYPE_FSARRAY_CREATION
- See Also:
- Constant Field Values
-
IS_DISABLE_SUBTYPE_FSARRAY_CREATION
static final boolean IS_DISABLE_SUBTYPE_FSARRAY_CREATION
-
TRACE_FSS
private static final java.lang.String TRACE_FSS
- See Also:
- Constant Field Values
-
trace
private static final boolean trace
- See Also:
- Constant Field Values
-
traceFSs
public static final boolean traceFSs
-
traceCow
public static final boolean traceCow
- See Also:
- Constant Field Values
-
traceFile
private static final java.lang.String traceFile
- See Also:
- Constant Field Values
-
traceOut
private static final java.io.PrintStream traceOut
-
MEASURE_SETINT
private static final boolean MEASURE_SETINT
- See Also:
- Constant Field Values
-
casIdProvider
static final java.util.concurrent.atomic.AtomicInteger casIdProvider
-
NULL
public static final int NULL
- See Also:
- Constant Field Values
-
TRUE
public static final int TRUE
- See Also:
- Constant Field Values
-
FALSE
public static final int FALSE
- See Also:
- Constant Field Values
-
DEFAULT_INITIAL_HEAP_SIZE
public static final int DEFAULT_INITIAL_HEAP_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_RESET_HEAP_SIZE
public static final int DEFAULT_RESET_HEAP_SIZE
- See Also:
- Constant Field Values
-
THROW_EXCEPTION_FS_UPDATES_CORRUPTS
public static final java.lang.String THROW_EXCEPTION_FS_UPDATES_CORRUPTS
The UIMA framework detects (unless disabled, for high performance) updates to indexed FS which update key values used as keys in indexes. Normally the framework will protect against index corruption by temporarily removing the FS from the indexes, then do the update to the feature value, and then addback the changed FS.Users can use the protectIndexes() methods to explicitly control this remove - add back cycle, for instance to "batch" together several updates to multiple features in a FS.
Some build processes may want to FAIL if any unprotected updates of this kind occur, instead of having the framework silently recover them. This is enabled by having the framework throw an exception; this is controlled by this global JVM property, which, if defined, causes the framework to throw an exception rather than recover.
- See Also:
- Constant Field Values
-
IS_THROW_EXCEPTION_CORRUPT_INDEX
public static boolean IS_THROW_EXCEPTION_CORRUPT_INDEX
-
REPORT_FS_UPDATES_CORRUPTS
public static final java.lang.String REPORT_FS_UPDATES_CORRUPTS
Define this JVM property to enable checking for invalid updates to features which are used as keys by any index.- The following are the same: -Duima.check_invalid_fs_updates and -Duima.check_invalid_fs_updates=true
- See Also:
- Constant Field Values
-
IS_REPORT_FS_UPDATE_CORRUPTS_INDEX
private static final boolean IS_REPORT_FS_UPDATE_CORRUPTS_INDEX
-
DISABLE_PROTECT_INDEXES
public static final java.lang.String DISABLE_PROTECT_INDEXES
Set this JVM property to false for high performance, (no checking); insure you don't have the report flag (above) turned on - otherwise it will force this to "true".- See Also:
- Constant Field Values
-
IS_DISABLED_PROTECT_INDEXES
private static final boolean IS_DISABLED_PROTECT_INDEXES
the protect indexes flag is on by default, but may be turned of via setting the property. This is overridden if a report is requested or the exception detection is on.
-
ALWAYS_HOLD_ONTO_FSS
public static final java.lang.String ALWAYS_HOLD_ONTO_FSS
- See Also:
- Constant Field Values
-
IS_ALWAYS_HOLD_ONTO_FSS
static final boolean IS_ALWAYS_HOLD_ONTO_FSS
-
defaultV2IdRefs
private static final java.lang.ThreadLocal<java.lang.Boolean> defaultV2IdRefs
-
svd
final CASImpl.SharedViewData svd
Non-shared instance data kept per CAS view incl base CAS
-
indexRepository
FSIndexRepositoryImpl indexRepository
The index repository. Referenced by XmiCasSerializer
-
mySofaRef
private Sofa mySofaRef
The Feature Structure for the sofa FS for this view, or null //-1 if the sofa FS is for the initial view, or // 0 if there is no sofa FS - for instance, in the "base cas"
-
jcas
JCasImpl jcas
the corresponding JCas object
-
tsi_local
private TypeSystemImpl tsi_local
Copies of frequently accessed data pulled up for locality of reference - only an optimization - each value needs to be reset appropriately - getters check for null, and if null, do the get.
-
pearBaseFs
FeatureStructureImplC pearBaseFs
for Pear generation - set this to the base FS not in SharedViewData to reduce object traversal when generating FSs
-
docAnnotIter
private volatile FSIterator<Annotation> docAnnotIter
Optimization - keep a documentAnnotationIterator handy for getting a ref to the doc annot Initialized lazily, synchronized One per cas view
-
deserialized_doc_annot_not_indexed
private volatile Annotation deserialized_doc_annot_not_indexed
-
strictTypeSourceCheckMessageCount
private static final java.util.concurrent.atomic.AtomicInteger strictTypeSourceCheckMessageCount
-
prevFi
private FeatureImpl prevFi
only used for tracing, enables tracing 2 slots for long/double
-
measureSwitches
private static final java.util.Map<CASImpl.MeasureSwitchType,CASImpl.MeasureSwitchType> measureSwitches
-
-
Constructor Detail
-
CASImpl
public CASImpl(TypeSystemImpl typeSystem, int initialHeapSize)
-
CASImpl
public CASImpl()
-
CASImpl
public CASImpl(CASMgrSerializer ser)
-
-
Method Detail
-
getDefaultV2IdRefs
public static java.lang.ThreadLocal<java.lang.Boolean> getDefaultV2IdRefs()
-
setCasState
public boolean setCasState(CasState state)
- Parameters:
state
- to add to the set- Returns:
- true if the set changed as a result of this operation
-
setCasState
public boolean setCasState(CasState state, java.lang.Thread thread)
- Parameters:
state
- to add to the setthread
- null or the thread to permit access to- Returns:
- true if the set changed as a result of this operation
-
containsCasState
public boolean containsCasState(CasState state)
- Parameters:
state
- to see if it is among the items in this set- Returns:
- true if the set contains that state
-
clearCasState
public boolean clearCasState(CasState state)
- Parameters:
state
- to be removed- Returns:
- true if it was present, and is now removed
-
is_updatable
boolean is_updatable()
-
is_readable
boolean is_readable()
-
isCasLocked
public boolean isCasLocked()
-
checkInternalCodes
private void checkInternalCodes(CASMgrSerializer ser) throws CASAdminException
- Throws:
CASAdminException
-
isId2Fs
public boolean isId2Fs()
-
getId2FSs
Id2FS getId2FSs()
-
set_id2fs
void set_id2fs(TOP fs)
-
set_reuseId
void set_reuseId(int id)
-
setLastUsedFsId
void setLastUsedFsId(int id)
-
setLastFsV2Size
void setLastFsV2Size(int size)
-
addSofaViewName
void addSofaViewName(java.lang.String id)
-
setViewCount
void setViewCount(int n)
-
addbackSingle
void addbackSingle(TOP fs)
-
addbackSingleIfWasRemoved
void addbackSingleIfWasRemoved(boolean wasRemoved, TOP fs)
-
getAddback
private FSsTobeAddedback getAddback(int size)
-
getAddbackSingle
FSsTobeAddedback.FSsTobeAddedbackSingle getAddbackSingle()
-
featureCodes_inIndexKeysAdd
void featureCodes_inIndexKeysAdd(int featCode)
-
enableReset
public void enableReset(boolean flag)
Description copied from interface:CASMgr
Enable/disable resetting the CAS withCAS.reset()
.- Specified by:
enableReset
in interfaceCASMgr
- Parameters:
flag
- true to enable reset
-
getTypeSystem
public final TypeSystem getTypeSystem()
Description copied from interface:CAS
Return the type system of this CAS instance.- Specified by:
getTypeSystem
in interfaceCAS
- Returns:
- The type system, or
null
if none is available.
-
getTypeSystemImpl
public final TypeSystemImpl getTypeSystemImpl()
-
installTypeSystemInAllViews
void installTypeSystemInAllViews(TypeSystemImpl ts)
Set the shared svd type system ref, in all views- Parameters:
ts
-
-
getConstraintFactory
public ConstraintFactory getConstraintFactory()
Description copied from interface:CAS
Get a constraint factory. A constraint factory is a simple way of creatingFSMatchConstraints
.- Specified by:
getConstraintFactory
in interfaceCAS
- Returns:
- A constraint factory to create new FS constraints.
-
createFS
public <T extends FeatureStructure> T createFS(Type type)
Create the appropriate Feature Structure Java instance - from whatever the generator for this type specifies.
-
createFSAnnotCheck
private <T extends FeatureStructureImplC> T createFSAnnotCheck(TypeImpl ti)
-
assertTypeBelongsToCasTypesystem
private void assertTypeBelongsToCasTypesystem(TypeImpl ti)
-
maybeMakeBaseVersionForPear
boolean maybeMakeBaseVersionForPear(FeatureStructureImplC fs, TypeImpl ti)
Called during construction of FS. For normal FS "new" operators, if in PEAR context, make the base version- Parameters:
fs
-ti
-- Returns:
- true if made a base for a trampoline
-
createFsFromGenerator
private TOP createFsFromGenerator(FsGenerator3[] gs, TypeImpl ti)
-
createArrayFS
public ArrayFS createArrayFS(int length)
Description copied from interface:CAS
Create a new feature structure array.- Specified by:
createArrayFS
in interfaceCAS
- Parameters:
length
- The length of the array.- Returns:
- The new array.
-
createIntArrayFS
public IntArrayFS createIntArrayFS(int length)
Description copied from interface:CAS
Create a new int array.- Specified by:
createIntArrayFS
in interfaceCAS
- Parameters:
length
- The length of the array.- Returns:
- The new array.
-
createFloatArrayFS
public FloatArrayFS createFloatArrayFS(int length)
Description copied from interface:CAS
Create a new int array.- Specified by:
createFloatArrayFS
in interfaceCAS
- Parameters:
length
- The length of the array.- Returns:
- The new array.
-
createStringArrayFS
public StringArrayFS createStringArrayFS(int length)
Description copied from interface:CAS
Create a new String array.- Specified by:
createStringArrayFS
in interfaceCAS
- Parameters:
length
- The length of the array.- Returns:
- The new array.
-
isBackwardCompatibleCas
public boolean isBackwardCompatibleCas()
-
getViewCount
int getViewCount()
-
getSofaIndexRepository
FSIndexRepository getSofaIndexRepository(SofaFS aSofa)
-
getSofaIndexRepository
FSIndexRepositoryImpl getSofaIndexRepository(int aSofaRef)
-
setSofaIndexRepository
void setSofaIndexRepository(SofaFS aSofa, FSIndexRepositoryImpl indxRepos)
-
setSofaIndexRepository
void setSofaIndexRepository(int aSofaRef, FSIndexRepositoryImpl indxRepos)
-
createSofa
@Deprecated public SofaFS createSofa(SofaID sofaID, java.lang.String mimeType)
Deprecated.Description copied from interface:CAS
Create a Subject of Analysis. The new sofaFS is automatically added to the SofaIndex.- Specified by:
createSofa
in interfaceCAS
- Parameters:
sofaID
- -mimeType
- -- Returns:
- The sofaFS.
-
createSofa
Sofa createSofa(java.lang.String sofaName, java.lang.String mimeType)
-
createSofa
Sofa createSofa(int sofaNum, java.lang.String sofaName, java.lang.String mimeType)
-
hasView
boolean hasView(java.lang.String name)
-
createInitialSofa
Sofa createInitialSofa(java.lang.String mimeType)
-
registerInitialSofa
void registerInitialSofa()
-
isInitialSofaCreated
boolean isInitialSofaCreated()
-
getSofa
@Deprecated public SofaFS getSofa(SofaID sofaID)
Deprecated.Description copied from interface:CAS
Get sofaFS for given Subject of Analysis ID.
-
getSofa
private SofaFS getSofa(java.lang.String sofaName)
-
getSofa
SofaFS getSofa(int sofaRef)
-
ll_getSofaNum
public int ll_getSofaNum(int sofaRef)
-
ll_getSofaID
public java.lang.String ll_getSofaID(int sofaRef)
-
ll_getSofaDataString
public java.lang.String ll_getSofaDataString(int sofaAddr)
-
getBaseCAS
public CASImpl getBaseCAS()
-
getSofaIterator
public <T extends SofaFS> FSIterator<T> getSofaIterator()
Description copied from interface:CAS
Get iterator for all SofaFS in the CAS.- Specified by:
getSofaIterator
in interfaceCAS
- Type Parameters:
T
- generic type of sofa iterator- Returns:
- an iterator over SofaFS.
-
getSofaRef
public Sofa getSofaRef()
-
getSofaDataStream
public java.io.InputStream getSofaDataStream(SofaFS aSofa)
-
createFilteredIterator
public <T extends FeatureStructure> FSIterator<T> createFilteredIterator(FSIterator<T> it, FSMatchConstraint cons)
Description copied from interface:CAS
Create an iterator over structures satisfying a given constraint. Constraints are described in the javadocs forConstraintFactory
and related classes.- Specified by:
createFilteredIterator
in interfaceCAS
- Type Parameters:
T
- - the type of the Feature Structure- Parameters:
it
- The input iterator.cons
- The constraint specifying what structures should be returned.- Returns:
- An iterator over FSs.
-
commitTypeSystem
public TypeSystemImpl commitTypeSystem(boolean skip_loading_user_jcas)
-
commitTypeSystem
public TypeSystemImpl commitTypeSystem()
-
createIndexRepository
private void createIndexRepository()
-
getIndexRepositoryMgr
public FSIndexRepositoryMgr getIndexRepositoryMgr()
- Specified by:
getIndexRepositoryMgr
in interfaceCASMgr
- Returns:
- a writable version of the index repository. Note that the type system must be committed before this method can be called.
-
commitFS
@Deprecated public void commitFS(FeatureStructure fs)
Deprecated.
-
createFeaturePath
public FeaturePath createFeaturePath()
Description copied from interface:CAS
Create a feature path. This is mainly useful for creatingFSMatchConstraints
.- Specified by:
createFeaturePath
in interfaceCAS
- Returns:
- A new, empty feature path.
-
getTypeSystemMgr
public TypeSystemMgr getTypeSystemMgr()
Description copied from interface:CASMgr
Return a writable version of the type system. This may be used to add new types and features.- Specified by:
getTypeSystemMgr
in interfaceCASMgr
- Returns:
- A writable version of the type system.
- See Also:
CASMgr.getTypeSystemMgr()
-
reset
public void reset()
Description copied from interface:CAS
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.
-
resetNoQuestions
public void resetNoQuestions()
-
flush
@Deprecated public void flush()
Deprecated.Usereset()
instead.Description copied from interface:CASMgr
Flush this CAS instance of all transient data. This will delete all feature structures, but not the type system, the indexes etc. Call before processing a new document.
-
getIndexRepository
public FSIndexRepository getIndexRepository()
Description copied from interface:CAS
Get the index repository.- Specified by:
getIndexRepository
in interfaceCAS
- Returns:
- The index repository, or
null
if none is available.
-
getBaseIndexRepository
FSIndexRepository getBaseIndexRepository()
-
getBaseIndexRepositoryImpl
FSIndexRepositoryImpl getBaseIndexRepositoryImpl()
-
addSofaFsToIndex
void addSofaFsToIndex(SofaFS sofa)
-
registerView
void registerView(Sofa aSofa)
-
fs2listIterator
public <T extends FeatureStructure> java.util.ListIterator<T> fs2listIterator(FSIterator<T> it)
Description copied from interface:CAS
Wrap a standard JavaListIterator
around an FSListIterator. Use if you feel more comfortable with java style iterators.- Specified by:
fs2listIterator
in interfaceCAS
- Type Parameters:
T
- The type of FeatureStructure- Parameters:
it
- TheFSListIterator
to be wrapped.- Returns:
- An equivalent
ListIterator
. - See Also:
CAS.fs2listIterator(FSIterator)
-
getCAS
public CAS getCAS()
Description copied from interface:CASMgr
Return a non-admin version of the CAS.- Specified by:
getCAS
in interfaceCASMgr
- Returns:
- The CAS corresponding to this CASMgr.
- See Also:
CASMgr.getCAS()
-
getFSClassRegistry
public FSClassRegistry getFSClassRegistry()
-
logFSUpdate
private void logFSUpdate(TOP fs, FeatureImpl fi, int arrayIndexStart, int nbrOfConsecutive)
- Parameters:
fs
- the Feature Structure being updatedfi
- the Feature of fs being updated, or null if fs is an arrayarrayIndexStart
-nbrOfConsecutive
-
-
logFSUpdate
private void logFSUpdate(TOP fs, PositiveIntSet indexesPlus1)
- Parameters:
fs
- the Feature Structure being updatedarrayIndexStart
-nbrOfConsecutive
-
-
logFSUpdate
private void logFSUpdate(TOP fs, FeatureImpl fi)
-
createFS
public <T extends TOP> T createFS(int id)
This is your link from the low-level API to the high-level API. Use this method to create a FeatureStructure object from an address. Note that the reverse is not supported by public APIs (i.e., there is currently no way to get at the address of a FeatureStructure. Maybe we will need to change that. The "create" in "createFS" is a misnomer - the FS must already be created.- Type Parameters:
T
- The Java class associated with this feature structure- Parameters:
id
- The id of the feature structure to be created.- Returns:
- A FeatureStructure object.
-
getArraySize
public int getArraySize(CommonArrayFS fs)
-
ll_getArraySize
public int ll_getArraySize(int id)
Description copied from interface:LowLevelCAS
Get the size of an array.- Specified by:
ll_getArraySize
in interfaceLowLevelCAS
- Parameters:
id
- The array reference.- Returns:
- The size of the array.
-
setWithCheckAndJournal
final void setWithCheckAndJournal(TOP fs, FeatureImpl fi, java.lang.Runnable setter)
-
setWithCheckAndJournal
public final void setWithCheckAndJournal(TOP fs, int featCode, java.lang.Runnable setter)
-
setWithJournal
public final void setWithJournal(FeatureStructureImplC fs, FeatureImpl fi, java.lang.Runnable setter)
This method called by setters in JCas gen'd classes when the setter must check for journaling- Parameters:
fs
- -fi
- -setter
- -
-
isLoggingNeeded
public final boolean isLoggingNeeded(FeatureStructureImplC fs)
-
maybeLogArrayUpdate
public final void maybeLogArrayUpdate(FeatureStructureImplC fs, FeatureImpl feat, int i)
- Parameters:
fs
- the Feature Structure being updatedfeat
- the feature of fs being updated, or null if fs is a primitive arrayi
- the index being updated
-
maybeLogArrayUpdates
public final void maybeLogArrayUpdates(FeatureStructureImplC fs, PositiveIntSet indexesPlus1)
- Parameters:
fs
- the Feature Structure being updatedindexesPlus1
- - a set of indexes (plus 1) that have been update
-
maybeLogArrayUpdates
public final void maybeLogArrayUpdates(FeatureStructureImplC fs, int startingIndex, int length)
- Parameters:
fs
- a primitive array FSstartingIndex
- -length
- number of consequtive items
-
maybeLogUpdate
public final void maybeLogUpdate(FeatureStructureImplC fs, FeatureImpl feat)
-
maybeLogUpdate
public final void maybeLogUpdate(FeatureStructureImplC fs, int featCode)
-
isLogging
public final boolean isLogging()
-
setLongValue
public void setLongValue(FeatureStructureImplC fsIn, FeatureImpl feat, long v)
version for longs, uses two slots Only called from FeatureStructureImplC after determining there is no local field to use Is here because of 3 calls to things in this class- Parameters:
fsIn
- the feature structurefeat
- the feature to setv
- -
-
setFeatureValue
void setFeatureValue(int fsRef, int featureCode, TOP value)
-
setFeatureValueMaybeSofa
public static void setFeatureValueMaybeSofa(TOP fs, FeatureImpl feat, TOP value)
internal use - special setter for setting feature values, including special handling if the feature is for the sofaArray, when deserializing- Parameters:
fs
- -feat
- -value
- -
-
setFeatureValueFromStringNoDocAnnotUpdate
public static void setFeatureValueFromStringNoDocAnnotUpdate(FeatureStructureImplC fs, FeatureImpl feat, java.lang.String s)
Internal use, for cases where deserializing - special case setting sofString to skip updating the document annotation- Parameters:
fs
- -feat
- -s
- -
-
setFeatureValueFromString
public static void setFeatureValueFromString(FeatureStructureImplC fs, FeatureImpl feat, java.lang.String s)
Supports setting slots to "0" for null values- Parameters:
fs
- The feature structure to updatefeat
- the feature to update-s
- the string representation of the value, could be null
-
int2float
public static final float int2float(int i)
-
float2int
public static final int float2int(float f)
-
long2double
public static final double long2double(long l)
-
double2long
public static final long double2long(double d)
-
isStringType
public final boolean isStringType(Type type)
-
isAbstractArrayType
public final boolean isAbstractArrayType(Type type)
-
isArrayType
public final boolean isArrayType(Type type)
-
isPrimitiveArrayType
public final boolean isPrimitiveArrayType(Type type)
-
isIntArrayType
public final boolean isIntArrayType(Type type)
-
isFloatArrayType
public final boolean isFloatArrayType(Type type)
-
isStringArrayType
public final boolean isStringArrayType(Type type)
-
isBooleanArrayType
public final boolean isBooleanArrayType(Type type)
-
isByteArrayType
public final boolean isByteArrayType(Type type)
-
isShortArrayType
public final boolean isShortArrayType(Type type)
-
isLongArrayType
public final boolean isLongArrayType(Type type)
-
isDoubleArrayType
public final boolean isDoubleArrayType(Type type)
-
isFSArrayType
public final boolean isFSArrayType(Type type)
-
isIntType
public final boolean isIntType(Type type)
-
isFloatType
public final boolean isFloatType(Type type)
-
isByteType
public final boolean isByteType(Type type)
-
isBooleanType
public final boolean isBooleanType(Type type)
-
isShortType
public final boolean isShortType(Type type)
-
isLongType
public final boolean isLongType(Type type)
-
isDoubleType
public final boolean isDoubleType(Type type)
-
initCASIndexes
public void initCASIndexes() throws CASException
Description copied from interface:CASMgr
Install the standard built-in indexes into the base CAS- Specified by:
initCASIndexes
in interfaceCASMgr
- Throws:
CASException
- if an error occurs- See Also:
CASMgr.initCASIndexes()
-
getView
public CAS getView(int sofaNum)
-
getCurrentView
public CAS getCurrentView()
Description copied from interface:CAS
Get the Cas view that the current component should use. This should only be used by single-view components.- Specified by:
getCurrentView
in interfaceCAS
- Returns:
- the Cas view specified for the current component by Sofa mapping. Defaults to _InitialView if there is no Sofa mapping.
-
getJCas
public JCas getJCas()
Description copied from interface:CAS
Get the JCas view for this CAS view
-
getJCasImpl
public JCasImpl getJCasImpl()
Description copied from interface:CAS
Get the JCasImpl view for this CAS view- Specified by:
getJCasImpl
in interfaceCAS
- Returns:
- the JCasImpl view for this CAS view
-
getJCas
public JCas getJCas(SofaFS aSofa) throws CASException
Description copied from interface:CAS
Create a JCas view for a Sofa. Note: as of UIMA v2.0, can be replaced with getView(sofaFS).getJCas().- Specified by:
getJCas
in interfaceCAS
- Parameters:
aSofa
- a Sofa feature structure in this CAS.- Returns:
- The JCas view for the given Sofa.
- Throws:
CASException
- -
-
getJCas
@Deprecated public JCas getJCas(SofaID aSofaID) throws CASException
Deprecated.Description copied from interface:CAS
Create a JCas view for a Sofa. Note: this is provided for convenience. It is equivalent togetView(aSofaID).getJCas()
.- Specified by:
getJCas
in interfaceCAS
- Parameters:
aSofaID
- the ID of a Sofa defined in this CAS- Returns:
- The view for the Sofa with ID
aSofaID
. - Throws:
CASException
- if no Sofa with the given ID exists in this CAS
-
getInitialView
CASImpl getInitialView()
-
createView
public CAS createView(java.lang.String aSofaID)
Description copied from interface:CAS
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
CAS.setSofaDataArray(FeatureStructure, String)
,CAS.setSofaDataString(String, String)
orCAS.setSofaDataURI(String, String)
on the CAS view returned by this method.- Specified by:
createView
in interfaceCAS
- Parameters:
aSofaID
- 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.
-
getView
public CAS getView(java.lang.String aSofaID)
Description copied from interface:CAS
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.
-
getView
public CASImpl getView(SofaFS aSofa)
Description copied from interface:CAS
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.
-
verifySofaNameUniqueIfDeserializedViewAdded
private void verifySofaNameUniqueIfDeserializedViewAdded(int sofaNbr, SofaFS aSofa)
-
ll_getTypeSystem
public LowLevelTypeSystem ll_getTypeSystem()
Description copied from interface:LowLevelCAS
Get the low-level version of the type system object. It provides access to the low-level type and feature codes you need to use the data creation and access APIs.- Specified by:
ll_getTypeSystem
in interfaceLowLevelCAS
- Returns:
- The low-level type system.
-
ll_getIndexRepository
public LowLevelIndexRepository ll_getIndexRepository()
Description copied from interface:LowLevelCAS
Get the low-level version of the index repository. Use it to gain access to low-level indexes, and thus, low-level iterators.- Specified by:
ll_getIndexRepository
in interfaceLowLevelCAS
- Returns:
- A low-level version of the index repository.
-
checkLowLevelParams
private final void checkLowLevelParams(TOP fs, TypeImpl domType, int featCode)
- Parameters:
fs
-domType
-featCode
-
-
checkTypeHasFeature
private final void checkTypeHasFeature(TypeImpl domainType, int featureCode)
Check that the featCode is a feature of the domain type- Parameters:
domTypeCode
-featCode
-
-
checkTypeHasFeature
private final void checkTypeHasFeature(TypeImpl domainType, FeatureImpl feature)
-
checkTypingConditions
public final void checkTypingConditions(Type domType, Type ranType, Feature feat)
Check the range is appropriate for this type/feature. Throws LowLevelException if it isn't.- Parameters:
domType
- domain typeranType
- range typefeat
- feature
-
checkFsRan
private final void checkFsRan(FeatureImpl fi) throws LowLevelException
Validate a feature's range is a ref to a feature structure- Parameters:
featCode
-- Throws:
LowLevelException
-
checkFeature
private final void checkFeature(int featureCode)
-
getTypeFromCode
private TypeImpl getTypeFromCode(int typeCode)
-
getTypeFromCode_checked
private TypeImpl getTypeFromCode_checked(int typeCode)
-
getFeatFromCode_checked
private FeatureImpl getFeatFromCode_checked(int featureCode)
-
getFsFromId_checked
public final <T extends TOP> T getFsFromId_checked(int fsRef)
-
ll_isRefType
public final boolean ll_isRefType(int typeCode)
Description copied from interface:LowLevelCAS
Checks if the type code is that of a reference type (anything that's not a basic type, currently Integer, String and Float).- Specified by:
ll_isRefType
in interfaceLowLevelCAS
- Parameters:
typeCode
- The type code to check.- Returns:
true
ifftypeCode
is the type code of a reference type.
-
ll_getTypeClass
public final int ll_getTypeClass(int typeCode)
Description copied from interface:LowLevelCAS
Determine the type class of a type. This is useful for generic CAS exploiters to determine what kind of data they're looking at. The type classes currently defined are:TYPE_CLASS_INVALID
-- Not a valid type code.TYPE_CLASS_INT
-- Integer type.TYPE_CLASS_FLOAT
-- Float type.TYPE_CLASS_STRING
-- String type.TYPE_CLASS_BOOLEAN
-- Boolean type.TYPE_CLASS_BYTE
-- Byte type.TYPE_CLASS_SHORT
-- Short type.TYPE_CLASS_LONG
-- Long type.TYPE_CLASS_DOUBLE
-- Double type.TYPE_CLASS_INTARRAY
-- Integer array.TYPE_CLASS_FLOATARRAY
-- Float array.TYPE_CLASS_STRINGARRAY
-- String array.TYPE_CLASS_BOOLEANARRAY
-- Boolean array.TYPE_CLASS_BYTEARRAY
-- Byte array.TYPE_CLASS_SHORTARRAY
-- Short array.TYPE_CLASS_LONGARRAY
-- Long array.TYPE_CLASS_DOUBLEARRAY
-- Double array.TYPE_CLASS_FSARRAY
-- FS array.TYPE_CLASS_FS
-- FS type, i.e., all other types, including all user-defined types.
- Specified by:
ll_getTypeClass
in interfaceLowLevelCAS
- Parameters:
typeCode
- The type code.- Returns:
- A type class for the type code.
TYPE_CLASS_INVALID
if the type code argument does not represent a valid type code.
-
ll_createFS
public final int ll_createFS(int typeCode)
Description copied from interface:LowLevelCAS
Create a new FS on the heap.- Specified by:
ll_createFS
in interfaceLowLevelCAS
- Parameters:
typeCode
- The low-level code of the type of the FS that should be created. If thetypeCode
is not a valid type code, the results of this call are undefined.- Returns:
- The reference of the newly created FS.
-
ll_createFS
public final int ll_createFS(int typeCode, boolean doCheck)
Description copied from interface:LowLevelCAS
Create a new FS on the heap.- Specified by:
ll_createFS
in interfaceLowLevelCAS
- Parameters:
typeCode
- The low-level code of the type of the FS that should be created. If thetypeCode
is not a valid type code and the type check flag is not set, the results of this call are undefined.doCheck
- -- Returns:
- The reference of the newly created FS.
-
createFsWithExistingId
private TOP createFsWithExistingId(TypeImpl ti, int id)
used for ll_setIntValue which changes type code- Parameters:
ti
- - the type of the created FSid
- - the id to use- Returns:
- the FS
-
ll_createArray
public int ll_createArray(int typeCode, int arrayLength)
Description copied from interface:LowLevelCAS
Create a new array.- Specified by:
ll_createArray
in interfaceLowLevelCAS
- Parameters:
typeCode
- The type code of the array type. If this is not a valid array type code, the behavior of this call is undefined. Only works for arrays where a value is kept in the main heap (use other ll_createXxxArray for boolean, byte, short, long, and double)arrayLength
- The length of the array to be created.- Returns:
- The address of the newly created array.
-
createTempArray
public int createTempArray(int type, int len)
(for backwards compatibility with V2 CASImpl) Create a temporary (i.e., per document) array FS on the heap.- Parameters:
type
- The type code of the array to be created.len
- The length of the array to be created.- Returns:
- -
- Throws:
java.lang.ArrayIndexOutOfBoundsException
- Iftype
is not a type.
-
ll_createByteArray
public int ll_createByteArray(int arrayLength)
- Specified by:
ll_createByteArray
in interfaceLowLevelCAS
- Parameters:
arrayLength
- -- Returns:
- the id of the created array
-
ll_createBooleanArray
public int ll_createBooleanArray(int arrayLength)
- Specified by:
ll_createBooleanArray
in interfaceLowLevelCAS
- Parameters:
arrayLength
- -- Returns:
- the id of the created array
-
ll_createShortArray
public int ll_createShortArray(int arrayLength)
- Specified by:
ll_createShortArray
in interfaceLowLevelCAS
- Parameters:
arrayLength
- -- Returns:
- the id of the created array
-
ll_createLongArray
public int ll_createLongArray(int arrayLength)
- Specified by:
ll_createLongArray
in interfaceLowLevelCAS
- Parameters:
arrayLength
- -- Returns:
- the id of the created array
-
ll_createDoubleArray
public int ll_createDoubleArray(int arrayLength)
- Specified by:
ll_createDoubleArray
in interfaceLowLevelCAS
- Parameters:
arrayLength
- -- Returns:
- the id of the created array
-
ll_createArray
public int ll_createArray(int typeCode, int arrayLength, boolean doChecks)
Description copied from interface:LowLevelCAS
Create a new array.- Specified by:
ll_createArray
in interfaceLowLevelCAS
- Parameters:
arrayLength
- -typeCode
- The type code of the array to be created.doChecks
- Switch to turn on various sanity checks.- Returns:
- the id of the created array
-
validateArraySize
public void validateArraySize(int length)
-
ll_getFSRef
public final int ll_getFSRef(FeatureStructure fs)
Safety - any time the low level API to a FS is requested, hold on to that FS until CAS reset to mimic how v2 works.- Specified by:
ll_getFSRef
in interfaceLowLevelCAS
- Parameters:
fs
- The FS object for which we want the reference.- Returns:
- The low-level reference of the FS object parameter.
-
ll_getFSForRef
public <T extends TOP> T ll_getFSForRef(int id)
Description copied from interface:LowLevelCAS
Return a FS object that corresponds to a low-level reference. Note that this must be a valid reference that has been obtained from the low-level APIs. If the input reference parameter does not represent a valid reference, an exception is thrown.
In version 3, the map this API uses is not normally populated; it is populated only for Feature Structures created using the low-level APIs, and also when the ll_getFSRef API (above) is used, or the getAddress method is called on a Feature Structure
- Specified by:
ll_getFSForRef
in interfaceLowLevelCAS
- Type Parameters:
T
- the Java class for the Feature Structure- Parameters:
id
- The FS reference.- Returns:
- A FS object corresponding to the input reference.
-
ll_getIntValue
public final int ll_getIntValue(int fsRef, int featureCode)
Handle some unusual backwards compatibility cases featureCode = 0 - implies getting the type code feature range is int - normal feature range is a fs reference, return the id feature range is a string: add the string if not already present to the string heap, return the int handle.- Specified by:
ll_getIntValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- -featureCode
- -- Returns:
- -
-
ll_getFloatValue
public final float ll_getFloatValue(int fsRef, int featureCode)
Description copied from interface:LowLevelCAS
Get the value of a float valued feature.- Specified by:
ll_getFloatValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the FS from which to obtain the feature value.featureCode
- The low-level code of the feature whose value is to be returned.- Returns:
- The value of the feature.
-
ll_getStringValue
public final java.lang.String ll_getStringValue(int fsRef, int featureCode)
Description copied from interface:LowLevelCAS
Get the value of a string valued feature.- Specified by:
ll_getStringValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the FS from which to obtain the feature value.featureCode
- The low-level code of the feature whose value is to be returned.- Returns:
- The value of the feature.
-
ll_getRefValue
public final int ll_getRefValue(int fsRef, int featureCode)
Description copied from interface:LowLevelCAS
Get the value of a FS reference valued feature.- Specified by:
ll_getRefValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the FS from which to obtain the feature value.featureCode
- The low-level code of the feature whose value is to be returned.- Returns:
- The value of the feature.
-
ll_getIntValue
public final int ll_getIntValue(int fsRef, int featureCode, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Get the value of an integer valued feature.- Specified by:
ll_getIntValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the FS from which to obtain the feature value.featureCode
- The low-level code of the feature whose value is to be returned.doTypeChecks
- Switch to turn on type checking.- Returns:
- The value of the feature.
-
ll_getFloatValue
public final float ll_getFloatValue(int fsRef, int featureCode, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Get the value of a float valued feature.- Specified by:
ll_getFloatValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the FS from which to obtain the feature value.featureCode
- The low-level code of the feature whose value is to be returned.doTypeChecks
- Switch to turn on type checking.- Returns:
- The value of the feature.
-
ll_getStringValue
public final java.lang.String ll_getStringValue(int fsRef, int featureCode, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Get the value of a string valued feature.- Specified by:
ll_getStringValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the FS from which to obtain the feature value.featureCode
- The low-level code of the feature whose value is to be returned.doTypeChecks
- Switch to turn on type checking.- Returns:
- The value of the feature.
-
ll_getRefValue
public final int ll_getRefValue(int fsRef, int featureCode, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Get the value of a FS reference valued feature.- Specified by:
ll_getRefValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the FS from which to obtain the feature value.featureCode
- The low-level code of the feature whose value is to be returned.doTypeChecks
- Switch to turn on type checking.- Returns:
- The value of the feature.
-
checkForInvalidFeatureSetting
private boolean checkForInvalidFeatureSetting(TOP fs, int featCode)
This is the method all normal FS feature "setters" call before doing the set operation on values where the range could be used as an index key.If enabled, it will check if the update may corrupt any index in any view. The check tests whether the feature is being used as a key in one or more indexes and if the FS is in one or more corruptable view indexes.
If true, then:
- it may remove and remember (for later adding-back) the FS from all corruptable indexes (bag indexes are not corruptable via updating, so these are skipped). The addback occurs later either via an explicit call to do so, or the end of a protectIndex block, or. (if autoIndexProtect is enabled) after the individual feature update is completed.
- it may give a WARN level message to the log. This enables users to implement their own optimized handling of this for "high performance" applications which do not want the overhead of runtime checking.
- Parameters:
fs
- - the FS to test if it is in the indexesfeatCode
- - the feature being tested- Returns:
- true if something may need to be added back
-
checkForInvalidFeatureSetting
boolean checkForInvalidFeatureSetting(TOP fs, int featCode, FSsTobeAddedback toBeAdded)
version for deserializers, and for set document language, using their own store for toBeAdded Doesn't report updating of corruptable slots.- Parameters:
fs
- -featCode
- -toBeAdded
- -- Returns:
- -
-
checkForInvalidFeatureSetting
boolean checkForInvalidFeatureSetting(TOP fs, FSsTobeAddedback toBeAdded)
version for deserializers, using their own store for toBeAdded and not bothering to check for particular features Doesn't report updating of corruptable slots.- Parameters:
fs
- -featCode
- -toBeAdded
- -- Returns:
- -
-
checkForInvalidFeatureSetting2
private boolean checkForInvalidFeatureSetting2(TOP fs)
-
doCorruptReport
private boolean doCorruptReport()
-
doInvalidFeatSettingCheck
private boolean doInvalidFeatSettingCheck(TOP fs)
- Parameters:
fs
- -- Returns:
- false if the fs is not in a set or sorted index (bit in fs), or the auto protect is disabled and we're not in an explicit protect block
-
featModWhileInIndexReport
private void featModWhileInIndexReport(FeatureStructure fs, int featCode)
-
featModWhileInIndexReport
private void featModWhileInIndexReport(FeatureStructure fs, FeatureImpl fi)
-
maybeAddback
public void maybeAddback(TOP fs)
Only called if there was something removed that needs to be added back skip the addback (to defer it until later) if: - running in block mode (you can tell this if svd.fssTobeAddedback.size() > 0) or if running in block mode, the add back is delayed until the end of the block- Parameters:
fs
- the fs to add back
-
removeFromCorruptableIndexAnyView
boolean removeFromCorruptableIndexAnyView(TOP fs, FSsTobeAddedback toBeAdded)
-
removeFromIndexAnyView
boolean removeFromIndexAnyView(TOP fs, FSsTobeAddedback toBeAdded, boolean isSkipBagIndexes)
This might be called from low level set int value, if we support switching types, and we want to remove the old type from all indexes.- Parameters:
fs
- the fs to maybe removetoBeAdded
- a place to record the removal so we can add it back laterisSkipBagIndexes
- is true usually, we don't need to remove/readd to bag indexes (except for the case of supporting switching types via low level set int for v2 backwards compatibility)- Returns:
- true if was removed from one or more indexes
-
removeAndRecord
private boolean removeAndRecord(TOP fs, FSIndexRepositoryImpl ir, FSsTobeAddedback toBeAdded, boolean isSkipBagIndex)
remove a FS from all indexes in this view (except bag indexes, if isSkipBagIndex is true)- Parameters:
fs
- the fs to be removedir
- the viewtoBeAdded
- the place to record how many times it was in the index, per viewisSkipBagIndex
- set to true for corruptable removes, false for remove in all cases from all indexes- Returns:
- true if it was removed, false if it wasn't in any corruptable index.
-
ll_setIntValue
public final void ll_setIntValue(int fsRef, int featureCode, int value)
Special considerations: Interface with corruption checking For backwards compatibility: handle cases where feature is: int - normal 0 - change type code a ref: treat int as FS "addr" not an int: handle like v2 where reasonable- Specified by:
ll_setIntValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference of the FS on which the feature should be set.featureCode
- The low-level feature code for the feature that should be set.value
- The value to be assigned to the feature.
-
getStringForCode
private java.lang.String getStringForCode(int i)
-
getCodeForString
private int getCodeForString(java.lang.String s)
-
getLongForCode
private java.lang.Long getLongForCode(int i)
-
getCodeForLong
private int getCodeForLong(long s)
-
switchFsType
private void switchFsType(TOP fs, int value)
-
ll_setFloatValue
public final void ll_setFloatValue(int fsRef, int featureCode, float value)
Description copied from interface:LowLevelCAS
Set the value of a float feature.- Specified by:
ll_setFloatValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference of the FS on which the feature should be set.featureCode
- The low-level feature code for the feature that should be set.value
- The value to be assigned to the feature.
-
ll_setStringValue
public final void ll_setStringValue(int fsRef, int featureCode, java.lang.String value)
Description copied from interface:LowLevelCAS
Set the value of a string feature.- Specified by:
ll_setStringValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference of the FS on which the feature should be set.featureCode
- The low-level feature code for the feature that should be set.value
- The value to be assigned to the feature.
-
ll_setRefValue
public final void ll_setRefValue(int fsRef, int featureCode, int value)
Description copied from interface:LowLevelCAS
Set the value of a FS reference feature.- Specified by:
ll_setRefValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference of the FS on which the feature should be set.featureCode
- The low-level feature code for the feature that should be set.value
- The value to be assigned to the feature.
-
ll_setIntValue
public final void ll_setIntValue(int fsRef, int featureCode, int value, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Set the value of an integer feature.- Specified by:
ll_setIntValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference of the FS on which the feature should be set.featureCode
- The low-level feature code for the feature that should be set.value
- The value to be assigned to the feature.doTypeChecks
- Switch to turn on type checking.
-
ll_setFloatValue
public final void ll_setFloatValue(int fsRef, int featureCode, float value, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Set the value of a float feature.- Specified by:
ll_setFloatValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference of the FS on which the feature should be set.featureCode
- The low-level feature code for the feature that should be set.value
- The value to be assigned to the feature.doTypeChecks
- Switch to turn on type checking.
-
ll_setStringValue
public final void ll_setStringValue(int fsRef, int featureCode, java.lang.String value, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Set the value of a string feature.- Specified by:
ll_setStringValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference of the FS on which the feature should be set.featureCode
- The low-level feature code for the feature that should be set.value
- The value to be assigned to the feature.doTypeChecks
- Switch to turn on type checking.
-
ll_setCharBufferValue
public final void ll_setCharBufferValue(int fsRef, int featureCode, char[] buffer, int start, int length, boolean doTypeChecks)
- Specified by:
ll_setCharBufferValue
in interfaceLowLevelCAS
-
ll_setCharBufferValue
public final void ll_setCharBufferValue(int fsRef, int featureCode, char[] buffer, int start, int length)
- Specified by:
ll_setCharBufferValue
in interfaceLowLevelCAS
-
ll_copyCharBufferValue
public int ll_copyCharBufferValue(int fsRef, int featureCode, char[] buffer, int start)
- Specified by:
ll_copyCharBufferValue
in interfaceLowLevelCAS
-
ll_getCharBufferValueSize
public int ll_getCharBufferValueSize(int fsRef, int featureCode)
- Specified by:
ll_getCharBufferValueSize
in interfaceLowLevelCAS
-
ll_setRefValue
public final void ll_setRefValue(int fsRef, int featureCode, int value, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Set the value of a FS reference feature.- Specified by:
ll_setRefValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference of the FS on which the feature should be set.featureCode
- The low-level feature code for the feature that should be set.value
- The value to be assigned to the feature.doTypeChecks
- Switch to turn on type checking.
-
getIntArrayValue
public final int getIntArrayValue(IntegerArray array, int i)
-
getFloatArrayValue
public final float getFloatArrayValue(FloatArray array, int i)
-
getStringArrayValue
public final java.lang.String getStringArrayValue(StringArray array, int i)
-
getRefArrayValue
public final FeatureStructure getRefArrayValue(FSArray array, int i)
-
ll_getIntArrayValue
public final int ll_getIntArrayValue(int fsRef, int position)
Description copied from interface:LowLevelCAS
Get the value of an array at a certain position.- Specified by:
ll_getIntArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the array FS.position
- The position whose value should be returned.- Returns:
- The value at
position
.
-
ll_getFloatArrayValue
public final float ll_getFloatArrayValue(int fsRef, int position)
Description copied from interface:LowLevelCAS
Get the value of a float array at a certain position.- Specified by:
ll_getFloatArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the array FS.position
- The position whose value should be returned.- Returns:
- The value at
position
.
-
ll_getStringArrayValue
public final java.lang.String ll_getStringArrayValue(int fsRef, int position)
Description copied from interface:LowLevelCAS
Get the value of a string array at a certain position.- Specified by:
ll_getStringArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the array FS.position
- The position whose value should be returned.- Returns:
- The value at
position
.
-
ll_getRefArrayValue
public final int ll_getRefArrayValue(int fsRef, int position)
Description copied from interface:LowLevelCAS
Get the value of a FS reference array at a certain position.- Specified by:
ll_getRefArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the array FS.position
- The position whose value should be returned.- Returns:
- The value at
position
.
-
throwAccessTypeError
private void throwAccessTypeError(int fsRef, int typeCode)
-
checkArrayBounds
public final void checkArrayBounds(int fsRef, int pos)
-
checkArrayBounds
public final void checkArrayBounds(int arrayLength, int pos, int length)
-
checkNonArrayConditions
private final void checkNonArrayConditions(int fsRef, int featureCode)
Check that the fsRef is valid. Check that the fs is featureCode belongs to the fs Check that the featureCode is one of the features of the domain type of the fsRef feat could be primitive, string, ref to another feature- Parameters:
fsRef
-typeCode
-featureCode
-
-
checkFsRefConditions
private final void checkFsRefConditions(int fsRef, int featureCode)
-
checkPrimitiveArrayConditions
private final void checkPrimitiveArrayConditions(int fsRef, int typeCode, int position)
-
ll_getIntArrayValue
public final int ll_getIntArrayValue(int fsRef, int position, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Get the value of an integer array at a certain position.- Specified by:
ll_getIntArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the array FS.position
- The position whose value should be returned.doTypeChecks
- Switch to turn on type checking.- Returns:
- The value at
position
.
-
ll_getFloatArrayValue
public float ll_getFloatArrayValue(int fsRef, int position, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Get the value of a float array at a certain position.- Specified by:
ll_getFloatArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the array FS.position
- The position whose value should be returned.doTypeChecks
- Switch to turn on type checking.- Returns:
- The value at
position
.
-
ll_getStringArrayValue
public java.lang.String ll_getStringArrayValue(int fsRef, int position, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Get the value of a string array at a certain position.- Specified by:
ll_getStringArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the array FS.position
- The position whose value should be returned.doTypeChecks
- Switch to turn on type checking.- Returns:
- The value at
position
.
-
ll_getRefArrayValue
public int ll_getRefArrayValue(int fsRef, int position, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Get the value of a FS reference array at a certain position.- Specified by:
ll_getRefArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The reference to the array FS.position
- The position whose value should be returned.doTypeChecks
- Switch to turn on type checking.- Returns:
- The value at
position
.
-
ll_setIntArrayValue
public void ll_setIntArrayValue(int fsRef, int position, int value, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Set the value of an integer array at a certain position.- Specified by:
ll_setIntArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The FS reference of the array.position
- The position whose value will be changed.value
- The new value.doTypeChecks
- Switch to turn on type and bounds checking.
-
ll_setFloatArrayValue
public void ll_setFloatArrayValue(int fsRef, int position, float value, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Set the value of an integer array at a certain position.- Specified by:
ll_setFloatArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The FS reference of the array.position
- The position whose value will be changed.value
- The new value.doTypeChecks
- Switch to turn on type and bounds checking.
-
ll_setStringArrayValue
public void ll_setStringArrayValue(int fsRef, int position, java.lang.String value, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Set the value of an integer array at a certain position.- Specified by:
ll_setStringArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The FS reference of the array.position
- The position whose value will be changed.value
- The new value.doTypeChecks
- Switch to turn on type and bounds checking.
-
ll_setRefArrayValue
public void ll_setRefArrayValue(int fsRef, int position, int value, boolean doTypeChecks)
Description copied from interface:LowLevelCAS
Set the value of an integer array at a certain position.- Specified by:
ll_setRefArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The FS reference of the array.position
- The position whose value will be changed.value
- The new value.doTypeChecks
- Switch to turn on type and bounds checking.
-
ll_setIntArrayValue
public void ll_setIntArrayValue(int fsRef, int position, int value)
Description copied from interface:LowLevelCAS
Set the value of an integer array at a certain position.- Specified by:
ll_setIntArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The FS reference of the array.position
- The position whose value will be changed.value
- The new value.
-
ll_setFloatArrayValue
public void ll_setFloatArrayValue(int fsRef, int position, float value)
Description copied from interface:LowLevelCAS
Set the value of an integer array at a certain position.- Specified by:
ll_setFloatArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The FS reference of the array.position
- The position whose value will be changed.value
- The new value.
-
ll_setStringArrayValue
public void ll_setStringArrayValue(int fsRef, int position, java.lang.String value)
Description copied from interface:LowLevelCAS
Set the value of an integer array at a certain position.- Specified by:
ll_setStringArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The FS reference of the array.position
- The position whose value will be changed.value
- The new value.
-
ll_setRefArrayValue
public void ll_setRefArrayValue(int fsRef, int position, int value)
Description copied from interface:LowLevelCAS
Set the value of an integer array at a certain position.- Specified by:
ll_setRefArrayValue
in interfaceLowLevelCAS
- Parameters:
fsRef
- The FS reference of the array.position
- The position whose value will be changed.value
- The new value.
-
ll_getFSRefType
public int ll_getFSRefType(int fsRef)
Description copied from interface:LowLevelCAS
Get the type code for a FS reference. No bounds checks are performed. IffsRef
is not a fs reference, the results are undefined. There is also a checked version of this call, which will give better error messages in case of problems.- Specified by:
ll_getFSRefType
in interfaceLowLevelCAS
- Parameters:
fsRef
- an id for a FS- Returns:
- the type code for this FS
-
ll_getFSRefType
public int ll_getFSRefType(int fsRef, boolean doChecks)
Description copied from interface:LowLevelCAS
Get the type code for a FS reference.- Specified by:
ll_getFSRefType
in interfaceLowLevelCAS
- Parameters:
fsRef
- The FS reference.doChecks
- Check fsRef for out-of-range errors. If this switch is not set, and the input reference is not a valid reference, the results are undefined.- Returns:
- The type code for the FS reference; a return value of
0
means that the fsRef is invalid, i.e.,NULL_FS_REF
(but see remarks on bounds checking for this method).
-
getLowLevelCAS
public LowLevelCAS getLowLevelCAS()
Description copied from interface:CAS
Get an instance of the low-level CAS. Low-level and regular CAS can be used in parallel, all data is always contained in both.Note: This is for internal use.
- Specified by:
getLowLevelCAS
in interfaceCAS
- Returns:
- A low-level CAS.
- See Also:
LowLevelCAS
-
size
public int size()
Description copied from interface:CAS
Estimate the memory consumption of this CAS instance (in bytes).
-
getJCasClassLoader
public java.lang.ClassLoader getJCasClassLoader()
Description copied from interface:CASMgr
Gets the ClassLoader that should be used by the JCas to load the generated FS cover classes for this CAS.- Specified by:
getJCasClassLoader
in interfaceCASMgr
- Returns:
- the JCas ClassLoder for this CAS
-
setJCasClassLoader
public void setJCasClassLoader(java.lang.ClassLoader classLoader)
Description copied from interface:CASMgr
Sets the ClassLoader that should be used by the JCas to load the generated FS cover classes for this CAS.- Specified by:
setJCasClassLoader
in interfaceCASMgr
- Parameters:
classLoader
- the JCas ClassLoder for this CAS
-
switchClassLoader
public void switchClassLoader(java.lang.ClassLoader newClassLoader, boolean wasLocked)
-
switchClassLoaderLockCas
public void switchClassLoaderLockCas(java.lang.Object userCode)
-
switchClassLoaderLockCasCL
public void switchClassLoaderLockCasCL(java.lang.ClassLoader newClassLoader)
-
restoreClassLoaderUnlockCas
public void restoreClassLoaderUnlockCas()
-
createFeatureValuePath
public FeatureValuePath createFeatureValuePath(java.lang.String featureValuePath) throws CASRuntimeException
Description copied from interface:CAS
Create a feature-value path from a string.- Specified by:
createFeatureValuePath
in interfaceCAS
- Parameters:
featureValuePath
- String representation of the feature-value path.- Returns:
- Feature-value path object.
- Throws:
CASRuntimeException
- If the input string is not well-formed.
-
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 classAbstractCas_ImplBase
- Parameters:
aCasOwner
- -
-
release
public void release()
Description copied from class:AbstractCas_ImplBase
Default implementation that returns this CAS to its CasManager by callingCasOwner.releaseCas(AbstractCas)
.- Specified by:
release
in interfaceAbstractCas
- Overrides:
release
in classAbstractCas_ImplBase
-
createByteArrayFS
public ByteArrayFS createByteArrayFS(int length) throws CASRuntimeException
Description copied from interface:CAS
Create a new Byte array.- Specified by:
createByteArrayFS
in interfaceCAS
- Parameters:
length
- The length of the array.- Returns:
- The new array.
- Throws:
CASRuntimeException
-
createBooleanArrayFS
public BooleanArrayFS createBooleanArrayFS(int length) throws CASRuntimeException
Description copied from interface:CAS
Create a new Boolean array.- Specified by:
createBooleanArrayFS
in interfaceCAS
- Parameters:
length
- The length of the array.- Returns:
- The new array.
- Throws:
CASRuntimeException
-
createShortArrayFS
public ShortArrayFS createShortArrayFS(int length) throws CASRuntimeException
Description copied from interface:CAS
Create a new Short array.- Specified by:
createShortArrayFS
in interfaceCAS
- Parameters:
length
- The length of the array.- Returns:
- The new array.
- Throws:
CASRuntimeException
-
createLongArrayFS
public LongArrayFS createLongArrayFS(int length) throws CASRuntimeException
Description copied from interface:CAS
Create a new Long array.- Specified by:
createLongArrayFS
in interfaceCAS
- Parameters:
length
- The length of the array.- Returns:
- The new array.
- Throws:
CASRuntimeException
-
createDoubleArrayFS
public DoubleArrayFS createDoubleArrayFS(int length) throws CASRuntimeException
Description copied from interface:CAS
Create a new Double array.- Specified by:
createDoubleArrayFS
in interfaceCAS
- Parameters:
length
- The length of the array.- Returns:
- The new array.
- Throws:
CASRuntimeException
-
ll_getByteValue
public byte ll_getByteValue(int fsRef, int featureCode)
- Specified by:
ll_getByteValue
in interfaceLowLevelCAS
-
ll_getByteValue
public byte ll_getByteValue(int fsRef, int featureCode, boolean doTypeChecks)
- Specified by:
ll_getByteValue
in interfaceLowLevelCAS
-
ll_getBooleanValue
public boolean ll_getBooleanValue(int fsRef, int featureCode)
- Specified by:
ll_getBooleanValue
in interfaceLowLevelCAS
-
ll_getBooleanValue
public boolean ll_getBooleanValue(int fsRef, int featureCode, boolean doTypeChecks)
- Specified by:
ll_getBooleanValue
in interfaceLowLevelCAS
-
ll_getShortValue
public short ll_getShortValue(int fsRef, int featureCode)
- Specified by:
ll_getShortValue
in interfaceLowLevelCAS
-
ll_getShortValue
public short ll_getShortValue(int fsRef, int featureCode, boolean doTypeChecks)
- Specified by:
ll_getShortValue
in interfaceLowLevelCAS
-
ll_getLongValue
public long ll_getLongValue(int fsRef, int featureCode)
- Specified by:
ll_getLongValue
in interfaceLowLevelCAS
-
ll_getLongValue
public long ll_getLongValue(int fsRef, int featureCode, boolean doTypeChecks)
- Specified by:
ll_getLongValue
in interfaceLowLevelCAS
-
ll_getDoubleValue
public double ll_getDoubleValue(int fsRef, int featureCode)
- Specified by:
ll_getDoubleValue
in interfaceLowLevelCAS
-
ll_getDoubleValue
public double ll_getDoubleValue(int fsRef, int featureCode, boolean doTypeChecks)
- Specified by:
ll_getDoubleValue
in interfaceLowLevelCAS
-
ll_setBooleanValue
public void ll_setBooleanValue(int fsRef, int featureCode, boolean value)
- Specified by:
ll_setBooleanValue
in interfaceLowLevelCAS
-
ll_setBooleanValue
public void ll_setBooleanValue(int fsRef, int featureCode, boolean value, boolean doTypeChecks)
- Specified by:
ll_setBooleanValue
in interfaceLowLevelCAS
-
ll_setByteValue
public final void ll_setByteValue(int fsRef, int featureCode, byte value)
- Specified by:
ll_setByteValue
in interfaceLowLevelCAS
-
ll_setByteValue
public void ll_setByteValue(int fsRef, int featureCode, byte value, boolean doTypeChecks)
- Specified by:
ll_setByteValue
in interfaceLowLevelCAS
-
ll_setShortValue
public final void ll_setShortValue(int fsRef, int featureCode, short value)
- Specified by:
ll_setShortValue
in interfaceLowLevelCAS
-
ll_setShortValue
public void ll_setShortValue(int fsRef, int featureCode, short value, boolean doTypeChecks)
- Specified by:
ll_setShortValue
in interfaceLowLevelCAS
-
ll_setLongValue
public void ll_setLongValue(int fsRef, int featureCode, long value)
- Specified by:
ll_setLongValue
in interfaceLowLevelCAS
-
ll_setLongValue
public void ll_setLongValue(int fsRef, int featureCode, long value, boolean doTypeChecks)
- Specified by:
ll_setLongValue
in interfaceLowLevelCAS
-
ll_setDoubleValue
public void ll_setDoubleValue(int fsRef, int featureCode, double value)
- Specified by:
ll_setDoubleValue
in interfaceLowLevelCAS
-
ll_setDoubleValue
public void ll_setDoubleValue(int fsRef, int featureCode, double value, boolean doTypeChecks)
- Specified by:
ll_setDoubleValue
in interfaceLowLevelCAS
-
ll_getByteArrayValue
public byte ll_getByteArrayValue(int fsRef, int position)
- Specified by:
ll_getByteArrayValue
in interfaceLowLevelCAS
-
ll_getByteArrayValue
public byte ll_getByteArrayValue(int fsRef, int position, boolean doTypeChecks)
- Specified by:
ll_getByteArrayValue
in interfaceLowLevelCAS
-
ll_getBooleanArrayValue
public boolean ll_getBooleanArrayValue(int fsRef, int position)
- Specified by:
ll_getBooleanArrayValue
in interfaceLowLevelCAS
-
ll_getBooleanArrayValue
public boolean ll_getBooleanArrayValue(int fsRef, int position, boolean doTypeChecks)
- Specified by:
ll_getBooleanArrayValue
in interfaceLowLevelCAS
-
ll_getShortArrayValue
public short ll_getShortArrayValue(int fsRef, int position)
- Specified by:
ll_getShortArrayValue
in interfaceLowLevelCAS
-
ll_getShortArrayValue
public short ll_getShortArrayValue(int fsRef, int position, boolean doTypeChecks)
- Specified by:
ll_getShortArrayValue
in interfaceLowLevelCAS
-
ll_getLongArrayValue
public long ll_getLongArrayValue(int fsRef, int position)
- Specified by:
ll_getLongArrayValue
in interfaceLowLevelCAS
-
ll_getLongArrayValue
public long ll_getLongArrayValue(int fsRef, int position, boolean doTypeChecks)
- Specified by:
ll_getLongArrayValue
in interfaceLowLevelCAS
-
ll_getDoubleArrayValue
public double ll_getDoubleArrayValue(int fsRef, int position)
- Specified by:
ll_getDoubleArrayValue
in interfaceLowLevelCAS
-
ll_getDoubleArrayValue
public double ll_getDoubleArrayValue(int fsRef, int position, boolean doTypeChecks)
- Specified by:
ll_getDoubleArrayValue
in interfaceLowLevelCAS
-
ll_setByteArrayValue
public void ll_setByteArrayValue(int fsRef, int position, byte value)
- Specified by:
ll_setByteArrayValue
in interfaceLowLevelCAS
-
ll_setByteArrayValue
public void ll_setByteArrayValue(int fsRef, int position, byte value, boolean doTypeChecks)
- Specified by:
ll_setByteArrayValue
in interfaceLowLevelCAS
-
ll_setBooleanArrayValue
public void ll_setBooleanArrayValue(int fsRef, int position, boolean b)
- Specified by:
ll_setBooleanArrayValue
in interfaceLowLevelCAS
-
ll_setBooleanArrayValue
public void ll_setBooleanArrayValue(int fsRef, int position, boolean value, boolean doTypeChecks)
- Specified by:
ll_setBooleanArrayValue
in interfaceLowLevelCAS
-
ll_setShortArrayValue
public void ll_setShortArrayValue(int fsRef, int position, short value)
- Specified by:
ll_setShortArrayValue
in interfaceLowLevelCAS
-
ll_setShortArrayValue
public void ll_setShortArrayValue(int fsRef, int position, short value, boolean doTypeChecks)
- Specified by:
ll_setShortArrayValue
in interfaceLowLevelCAS
-
ll_setLongArrayValue
public void ll_setLongArrayValue(int fsRef, int position, long value)
- Specified by:
ll_setLongArrayValue
in interfaceLowLevelCAS
-
ll_setLongArrayValue
public void ll_setLongArrayValue(int fsRef, int position, long value, boolean doTypeChecks)
- Specified by:
ll_setLongArrayValue
in interfaceLowLevelCAS
-
ll_setDoubleArrayValue
public void ll_setDoubleArrayValue(int fsRef, int position, double d)
- Specified by:
ll_setDoubleArrayValue
in interfaceLowLevelCAS
-
ll_setDoubleArrayValue
public void ll_setDoubleArrayValue(int fsRef, int position, double value, boolean doTypeChecks)
- Specified by:
ll_setDoubleArrayValue
in interfaceLowLevelCAS
-
isAnnotationType
public boolean isAnnotationType(Type t)
-
isSubtypeOfAnnotationBaseType
public boolean isSubtypeOfAnnotationBaseType(int t)
- Parameters:
t
- the type code to test- Returns:
- true if that type is subsumed by AnnotationBase type
-
isBaseCas
public boolean isBaseCas()
-
createAnnotation
public Annotation createAnnotation(Type type, int begin, int end)
Description copied from interface:CAS
Create a new annotation. Note that you still need to insert the annotation into the index repository yourself.- Specified by:
createAnnotation
in interfaceCAS
- Parameters:
type
- The type of the annotation.begin
- The start of the annotation.end
- The end of the annotation.- Returns:
- A new annotation object.
-
ll_createAnnotation
public int ll_createAnnotation(int typeCode, int begin, int end)
-
getAnnotationIndex
public <T extends AnnotationFS> AnnotationIndex<T> getAnnotationIndex()
The generic spec T extends AnnotationFS (rather than AnnotationFS) allows the method JCasImpl getAnnotationIndex to return Annotation instead of AnnotationFS- Specified by:
getAnnotationIndex
in interfaceCAS
- Type Parameters:
T
- the Java class associated with the annotation index- Returns:
- the annotation index
-
getAnnotationIndex
public <T extends AnnotationFS> AnnotationIndex<T> getAnnotationIndex(Type type) throws CASRuntimeException
Description copied from interface:CAS
Get the standard annotation index restricted to a specific annotation type.- Specified by:
getAnnotationIndex
in interfaceCAS
- Type Parameters:
T
- the topmost Java class corresponding to the type- Parameters:
type
- The annotation type the index is restricted to.- Returns:
- The standard annotation index, restricted to
type
. - Throws:
CASRuntimeException
- Whentype
is not an annotation type.
-
getAnnotationType
public Type getAnnotationType()
Description copied from interface:CAS
Get the type object for the annotation type.- Specified by:
getAnnotationType
in interfaceCAS
- Returns:
- The annotation type.
- See Also:
CAS.getAnnotationType()
-
getEndFeature
public Feature getEndFeature()
Description copied from interface:CAS
Get the feature object for the annotation end feature.- Specified by:
getEndFeature
in interfaceCAS
- Returns:
- The annotation end feature.
- See Also:
CAS.getEndFeature()
-
getBeginFeature
public Feature getBeginFeature()
Description copied from interface:CAS
Get the feature object for the annotation begin feature.- Specified by:
getBeginFeature
in interfaceCAS
- Returns:
- The annotation begin feature.
- See Also:
CAS.getBeginFeature()
-
createDocumentAnnotation
private <T extends AnnotationFS> T createDocumentAnnotation(int length)
-
createDocumentAnnotationNoRemove
private <T extends Annotation> T createDocumentAnnotationNoRemove(int length)
-
createDocumentAnnotationNoRemoveNoIndex
public <T extends Annotation> T createDocumentAnnotationNoRemoveNoIndex(int length)
-
ll_createDocumentAnnotation
public int ll_createDocumentAnnotation(int length)
-
ll_createDocumentAnnotationNoIndex
public int ll_createDocumentAnnotationNoIndex(int begin, int end)
-
updateDocumentAnnotation
public void updateDocumentAnnotation()
updates the document annotation (only if the sofa's local string data != null) setting the end feature to be the length of the sofa string, if any. creates the document annotation if not present only works if not in the base cas
-
getDocumentAnnotation
public <T extends AnnotationFS> T getDocumentAnnotation()
Generic issue: The returned document annotation could be either an instance of DocumentAnnotation or a subclass of it, or an instance of Annotation - the Java cover class used for annotations when JCas is not being used.- Specified by:
getDocumentAnnotation
in interfaceCAS
- Type Parameters:
T
- the Java class for the document annotation. Could be the JCas cover class or FeatureStructure- Returns:
- The document annotation. If it doesn't exist, one is created. The return value is the JCas cover class or the plain Java cover class for FeatureStructures if there is no JCas cover class for this type.
-
getDocumentAnnotationNoCreate
public <T extends AnnotationFS> T getDocumentAnnotationNoCreate()
-
getDocAnnotIter
private FSIterator<Annotation> getDocAnnotIter()
-
ll_getDocumentAnnotation
public int ll_getDocumentAnnotation()
- Returns:
- the fs addr of the document annotation found via the index, or 0 if not there
-
getDocumentLanguage
public java.lang.String getDocumentLanguage()
Description copied from interface:CAS
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 interfaceCAS
- Returns:
- language identifier
-
getDocumentText
public java.lang.String getDocumentText()
Description copied from interface:CAS
Get the document text.- Specified by:
getDocumentText
in interfaceCAS
- Returns:
- The text being analyzed, or
null
if not set.
-
getSofaDataString
public java.lang.String getSofaDataString()
Description copied from interface:CAS
Get the Sofa Data String (a.k.a. the document text).- Specified by:
getSofaDataString
in interfaceCAS
- Returns:
- The Sofa data string, or
null
if not set.
-
getSofaDataArray
public FeatureStructure getSofaDataArray()
Description copied from interface:CAS
Get the Sofa data array.- Specified by:
getSofaDataArray
in interfaceCAS
- Returns:
- The Sofa Data being analyzed, or
null
if not set.
-
getSofaDataURI
public java.lang.String getSofaDataURI()
Description copied from interface:CAS
Get the Sofa data array.- Specified by:
getSofaDataURI
in interfaceCAS
- Returns:
- The Sofa URI being analyzed, or
null
if not set.
-
getSofaDataStream
public java.io.InputStream getSofaDataStream()
Description copied from interface:CAS
Get the Sofa data as a byte stream.- Specified by:
getSofaDataStream
in interfaceCAS
- Returns:
- A stream handle to the Sofa Data, or
null
if not set.
-
getSofaMimeType
public java.lang.String getSofaMimeType()
Description copied from interface:CAS
Get the mime type of the Sofa data being analyzed.- Specified by:
getSofaMimeType
in interfaceCAS
- Returns:
- the mime type of the Sofa
-
getSofa
public Sofa getSofa()
Description copied from interface:CAS
Get the Sofa feature structure associated with this CAS view.
-
ll_getSofa
public int ll_getSofa()
- Specified by:
ll_getSofa
in interfaceLowLevelCAS
- Returns:
- the addr of the sofaFS associated with this view, or 0
-
getViewName
public java.lang.String getViewName()
Description copied from interface:CAS
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 interfaceCAS
- Returns:
- The name of the view
-
mySofaIsValid
private boolean mySofaIsValid()
-
setDocTextFromDeserializtion
void setDocTextFromDeserializtion(java.lang.String text)
-
setDocumentLanguage
public void setDocumentLanguage(java.lang.String languageCode)
Description copied from interface:CAS
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 interfaceCAS
- Parameters:
languageCode
- -
-
setSofaThingsMime
private void setSofaThingsMime(java.util.function.Consumer<Sofa> c, java.lang.String msg)
-
setDocumentText
public void setDocumentText(java.lang.String text)
Description copied from interface:CAS
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 interfaceCAS
- Parameters:
text
- The text to be analyzed.
-
setSofaDataString
public void setSofaDataString(java.lang.String text, java.lang.String mime) throws CASRuntimeException
Description copied from interface:CAS
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 interfaceCAS
- 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)
Description copied from interface:CAS
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 interfaceCAS
- Parameters:
array
- The ArrayFS to be analyzed.mime
- The mime type of the data
-
setSofaDataURI
public void setSofaDataURI(java.lang.String uri, java.lang.String mime) throws CASRuntimeException
Description copied from interface:CAS
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 interfaceCAS
- 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.
-
setCurrentComponentInfo
public void setCurrentComponentInfo(ComponentInfo info)
Description copied from interface:CAS
Informs the CAS of relevant information about the component that is currently processing it. This is called by the framework automatically; users do not need to call it.- Specified by:
setCurrentComponentInfo
in interfaceCAS
- Parameters:
info
- information about the component that is currently processing this CAS.
-
getCurrentComponentInfo
ComponentInfo getCurrentComponentInfo()
-
addFsToIndexes
public void addFsToIndexes(FeatureStructure fs)
Description copied from interface:CAS
Add a feature structure to all appropriate indexes in the repository associated with this CAS View. If no indexes exist for the type of FS that you are adding, then a bag (unsorted) index will be automatically created.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 callremoveFsFromIndexes(...)
on the FS, change the feature values, then calladdFsToIndexes(...)
again.- Specified by:
addFsToIndexes
in interfaceCAS
- Parameters:
fs
- The Feature Structure to be added.- See Also:
CAS.addFsToIndexes(FeatureStructure fs)
-
removeFsFromIndexes
public void removeFsFromIndexes(FeatureStructure fs)
Description copied from interface:CAS
Remove a feature structure from all indexes in the repository associated with this CAS View. The remove operation removes the exact fs from the indexes, unlike operations such as moveTo which use the fs argument as a template. It is not an error if the FS is not present in the indexes.- Specified by:
removeFsFromIndexes
in interfaceCAS
- Parameters:
fs
- The Feature Structure to be removed.- See Also:
CAS.removeFsFromIndexes(FeatureStructure fs)
-
getSofaCasView
public CASImpl getSofaCasView(AnnotationBase fs)
- Parameters:
fs
- the AnnotationBase instance- Returns:
- the view associated with this FS where it could be indexed
-
ll_getSofaCasView
public CASImpl ll_getSofaCasView(int id)
- Specified by:
ll_getSofaCasView
in interfaceLowLevelCAS
-
getNumberOfViews
public int getNumberOfViews()
Creates the initial view (without a sofa) if not present- Returns:
- the number of views, excluding the base view, including the initial view (even if not initially present or no sofa)
-
getNumberOfSofas
public int getNumberOfSofas()
-
getViewIterator
public <T extends CAS> java.util.Iterator<T> getViewIterator()
Description copied from interface:CAS
Get iterator over all views in this CAS. 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 interfaceCAS
- Type Parameters:
T
- generic type of returned view- Returns:
- an iterator which returns all views. Each object returned by the iterator is of type CAS or a subtype.
-
getViewImplIterator
public java.util.Iterator<CASImpl> getViewImplIterator()
excludes initial view if its sofa is not valid- Returns:
- iterator over all views except the base view
-
forAllViews
public void forAllViews(java.util.function.Consumer<CASImpl> processViews)
iterate over all views in view order (by view number)- Parameters:
processViews
- action to perform on the views.
-
forAllSofas
void forAllSofas(java.util.function.Consumer<Sofa> processSofa)
-
forAllIndexRepos
void forAllIndexRepos(java.util.function.Consumer<FSIndexRepositoryImpl> processIr)
Excludes base view's ir, Includes the initial view's ir only if it has a sofa defined- Parameters:
processIr
- the code to execute
-
getViewIterator
public java.util.Iterator<CAS> getViewIterator(java.lang.String localViewNamePrefix)
Description copied from interface:CAS
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 interfaceCAS
- 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 CAS.
-
protectIndexes
public AutoCloseableNoException protectIndexes()
protectIndexes Within the scope of protectIndexes, feature updates are checked, and if found to be a key, and the FS is in a corruptible index, then the FS is removed from the indexes (in all necessary views) (perhaps multiple times if the FS was added to the indexes multiple times), and this removal is recorded on an new instance of FSsTobeReindexed appended to fssTobeAddedback. Later, when the protectIndexes is closed, the tobe items are added back to the indexes.- Specified by:
protectIndexes
in interfaceCAS
- Returns:
- an object used to record things that need adding back
-
dropProtectIndexesLevel
void dropProtectIndexesLevel()
-
addbackModifiedFSs
void addbackModifiedFSs(FSsTobeAddedback addbacks)
This design is to support normal operations where the addbacks could be nested It also handles cases where nested ones were inadvertently left open Three cases: 1) the addbacks are the last element in the stack - remove it from the stack 2) the addbacks are (no longer) in the list - leave stack alone 3) the addbacks are in the list but not at the end - remove it and all later ones, calling addback on each If the "withProtectedindexes" approach is used, it guarantees proper nesting, but the Runnable can't throw checked exceptions. You can do your own try-finally blocks (or use the try with resources form in Java 8 to do a similar thing with no restrictions on what the body can contain.- Parameters:
addbacks
- -
-
protectIndexes
public void protectIndexes(java.lang.Runnable r)
Description copied from interface:CAS
Runs the code in the runnable inside a protection block, where any modifications to features done while in this block will be done in a way to protect any indexes which otherwise might become corrupted by the update action; the protection is achieved by temporarily removing the FS (if it is in the indexes), before the update happens. At the end of the block, affected indexes have any removed-under-the-covers FSs added back.- Specified by:
protectIndexes
in interfaceCAS
- Parameters:
r
- an inner block of code to be run with
-
createMarker
public Marker createMarker()
The current implementation only supports 1 marker call per CAS. Subsequent calls will throw an error. The design is intended to support (at some future point) multiple markers; for this to work, the intent is to extend the MarkerImpl to keep track of indexes into these IntVectors specifying where that marker starts/ends.- Specified by:
createMarker
in interfaceCAS
- Returns:
- a marker object.
-
errorMultipleMarkers
private void errorMultipleMarkers()
-
getCurrentMark
public MarkerImpl getCurrentMark()
-
getModifiedFSList
CASImpl.FsChange[] getModifiedFSList()
- Returns:
- an array of FsChange items, one per modified Fs, sorted in order of fs._id
-
isInModifiedPreexisting
boolean isInModifiedPreexisting(TOP fs)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getCasResets
public int getCasResets()
-
getCasId
public java.lang.String getCasId()
- Returns:
- an identifier for this CAS, globally unique within the classloader
-
getNextFsId
public final int getNextFsId(TOP fs)
-
adjustLastFsV2Size_arrays
public void adjustLastFsV2Size_arrays(int arrayLength)
-
adjustLastFsV2size_nonHeapStoredArrays
public void adjustLastFsV2size_nonHeapStoredArrays()
-
setId2FSsMaybeUnconditionally
public void setId2FSsMaybeUnconditionally(FeatureStructure... fss)
Test case use- Parameters:
fss
- the FSs to include in the id 2 fs map
-
setId2FsMaybeUnconditionally
private void setId2FsMaybeUnconditionally(TOP fs)
-
getLastUsedFsId
public final int getLastUsedFsId()
-
peekNextFsId
public final int peekNextFsId()
-
lastV2IdIncr
public final int lastV2IdIncr()
-
captureLastFsIdForOtherThread
public final void captureLastFsIdForOtherThread()
Call this to capture the current value of fsIdGenerator and make it available to other threads. Must be called on a thread that has been synchronized with the thread used for creating FSs for this CAS.
-
getFsFromId
public <T extends TOP> T getFsFromId(int id)
-
walkReachablePlusFSsSorted
public java.util.List<TOP> walkReachablePlusFSsSorted(java.util.function.Consumer<TOP> action_filtered, MarkerImpl mark, java.util.function.Predicate<TOP> includeFilter, CasTypeSystemMapper typeMapper)
find all of the FSs via the indexes plus what's reachable. sort into order by id, Apply the action to those Return the list of sorted FSs- Parameters:
action_filtered
- action to perform on each item after filteringmark
- null or the markincludeFilter
- null or a filter (exclude items not in other type system)typeMapper
- null or how to map to other type system, used to skip things missing in other type system- Returns:
- sorted list of all found items (ignoring mark)
-
filterAboveMark
static java.util.List<TOP> filterAboveMark(java.util.List<TOP> all, MarkerImpl mark)
-
isInCAS
public boolean isInCAS(FeatureStructure fs)
-
checkArrayPreconditions
public final void checkArrayPreconditions(int len) throws CASRuntimeException
- Throws:
CASRuntimeException
-
emptyFSList
public <T extends TOP> EmptyFSList<T> emptyFSList()
- Specified by:
emptyFSList
in interfaceCAS
- Type Parameters:
T
- the type of the elements of the FSList- Returns:
- a lazily created shared (for this CAS) empty list
-
emptyFloatList
public EmptyFloatList emptyFloatList()
- Specified by:
emptyFloatList
in interfaceCAS
- Returns:
- a lazily created shared (for this CAS) empty list
-
emptyIntegerList
public EmptyIntegerList emptyIntegerList()
- Specified by:
emptyIntegerList
in interfaceCAS
- Returns:
- a lazily created shared (for this CAS) empty list
-
emptyStringList
public EmptyStringList emptyStringList()
- Specified by:
emptyStringList
in interfaceCAS
- Returns:
- a lazily created shared (for this CAS) empty list
-
emptyArray
public CommonArrayFS emptyArray(Type type)
-
emptyFloatArray
public FloatArray emptyFloatArray()
- Specified by:
emptyFloatArray
in interfaceCAS
- Returns:
- a lazily created shared (for this CAS) 0-length array
-
emptyFSArray
public <T extends FeatureStructure> FSArray<T> emptyFSArray()
- Specified by:
emptyFSArray
in interfaceCAS
- Type Parameters:
T
- the type of the elements of the FSArray- Returns:
- a lazily created shared (for this CAS) 0-length FSarray
-
emptyFSArray
public <T extends FeatureStructure> FSArray<T> emptyFSArray(Type type)
- Specified by:
emptyFSArray
in interfaceCAS
- Type Parameters:
T
- the type of the elements of the FSArray- Parameters:
type
- the type of the elements of the FSArray- Returns:
- a lazily created shared (for this CAS) 0-length subtype of FSarray holding elements of type element-type
-
emptyIntegerArray
public IntegerArray emptyIntegerArray()
- Specified by:
emptyIntegerArray
in interfaceCAS
- Returns:
- a lazily created shared (for this CAS) 0-length array
-
emptyStringArray
public StringArray emptyStringArray()
- Specified by:
emptyStringArray
in interfaceCAS
- Returns:
- a lazily created shared (for this CAS) 0-length array
-
emptyDoubleArray
public DoubleArray emptyDoubleArray()
- Specified by:
emptyDoubleArray
in interfaceCAS
- Returns:
- a lazily created shared (for this CAS) 0-length array
-
emptyLongArray
public LongArray emptyLongArray()
- Specified by:
emptyLongArray
in interfaceCAS
- Returns:
- a lazily created shared (for this CAS) 0-length array
-
emptyShortArray
public ShortArray emptyShortArray()
- Specified by:
emptyShortArray
in interfaceCAS
- Returns:
- a lazily created shared (for this CAS) 0-length array
-
emptyByteArray
public ByteArray emptyByteArray()
- Specified by:
emptyByteArray
in interfaceCAS
- Returns:
- a lazily created shared (for this CAS) 0-length array
-
emptyBooleanArray
public BooleanArray emptyBooleanArray()
- Specified by:
emptyBooleanArray
in interfaceCAS
- Returns:
- a lazily created shared (for this CAS) 0-length array
-
emptyList
public EmptyList emptyList(int rangeCode)
- Parameters:
rangeCode
- special codes for serialization use only- Returns:
- the empty list (shared) corresponding to the type
-
emptyListFromTypeCode
public EmptyList emptyListFromTypeCode(int typeCode)
Get an empty list from the type code of a list- Parameters:
typeCode
- -- Returns:
- -
-
copyFeatureExceptFsRef
public static boolean copyFeatureExceptFsRef(TOP fsSrc, FeatureImpl fiSrc, TOP fsTgt, FeatureImpl fiTgt)
Copies a feature from one fs to another FSs may be in different type systems Doesn't copy a feature ref, but instead returns false. This is because feature refs can't cross CASes- Parameters:
fsSrc
- source FSfiSrc
- feature in source to copyfsTgt
- target FSfiTgt
- feature in target to set- Returns:
- false if feature is an fsRef
-
copyArray
public static CommonArrayFS copyArray(TOP srcArray)
-
getBinaryCasSerDes
public BinaryCasSerDes getBinaryCasSerDes()
-
getCsds
CommonSerDesSequential getCsds()
- Returns:
- the saved CommonSerDesSequential info
-
setCsds
void setCsds(CommonSerDesSequential csds)
-
newCsds
CommonSerDesSequential newCsds()
-
deltaMergesComplete
public void deltaMergesComplete()
A space-freeing optimization for use cases where (multiple) delta CASes are being deserialized into this CAS and merged.
-
pearConvert
static <T extends FeatureStructure> T pearConvert(T aFs)
Convert base FS to Pear equivalent 3 cases: 1) no trampoline needed, no conversion, return the original fs 2) trampoline already exists - return that one 3) create new trampoline- Parameters:
aFs
-- Returns:
-
pearConvert
private TOP pearConvert(TOP fs, FsGenerator3 g)
Inner method - after determining there is a generator First see if already have generated the pear version, and if so, use that. Otherwise, create the pear version and save in trampoline table- Parameters:
fs
-g
-- Returns:
-
getBaseFsFromTrampoline
<T extends TOP> T getBaseFsFromTrampoline(T fs)
Given a trampoline FS, return the corresponding base Fs Supports adding Fs (which must be a non-trampoline version) to indexes- Parameters:
fs
- trampoline fs- Returns:
- the corresponding base fs
-
traceFSCreate
public void traceFSCreate(FeatureStructureImplC fs)
-
traceFSfs
void traceFSfs(FeatureStructureImplC fs)
-
traceIndexMod
void traceIndexMod(boolean isAdd, TOP fs, boolean isAddbackOrSkipBag)
-
traceCowCopy
void traceCowCopy(FsIndex_singletype<?> index)
-
traceCowCopyUse
void traceCowCopyUse(FsIndex_singletype<?> index)
-
traceCowReinit
void traceCowReinit(java.lang.String kind, FsIndex_singletype<?> index)
-
traceFSfeat
void traceFSfeat(FeatureStructureImplC fs, FeatureImpl fi, java.lang.Object v)
-
getTraceRepOfObj
private java.lang.String getTraceRepOfObj(FeatureImpl fi, java.lang.Object v)
- Parameters:
v
-- Returns:
- value of the feature: "null" or if FS: type:id (converted to addr) or v.toString() Note: white space in strings converted to "_' characters
-
geti2addr
private java.lang.String geti2addr(int id)
-
traceFSfeatUpdate
void traceFSfeatUpdate(FeatureStructureImplC fs)
-
traceFSflush
public java.lang.StringBuilder traceFSflush()
-
setCAS
@Deprecated public void setCAS(CAS cas)
Deprecated.Description copied from interface:CASMgr
Does nothing, kept only for backwards compatibility
-
inPearContext
boolean inPearContext()
- Returns:
- true if in Pear context, or external context outside AnalysisEngine having a UIMA Extension class loader e.g., if calling a call-back routine loaded outside the AE.
-
suspendPearContext
private void suspendPearContext()
Pear context suspended while creating a base version, when we need to create a new FS (we need to create both the base and the trampoline version)
-
restorePearContext
private void restorePearContext()
-
getInitialHeapSize
public int getInitialHeapSize()
- Returns:
- the initial heap size specified or defaulted
-
reinit
public void reinit(CASSerializer ser)
Deserializer for Java-object serialized instance of CASSerializer.- Parameters:
ser
- - The instance to convert back to a CAS
-
reinit
public void reinit(CASCompleteSerializer casCompSer)
Deserializer for CASCompleteSerializer instances - includes type system and index definitions Never delta- Parameters:
casCompSer
- -
-
reinit
public SerialFormat reinit(java.io.InputStream istream) throws CASRuntimeException
--------------------------------------------------------------------- see Blob Format in CASSerializer This reads in and deserializes CAS data from a stream. Byte swapping may be needed if the blob is from C++ -- C++ blob serialization writes data in native byte order. Supports delta deserialization. For that, the the csds from the serialization event must be used.- Parameters:
istream
- -- Returns:
- - the format of the input stream detected
- Throws:
CASRuntimeException
- wraps IOException
-
maybeHoldOntoFS
void maybeHoldOntoFS(FeatureStructureImplC fs)
-
swapInPearVersion
public void swapInPearVersion(java.lang.Object[] a)
-
collectNonPearVersions
public java.util.Collection<?> collectNonPearVersions(java.util.Collection<?> c)
-
makePearAware
public <T> java.util.Spliterator<T> makePearAware(java.util.Spliterator<T> baseSi)
-
is_ll_enableV2IdRefs
public boolean is_ll_enableV2IdRefs()
- Specified by:
is_ll_enableV2IdRefs
in interfaceLowLevelCAS
- Returns:
- true if the id_to_fs_map mode is enabled
-
ll_enableV2IdRefs
public AutoCloseableNoException ll_enableV2IdRefs(boolean enable)
Description copied from interface:LowLevelCAS
Enables or disables the id_to_fs_map mode.- Specified by:
ll_enableV2IdRefs
in interfaceLowLevelCAS
- Parameters:
enable
- true to enable, false to disable- Returns:
- an AutoClosable whose close method doesn't throw an exception that will reset the mode to what it was when it was changed
-
ll_forceEnableV2IdRefs
AutoCloseableNoException ll_forceEnableV2IdRefs(boolean enable)
-
set_deserialized_doc_annot_not_indexed
public void set_deserialized_doc_annot_not_indexed(Annotation doc_annot)
-
-