Package org.apache.uima.cas.impl
Class TypeSystemImpl
- java.lang.Object
-
- org.apache.uima.cas.impl.TypeSystemImpl
-
- All Implemented Interfaces:
java.lang.Iterable<Type>,TypeSystemMgr,LowLevelTypeSystem,TypeSystem
public class TypeSystemImpl extends java.lang.Object implements TypeSystem, TypeSystemMgr, LowLevelTypeSystem
Type system implementation. This class has static final (constant) values for built-in type codes, feature codes, feature offsets, and feature isInt. - these are used -- for various type-specific internal use -- static final constants in the built-in JCas class definitions - these are set by hand as final constants Threading: An instance of this object needs to be thread safe after creation, because multiple threads are reading info from it. - During creation, only one thread is creating. Association with Class Loaders, after type system is committed Because JCas classes are generated from the merged type system, and then loaded under some class loader, several use cases need to be accommodated. Multiple type systems committed in sequence within one UIMA application. - Under one class loader -- therefore, they share one JCas loaded classes definition - OK provided type system is compatible with JCas loaded definitions At commit time, a type system is compared with existing ones; if it is equal, then the typeImpl and featureImpls and all other instance vars are replaced with existing ones. -- this removes issues in type system mapping needed between "equal" type systems to get feature validation to work. -- implemented via custom hashcode and equals.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) FeatureImplannotBaseSofaFeatTypeImplannotBaseTypeTypeImplannotType(package private) booleanareBuiltInTypesSetup(package private) static java.lang.StringARRAY_TYPE_SUFFIX(package private) TypeImplarrayBaseTypeprivate java.util.Map<Type,Type>arrayComponentTypeToArrayTypeMap from array component Type to the corresponding array typeprivate java.util.Map<java.lang.String,TypeImpl>arrayName2ComponentTypeMap from built-in array name to component Type(package private) TypeImpl_arraybooleanArrayTypeTypeImplbooleanTypeprivate static java.util.Map<java.lang.String,java.lang.String>builtInArrayComponentName2ArrayTypeNameMap from component name to built-in array name(package private) TypeImpl_arraybyteArrayTypeTypeImplbyteTypeprivate java.lang.ClassLoadercl_for_commitprivate static java.util.Map<TypeSystemImpl,java.lang.ref.WeakReference<TypeSystemImpl>>committedTypeSystemsprivate booleandebugstatic java.lang.StringDISABLE_TYPESYSTEM_CONSOLIDATIONDefine this JVM property to disable equal type system consolidation.TypeImpldocType(package private) TypeImpl_arraydoubleArrayTypeTypeImpldoubleTypestatic java.lang.StringENABLE_STRICT_TYPE_SOURCE_CHECKDefine this JVM property to enable strictly checking the source of a type with respect to its type system.(package private) FeatureImplendFeat(package private) java.util.List<FeatureImpl>featuresAn ArrayList, unsynchronized, indexed by feature code, of FeatureImpl objects(package private) TypeImpl_arrayfloatArrayTypeTypeImpl_listfloatEListTypeTypeImpl_listfloatListTypeTypeImpl_listfloatNeListTypeTypeImplfloatType(package private) TypeImpl_arrayfsArrayTypeTypeImpl_listfsEListTypeTypeImpl_listfsListTypeTypeImpl_listfsNeListTypeprivate java.util.Map<java.lang.ClassLoader,FsGenerator3[]>generators4pearsByClassLoaderCache for implementing map from type code -> FsGenerator Shared by all CASes using this type system maps from classloader to generator set for pearsprivate java.util.Map<java.lang.ClassLoader,FsGenerator3[]>generatorsByClassLoaderCache for implementing map from type code -> FsGenerator Shared by all CASes using this type system maps from classloader to generator set for non-pearsprivate static booleanHEAP_STORED_ARRAYHEAP_STORED_ARRAY flag is kept for ser/deserialization compatibilityprivate static intINIT_SIZE_ARRAYS_BUILT_IN_TYPESFor a given class loader, prevent redefinitions of the same type system from(package private) TypeImpl_arrayintArrayTypeTypeImpl_listintEListTypeTypeImpl_listintListTypeTypeImpl_listintNeListTypeTypeImplintTypestatic booleanIS_DISABLE_TYPESYSTEM_CONSOLIDATIONpublic for test casestatic booleanIS_ENABLE_STRICT_TYPE_SOURCE_CHECKprivate static booleanIS_TRACE_JCAS_EXPANDprivate java.util.List<TypeImpl>jcasRegisteredTypesUsed to go from a JCas class's JCasTypeID to the corresponding UIMA type for this type system.(package private) FeatureImpllangFeatprivate static intLEAST_FEATURE_CODEprivate static intLEAST_TYPE_CODE(package private) TypeImpllistBaseTypeprivate booleanlocked(package private) TypeImpl_arraylongArrayTypeTypeImpllongTypeprivate java.lang.invoke.MethodHandles.Lookuplookupprivate static java.lang.invoke.MethodHandleMHC_MINUS_1private intnextIprivate intnextR(package private) TypeImpl_arrayshortArrayTypeTypeImplshortTypeprivate booleanskip_loading_user_jcasprivate static java.util.Map<java.lang.String,SlotKinds.SlotKind>slotKindsForNonArrays(package private) FeatureImplsofaArray(package private) FeatureImplsofaId(package private) FeatureImplsofaMime(package private) FeatureImplsofaNum(package private) FeatureImplsofaStringTypeImplsofaType(package private) FeatureImplsofaUri(package private) FeatureImplstartFeatstatic TypeSystemImplstaticTsi(package private) TypeImpl_arraystringArrayTypeTypeImpl_liststringEListTypeTypeImpl_liststringListTypeTypeImpl_liststringNeListTypeTypeImplstringType(package private) TypeImpl_arraytopArrayType(package private) TypeImpltopTypeprivate java.util.Map<java.lang.String,FSClassRegistry.JCasClassInfo>type2jcci(package private) java.util.Map<java.lang.String,TypeImpl>typeName2TypeImplMap from fully qualified type name to TypeImpl(package private) java.util.List<TypeImpl>typesAn ArrayList, unsynchronized, indexed by typeCode, of Type objectsjava.util.Map<TypeSystemImpl,CasTypeSystemMapper>typeSystemMappersType Mapping Objects used in compressed binary (de)serialization These are in an identity map, key = target type system Threading: this map is used by multiple threads Key = target type system, via a weak reference.(package private) static intUNKNOWN_TYPE_CODEType code that is returned on unknown type names.-
Fields inherited from interface org.apache.uima.cas.impl.LowLevelTypeSystem
UNKNOWN_FEATURE_CODE
-
Fields inherited from interface org.apache.uima.cas.TypeSystem
FEATURE_SEPARATOR, NAMESPACE_SEPARATOR, PARAM_EXCLUDE_PREBUILT_TYPES
-
-
Constructor Summary
Constructors Constructor Description TypeSystemImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description (package private) TypeImpl_arrayaddArrayType(Type componentType, SlotKinds.SlotKind slotKind, boolean isHeapStoredArray, java.lang.Class<?> javaClass)Add an array type.FeatureaddFeature(java.lang.String featureName, Type domainType, Type rangeType)Add an feature to the type system.FeatureaddFeature(java.lang.String shortFeatName, Type domainType, Type rangeType, boolean multipleReferencesAllowed)Add an feature to the type system.private voidaddJCasOffsets(FSClassRegistry.JCasClassInfo jcci, java.util.List<FeatureImpl> tempIntFis, java.util.List<FeatureImpl> tempRefFis, java.util.List<FeatureImpl> tempNsrFis)private voidaddJCasOffsetsWithSupers(java.lang.Class<?> clazz, java.util.List<FeatureImpl> tempIntFis, java.util.List<FeatureImpl> tempRefFis, java.util.List<FeatureImpl> tempNsrFis)Insures that any super class jcas-defined features, not already defined (due to having a corresponding type in this type system) get their features done first Walking up the super chain: - could encounter a class which has no jcci (it's not a jcas class) but has a super class which is one) - so don't stop the up walk.TypeaddStringSubtype(java.lang.String typeName, java.lang.String[] stringList)Inherit from String.TypeImpladdType(java.lang.String typeName, Type superType)Add a new type to the type system.private voidcheckTypeSyntax(java.lang.String typeName)Method checkTypeSyntax.(package private) booleanclassifyAsRefType(java.lang.String name, TypeImpl superType)The range type of features may include special uima types that are not creatable, such as the primitive ones like integer, or string, or subtypes of string.TypeSystemImplcommit()Commit the type system, and load JCas Classes from the UIMA Framework's classloader.TypeSystemImplcommit(java.lang.ClassLoader cl)Commit the type system, and load JCas classes from the passed in classloader.static voidcompareTs(TypeSystem t1, TypeSystem t2)private voidcomputeAdjustedFeatureOffsets(TypeImpl ti)This is the actual offset for the feature, in either the int or ref array Offsets for super types come before types, because multiple subtypes can share the same super type Offsets due to JCas defined features are set before those from type systems, because the same JCas class might be used with different type system, and this increases the chance that the assignment is still valid.private TypeImplcomputeArrayParentFromComponentType(Type componentType)Given a component type, return the parent type of the corresponding array type, without needing the corresponding array type to exist (yet).private voidcomputeFeatureOffsets(TypeImpl ti, int next)Feature "ids" - offsets without adjusting for whether or not they're in the class itselfstatic java.lang.invoke.MutableCallSitecreateCallSite(java.lang.Class<? extends TOP> clazz, java.lang.String featName)Creates and returns a new MutableCallSite, // * recording it in list of all callsites for this type, in a map by typename // * // * Done this way because // * - can't be a classloader-wide list of call sites - some might not be associated with this type system // * - can't be a typesystem-wide list of call sites - the JCas class might be used by multiple type systems // * and the first one to load it would set this value.static java.lang.invoke.MutableCallSitecreateCallSiteForBuiltIn(java.lang.Class<? extends TOP> clazz, java.lang.String featName)INTERNAL API - DO NOT USE, MAY CHANGE WITHOUT NOTICE!booleandirectlySubsumes(TypeImpl t1, TypeImpl t2)voiddumpTypeSystem()booleanequals(java.lang.Object obj)private TypeSystemImplfinalizeCommit(java.lang.ClassLoader cl)(package private) voidfixupFSArrayTypes(TypeImpl featRange, TOP arrayFs)When deserializing Xmi and XCAS, Arrays of Feature Structures are encoded as FSArray types, but they may have a more restrictive typing, e.g.static intgetAdjustedFeatureOffset(java.lang.String featName)******** OBSOLETE - only left in for supporting some jcas style in alpha level ************* This code is run when a JCas class is loaded and resolved, for the first time, as part of type system commit, or as part of statically loading the FSClassRegister class (where this is done for all the built-ins, once).(package private) static intgetAdjustedFeatureOffset(TypeImpl type, java.lang.String featName)java.util.List<TypeImpl>getAllTypes()(package private) static java.lang.StringgetArrayComponentName(java.lang.String arrayTypeName)TypegetArrayType(Type componentType)Get or Create an array type with component typecomponentType.private static java.lang.StringgetArrayTypeName(java.lang.String typeName)For component xyz, returns "xyz[]"java.util.Vector<Type>getDirectlySubsumedTypes(Type type)Get a vector of the types directly subsumed by a given type.java.util.List<Type>getDirectSubtypes(Type type)Get a List of the types directly subsumed by a given type.FeaturegetFeature(java.lang.String featureName)Deprecated.private FeatureImplgetFeature(java.lang.String typeName, java.lang.String featureShortName)private FeatureImplgetFeature(Type type, java.lang.String featureShortName)FeatureImplgetFeatureByFullName(java.lang.String featureName)Get an feature object for a given name.(package private) FeatureImplgetFeatureForCode(int featureCode)(package private) FeatureImplgetFeatureForCode_checked(int featureCode)(package private) intgetFeatureOffset(int feat)Feature Code to Offset Offset has no clear meaning in V3intgetFeatureOffset(TypeImpl ti, java.lang.String featureShortName)java.util.Iterator<Feature>getFeatures()Get a list of features, in no particular order.FsGenerator3[]getGeneratorsForClassLoader(java.lang.ClassLoader cl, boolean isPear)Called when switching or initializing CAS's shared-view-data instance of FsGenerator[] generators are kept in a map, unique for each type system, keyed by classloader.java.util.Vector<Feature>getIntroFeatures(Type type)TypeImplgetJCasRegisteredType(int i)Convert between fixed JCas class int (set when it is loaded) and this type system's TypeImpl.(package private) FSClassRegistry.JCasClassInfogetJcci(java.lang.String typeName)private intgetLargestFeatureCode()intgetLargestTypeCode()LowLevelTypeSystemgetLowLevelTypeSystem()Return the low-level view of this type system.intgetNumberOfFeatures()Get the overall number of features defined in the type system.intgetNumberOfTypes()Get the overall number of types defined in the type system.private FSClassRegistry.JCasClassInfogetOrCreateJcci(TypeImpl ti)TypegetParent(Type t)Get the parent type for input type.java.util.List<Type>getProperlySubsumedTypes(Type type)Return the list of all types subsumed by the input type.(package private) static SlotKinds.SlotKindgetSlotKindFromType(Type rangeType)Given a range type, return the corresponding slot kind string -> Slot_StrRef, long and double -> ...Ref boolean, byte, int, short, float, -> withoutRef(package private) intgetSmallestFeature()(package private) intgetSmallestType()TypeImplgetTopType()Get the top type, i.e., the root of the type system.TypeImplgetTopTypeImpl()TypeImplgetType(java.lang.String typeName)Get a type object for a given name.intgetTypeArraySize()static intgetTypeClass(TypeImpl ti)TypeImplgetTypeForCode(int typeCode)TypeImplgetTypeForCode_checked(int typeCode)java.util.Iterator<Type>getTypeIterator()Get an iterator over all types, in no particular order.TypeNameSpacegetTypeNameSpace(java.lang.String name)Create a type name space object for the name parameter.(package private) CasTypeSystemMappergetTypeSystemMapper(TypeSystemImpl tgtTs)(package private) CasTypeSystemMappergetTypeSystemMapperInner(TypeSystemImpl tgtTs)inthashCode()HashCode and Equals used to compare two type system.intintro(int feat)booleanisAnnotationBaseOrSubtype(int typecode)booleanisAnnotationBaseOrSubtype(Type type)booleanisAnnotationOrSubtype(Type type)booleanisApprop(int typecode, int featcode)Check if feature is appropriate for type (i.e., type is subsumed by domain type of feature).(package private) static booleanisArrayTypeNameButNotBuiltIn(java.lang.String typeName)booleanisCommitted()Check if this instance has been committed.(package private) booleanisFeature(int featureCode)booleanisInInt(Type rangeType)booleanisRefType(TypeImpl type)booleanisType(int typecode)java.util.Iterator<Type>iterator()int[]ll_getAppropriateFeatures(int typecode)Get an array of the appropriate features for this type.intll_getArrayType(int componentTypeCode)Get the type code for the array type withcomponentTypeCodeas component type code.intll_getCodeForFeature(Feature feature)Get the code for a given feature object.intll_getCodeForFeatureName(java.lang.String featureName)Get the feature code for a given feature name.intll_getCodeForType(Type type)Get the code of an existing type object.intll_getCodeForTypeName(java.lang.String typeName)Get the type code for a given type name.intll_getComponentType(int arrayTypeCode)Get the component type of an array type code.intll_getDomainType(int featureCode)Get the domain type for a given feature.Featurell_getFeatureForCode(int featureCode)Get a feature object for a given code.intll_getParentType(int typeCode)Get the parent type for the input type.intll_getRangeType(int featureCode)Get the range type for a given feature.java.lang.String[]ll_getStringSet(int typeCode)Get the string set (sorted) for a string subtype.intll_getTypeClass(int typeCode)Determine the type class of a type.Typell_getTypeForCode(int typeCode)Get a type object for a given code.booleanll_isArrayType(int typeCode)Check iftypeCodeis the type code of an array type.booleanll_isPrimitiveType(int typeCode)Check iftypeCodeis the type code of a primitive type.booleanll_isRefType(int typeCode)Checks if the type code is that of a reference type (anything that's not a basic type, currently Integer, String, Float, Boolean, Byte, Short, Long, Double, and subtypes of String - specifying allowed-values).booleanll_isStringSubtype(int typecode)Check if type is a string subtype.booleanll_isValidTypeCode(int typeCode)Check the input type code.booleanll_subsumes(int superType, int type)Check subsumption between two types.private voidmaybeAddJCasOffsets(TypeImpl ti, java.util.List<FeatureImpl> tempIntFis, java.util.List<FeatureImpl> tempRefFis, java.util.List<FeatureImpl> tempNsrFis)(package private) voidnewTypeCheckNoInheritanceFinalCheck(java.lang.String typeName, Type superType)(package private) voidnewTypeChecks(java.lang.String typeName, Type superType)intrange(int feat)Get the range type for a feature.FeatureImplrefreshFeature(Feature f)TypeImplrefreshType(Type t)voidset_skip_loading_user_jcas(boolean v)(package private) voidsetFeatureAdjustedOffset(FeatureImpl fi, java.util.List<FeatureImpl> tempIntFis, java.util.List<FeatureImpl> tempRefFis, java.util.List<FeatureImpl> tempNsr)voidsetFeatureFinal(Type type)Make type feature final in the sense that no new features can be added to this type.voidsetInheritanceFinal(Type type)Block any further inheritance from this type.(package private) voidsetJCasRegisteredType(int typeIndexID, TypeImpl ti)(package private) voidsetOffset2Feat(java.util.List<FeatureImpl> tempIntFis, java.util.List<FeatureImpl> tempRefFis, java.util.List<FeatureImpl> tempNsr, FeatureImpl fi, int next)private static voidsetTypeFinal(Type type)booleansubsumes(int superType, int type)Check if the first argument subsumes the secondbooleansubsumes(Type superType, Type subType)Does one type inherit from the other? There are two versions.private voidthrowMissingUIMAtype(int typeIndex)For a given JCasRegistry index, that doesn't have a corresponding UIMA type, throw an appropriate exceptionjava.lang.StringtoString()This writes out the type hierarchy in a human-readable form.intunify(int t1, int t2)
-
-
-
Field Detail
-
IS_TRACE_JCAS_EXPAND
private static final boolean IS_TRACE_JCAS_EXPAND
- See Also:
- Constant Field Values
-
debug
private final boolean debug
- See Also:
- Constant Field Values
-
DISABLE_TYPESYSTEM_CONSOLIDATION
public static final java.lang.String DISABLE_TYPESYSTEM_CONSOLIDATION
Define this JVM property to disable equal type system consolidation. When a type system is committed, it normally is compared with other committed type systems that are still available (i.e. not garbage collected) to see if an existing type system is equal to the new one. - if so, then the existing one is reused. This may cause problems for applications which have obtained references to types and features of a type system before it is committed; the committed version may have different (but "equal") types and features.- See Also:
- Constant Field Values
-
ENABLE_STRICT_TYPE_SOURCE_CHECK
public static final java.lang.String ENABLE_STRICT_TYPE_SOURCE_CHECK
Define this JVM property to enable strictly checking the source of a type with respect to its type system. Normally (i.e. when typesystem consolidation is enabled), types that are semantically equivalent should come from the same type system instances. There could be bugs (in client or framework code) or legacy code which simply ignores this requirement and still works. Therefore, this property allow to restore the old non-strict-checking behavior.- See Also:
- Constant Field Values
-
IS_DISABLE_TYPESYSTEM_CONSOLIDATION
public static final boolean IS_DISABLE_TYPESYSTEM_CONSOLIDATION
public for test case
-
IS_ENABLE_STRICT_TYPE_SOURCE_CHECK
public static final boolean IS_ENABLE_STRICT_TYPE_SOURCE_CHECK
-
MHC_MINUS_1
private static final java.lang.invoke.MethodHandle MHC_MINUS_1
-
UNKNOWN_TYPE_CODE
static final int UNKNOWN_TYPE_CODE
Type code that is returned on unknown type names.- See Also:
- Constant Field Values
-
LEAST_TYPE_CODE
private static final int LEAST_TYPE_CODE
- See Also:
- Constant Field Values
-
LEAST_FEATURE_CODE
private static final int LEAST_FEATURE_CODE
- See Also:
- Constant Field Values
-
ARRAY_TYPE_SUFFIX
static final java.lang.String ARRAY_TYPE_SUFFIX
- See Also:
- Constant Field Values
-
HEAP_STORED_ARRAY
private static final boolean HEAP_STORED_ARRAY
HEAP_STORED_ARRAY flag is kept for ser/deserialization compatibility- See Also:
- Constant Field Values
-
INIT_SIZE_ARRAYS_BUILT_IN_TYPES
private static final int INIT_SIZE_ARRAYS_BUILT_IN_TYPES
For a given class loader, prevent redefinitions of the same type system from- See Also:
- Constant Field Values
-
builtInArrayComponentName2ArrayTypeName
private static final java.util.Map<java.lang.String,java.lang.String> builtInArrayComponentName2ArrayTypeName
Map from component name to built-in array name
-
slotKindsForNonArrays
private static final java.util.Map<java.lang.String,SlotKinds.SlotKind> slotKindsForNonArrays
-
committedTypeSystems
private static final java.util.Map<TypeSystemImpl,java.lang.ref.WeakReference<TypeSystemImpl>> committedTypeSystems
-
arrayName2ComponentType
private final java.util.Map<java.lang.String,TypeImpl> arrayName2ComponentType
Map from built-in array name to component Type
-
topType
final TypeImpl topType
-
intType
public final TypeImpl intType
-
stringType
public final TypeImpl stringType
-
floatType
public final TypeImpl floatType
-
arrayBaseType
final TypeImpl arrayBaseType
-
intArrayType
final TypeImpl_array intArrayType
-
floatArrayType
final TypeImpl_array floatArrayType
-
stringArrayType
final TypeImpl_array stringArrayType
-
fsArrayType
final TypeImpl_array fsArrayType
-
topArrayType
final TypeImpl_array topArrayType
-
sofaType
public final TypeImpl sofaType
-
annotType
public final TypeImpl annotType
-
annotBaseType
public final TypeImpl annotBaseType
-
docType
public final TypeImpl docType
-
byteType
public final TypeImpl byteType
-
byteArrayType
final TypeImpl_array byteArrayType
-
booleanType
public final TypeImpl booleanType
-
booleanArrayType
final TypeImpl_array booleanArrayType
-
shortType
public final TypeImpl shortType
-
shortArrayType
final TypeImpl_array shortArrayType
-
longType
public final TypeImpl longType
-
longArrayType
final TypeImpl_array longArrayType
-
doubleType
public final TypeImpl doubleType
-
doubleArrayType
final TypeImpl_array doubleArrayType
-
listBaseType
final TypeImpl listBaseType
-
intListType
public final TypeImpl_list intListType
-
floatListType
public final TypeImpl_list floatListType
-
stringListType
public final TypeImpl_list stringListType
-
fsListType
public final TypeImpl_list fsListType
-
intEListType
public final TypeImpl_list intEListType
-
floatEListType
public final TypeImpl_list floatEListType
-
stringEListType
public final TypeImpl_list stringEListType
-
fsEListType
public final TypeImpl_list fsEListType
-
intNeListType
public final TypeImpl_list intNeListType
-
floatNeListType
public final TypeImpl_list floatNeListType
-
stringNeListType
public final TypeImpl_list stringNeListType
-
fsNeListType
public final TypeImpl_list fsNeListType
-
typeName2TypeImpl
final java.util.Map<java.lang.String,TypeImpl> typeName2TypeImpl
Map from fully qualified type name to TypeImpl
-
arrayComponentTypeToArrayType
private java.util.Map<Type,Type> arrayComponentTypeToArrayType
Map from array component Type to the corresponding array type
-
types
final java.util.List<TypeImpl> types
An ArrayList, unsynchronized, indexed by typeCode, of Type objects
-
jcasRegisteredTypes
private final java.util.List<TypeImpl> jcasRegisteredTypes
Used to go from a JCas class's JCasTypeID to the corresponding UIMA type for this type system. - when doing "new Foo(jcas)" - when referring to a type using its JCas typeID Used as a map, the key is the JCas loaded type id, set once when each JCas class is loaded. value is the corresponding TypeImpl When multiple type systems are being initialized in parallel, this list maybe updated on different threads. Access to it is synchronized on the object itself A single JCas type ID (corresponding to a single JCas type) might be used for many UIMA types. but they are always in a type hierarchy, and the top most one is the one stored here
-
features
final java.util.List<FeatureImpl> features
An ArrayList, unsynchronized, indexed by feature code, of FeatureImpl objects
-
locked
private boolean locked
-
areBuiltInTypesSetup
volatile boolean areBuiltInTypesSetup
-
startFeat
FeatureImpl startFeat
-
endFeat
FeatureImpl endFeat
-
langFeat
FeatureImpl langFeat
-
sofaNum
FeatureImpl sofaNum
-
sofaId
FeatureImpl sofaId
-
sofaMime
FeatureImpl sofaMime
-
sofaArray
FeatureImpl sofaArray
-
sofaString
FeatureImpl sofaString
-
sofaUri
FeatureImpl sofaUri
-
annotBaseSofaFeat
FeatureImpl annotBaseSofaFeat
-
generatorsByClassLoader
private final java.util.Map<java.lang.ClassLoader,FsGenerator3[]> generatorsByClassLoader
Cache for implementing map from type code -> FsGenerator Shared by all CASes using this type system maps from classloader to generator set for non-pears
-
generators4pearsByClassLoader
private final java.util.Map<java.lang.ClassLoader,FsGenerator3[]> generators4pearsByClassLoader
Cache for implementing map from type code -> FsGenerator Shared by all CASes using this type system maps from classloader to generator set for pears
-
nextI
private int nextI
-
nextR
private int nextR
-
type2jcci
private java.util.Map<java.lang.String,FSClassRegistry.JCasClassInfo> type2jcci
-
lookup
private java.lang.invoke.MethodHandles.Lookup lookup
-
cl_for_commit
private java.lang.ClassLoader cl_for_commit
-
skip_loading_user_jcas
private boolean skip_loading_user_jcas
-
typeSystemMappers
public final java.util.Map<TypeSystemImpl,CasTypeSystemMapper> typeSystemMappers
Type Mapping Objects used in compressed binary (de)serialization These are in an identity map, key = target type system Threading: this map is used by multiple threads Key = target type system, via a weak reference. Automatically cleared via WeakHashMap The map itself is not synchronized, because all accesses to it are from the synchronized getTypeSystemMapper method
-
staticTsi
public static final TypeSystemImpl staticTsi
-
-
Method Detail
-
getSmallestType
final int getSmallestType()
-
getSmallestFeature
final int getSmallestFeature()
-
getTypeArraySize
public final int getTypeArraySize()
-
getParent
public Type getParent(Type t)
Description copied from interface:TypeSystemGet the parent type for input type.- Specified by:
getParentin interfaceTypeSystem- Parameters:
t- The type we want to know the parent of.- Returns:
- The parent type, or
nullfor the top type.
-
getLargestTypeCode
public final int getLargestTypeCode()
-
isType
public boolean isType(int typecode)
- Parameters:
typecode- to check if it's in the range of valid type codes- Returns:
- true if it is
-
getType
public TypeImpl getType(java.lang.String typeName)
Get a type object for a given name.- Specified by:
getTypein interfaceTypeSystem- Parameters:
typeName- The name of the type.- Returns:
- A type object, or
nullif no such type exists.
-
getFeatureByFullName
public FeatureImpl getFeatureByFullName(java.lang.String featureName)
Get an feature object for a given name.- Specified by:
getFeatureByFullNamein interfaceTypeSystem- Parameters:
featureName- The name of the feature.- Returns:
- An feature object, or
nullif no such feature exists.
-
getArrayTypeName
private static final java.lang.String getArrayTypeName(java.lang.String typeName)
For component xyz, returns "xyz[]"- Parameters:
componentType- the component type- Returns:
- the name of the component + []
-
getArrayComponentName
static final java.lang.String getArrayComponentName(java.lang.String arrayTypeName)
-
isArrayTypeNameButNotBuiltIn
static boolean isArrayTypeNameButNotBuiltIn(java.lang.String typeName)
-
newTypeChecks
void newTypeChecks(java.lang.String typeName, Type superType)
-
newTypeCheckNoInheritanceFinalCheck
void newTypeCheckNoInheritanceFinalCheck(java.lang.String typeName, Type superType)
-
checkTypeSyntax
private void checkTypeSyntax(java.lang.String typeName) throws CASAdminExceptionMethod checkTypeSyntax.- Parameters:
typeName- -- Throws:
CASAdminException
-
addType
public TypeImpl addType(java.lang.String typeName, Type superType) throws CASAdminException
Add a new type to the type system. Called to add types for new (not built-in) types, except for: arrays string subtypes primitives All of these have special addType methods- Specified by:
addTypein interfaceTypeSystemMgr- Parameters:
typeName- The name of the new type.superType- The type node under which the new type should be attached.- Returns:
- The new type, or
nulliftypeNameis already in use. - Throws:
CASAdminException- IftypeNameis not a legal type name, type system is locked, ormotheris inheritance final.
-
isInInt
public boolean isInInt(Type rangeType)
-
addFeature
public Feature addFeature(java.lang.String featureName, Type domainType, Type rangeType) throws CASAdminException
Description copied from interface:TypeSystemMgrAdd an feature to the type system. Note: A subtype may define a feature that is also defined by a supertype. If the supertype definition is already present, then the subtype definition is "merged": using the merging criteria: ranges must match. Different isMultipleReferencesAllowed settings are OK; The supertype's setting takes precedence.- Specified by:
addFeaturein interfaceTypeSystemMgr- Parameters:
featureName- The name of the new feature.domainType- The type that defines the domain of the feature.rangeType- The type that defines the range of the feature.- Returns:
- The new feature object, or
nulliffeatureNameis already in use fordomainTypewith the same range (if the range is different, an exception is thrown). - Throws:
CASAdminException- IffeatureNameis not a legal feature name, the type system is locked ordomainTypeis feature final. Also iffeatureNamehas already been defined ondomainType(or a supertype) with a different range thanrangeType.
-
addFeature
public Feature addFeature(java.lang.String shortFeatName, Type domainType, Type rangeType, boolean multipleReferencesAllowed) throws CASAdminException
Description copied from interface:TypeSystemMgrAdd an feature to the type system.- Specified by:
addFeaturein interfaceTypeSystemMgr- Parameters:
shortFeatName- The name of the new feature.domainType- The type that defines the domain of the feature.rangeType- The type that defines the range of the feature.multipleReferencesAllowed- If therangeTypeis an array type, you can use this flag to enforce that the feature value is not referenced anywhere else. This is currently only used for XMI serialization. Defaults totrue.- Returns:
- The new feature object, or
nulliffeatureNameis already in use fordomainTypewith the same range (if the range is different, an exception is thrown). - Throws:
CASAdminException- IffeatureNameis not a legal feature name, the type system is locked ordomainTypeis feature final. Also iffeatureNamehas already been defined ondomainType(or a supertype) with a different range thanrangeType.- See Also:
TypeSystemMgr.addFeature(String, Type, Type)
-
getSlotKindFromType
static SlotKinds.SlotKind getSlotKindFromType(Type rangeType)
Given a range type, return the corresponding slot kind string -> Slot_StrRef, long and double -> ...Ref boolean, byte, int, short, float, -> withoutRef- Parameters:
rangeType-- Returns:
-
getTypeIterator
public java.util.Iterator<Type> getTypeIterator()
Get an iterator over all types, in no particular order.- Specified by:
getTypeIteratorin interfaceTypeSystem- Returns:
- The iterator.
-
getTopType
public TypeImpl getTopType()
Get the top type, i.e., the root of the type system.- Specified by:
getTopTypein interfaceTypeSystem- Returns:
- The top type.
-
getTopTypeImpl
public TypeImpl getTopTypeImpl()
-
getProperlySubsumedTypes
public java.util.List<Type> getProperlySubsumedTypes(Type type)
Return the list of all types subsumed by the input type. Note: the list does not include the type itself.- Specified by:
getProperlySubsumedTypesin interfaceTypeSystem- Parameters:
type- Input type.- Returns:
- The list of types subsumed by
type.
-
getDirectlySubsumedTypes
public java.util.Vector<Type> getDirectlySubsumedTypes(Type type)
Get a vector of the types directly subsumed by a given type.- Specified by:
getDirectlySubsumedTypesin interfaceTypeSystem- Parameters:
type- The input type.- Returns:
- A vector of the directly subsumed types.
-
getDirectSubtypes
public java.util.List<Type> getDirectSubtypes(Type type)
Description copied from interface:TypeSystemGet a List of the types directly subsumed by a given type.- Specified by:
getDirectSubtypesin interfaceTypeSystem- Parameters:
type- The input type.- Returns:
- A List of the directly subsumed types.
-
subsumes
public boolean subsumes(Type superType, Type subType)
Does one type inherit from the other? There are two versions. Fast: but only works after commit: aTypeImplInstance.subsumes(otherTypeImpl) Slower: this routine. This routine is called from fast one if not committed.- Specified by:
subsumesin interfaceTypeSystem- Parameters:
superType- Supertype.subType- Subtype.- Returns:
trueiffsubinherits fromsuper.
-
getNumberOfTypes
public int getNumberOfTypes()
Get the overall number of types defined in the type system.- Returns:
- - the number of types defined in the type system.
-
getNumberOfFeatures
public int getNumberOfFeatures()
Get the overall number of features defined in the type system.- Returns:
- - the number of features defined in the type system.
-
unify
public int unify(int t1, int t2)
-
subsumes
public boolean subsumes(int superType, int type)Check if the first argument subsumes the second- Parameters:
superType- -type- -- Returns:
- true if first argument subsumes the second
-
toString
public java.lang.String toString()
This writes out the type hierarchy in a human-readable form.- Overrides:
toStringin classjava.lang.Object
-
commit
public TypeSystemImpl commit()
Description copied from interface:TypeSystemMgrCommit the type system, and load JCas Classes from the UIMA Framework's classloader. The type system will be locked and no longer writable. WARNING: Users should not call this, but instead call ((CASImpl) theAssociatedCAS).commitTypeSystem() in order to set up the parts of the CAS that should be set up when the type system is committed. WARNING: This API will use the UIMA Framework's class loader to find a load JCas classes. If you have JCas classes under some other class loader you wish to use (perhaps you are setting a ResourceManager's extension classpath, which creates a class loader), use the commit which takes a class loader as an argument, and pass in the class loader where the JCas classes are.- Specified by:
commitin interfaceTypeSystemMgr- Returns:
- the committed type system. Note that this may be the same object as "this" or a different (but equal) object. Type systems are cached and recreating the exact same type system repeatedly will return the original one.
- See Also:
TypeSystemMgr.commit()
-
commit
public TypeSystemImpl commit(java.lang.ClassLoader cl)
Description copied from interface:TypeSystemMgrCommit the type system, and load JCas classes from the passed in classloader. The type system will be locked and no longer writable. WARNING: Users should not call this, but instead call ((CASImpl) theAssociatedCAS).commitTypeSystem() in order to set up the parts of the CAS that should be set up when the type system is committed.- Specified by:
commitin interfaceTypeSystemMgr- Parameters:
cl- the JCas class loader- Returns:
- the committed type system. Note that this may be the same object as "this" or a different (but equal) object. Type systems are cached and recreating the exact same type system repeatedly will return the original one.
- See Also:
TypeSystemMgr.commit(ClassLoader)
-
finalizeCommit
private TypeSystemImpl finalizeCommit(java.lang.ClassLoader cl)
-
computeAdjustedFeatureOffsets
private void computeAdjustedFeatureOffsets(TypeImpl ti)
This is the actual offset for the feature, in either the int or ref array Offsets for super types come before types, because multiple subtypes can share the same super type Offsets due to JCas defined features are set before those from type systems, because the same JCas class might be used with different type system, and this increases the chance that the assignment is still valid. Special handling for JCas defined features which are missing in the type system. - these are allocated artificial "feature impls", which participate in the offset setting, but not in anything else (like serialization) Special handling for JCas super types which have no corresponding uima types - features inferred from these are incorporated for purposes of computing offsets (only), because some later type system might have these. Sets offset into 2 places: - the FeatureImpl - a set of arrays in the type: one mapping offset to featureImpl for refs one mapping offset to featureImpl for ints one mapping offset to non-fs-refs (for efficiency in enquing these before refs) also sets the number-of-used slots (int / ref) for allocating, in the type- Parameters:
ti- - the type
-
addJCasOffsetsWithSupers
private void addJCasOffsetsWithSupers(java.lang.Class<?> clazz, java.util.List<FeatureImpl> tempIntFis, java.util.List<FeatureImpl> tempRefFis, java.util.List<FeatureImpl> tempNsrFis)Insures that any super class jcas-defined features, not already defined (due to having a corresponding type in this type system) get their features done first Walking up the super chain: - could encounter a class which has no jcci (it's not a jcas class) but has a super class which is one) - so don't stop the up walk. Stop the up walk when - reach the TOP or Object - reach a class which has a corresponding uima type (the assumption is that this type is a super type- Parameters:
ti- the type associated with clazz, or null, if noneclazz- the class whose supertypes are being scanned. May not be a JCas classtempIntFis- the array of int offsets (refs to feature impls (maybe jcas-only)tempRefFis- the array of ref offsets (refs to feature impls (maybe jcas-only)tempNsrFis- a list of non fs-ref ref values
-
maybeAddJCasOffsets
private void maybeAddJCasOffsets(TypeImpl ti, java.util.List<FeatureImpl> tempIntFis, java.util.List<FeatureImpl> tempRefFis, java.util.List<FeatureImpl> tempNsrFis)
- Parameters:
ti- the type having offsets set up forjcci- a corresponding jcci, either for this type or for a super type when the super type is not in this uima type systemtempIntFis- list to augment with additional slotstempRefFis- list to augment with additional slots
-
addJCasOffsets
private void addJCasOffsets(FSClassRegistry.JCasClassInfo jcci, java.util.List<FeatureImpl> tempIntFis, java.util.List<FeatureImpl> tempRefFis, java.util.List<FeatureImpl> tempNsrFis)
-
setFeatureAdjustedOffset
void setFeatureAdjustedOffset(FeatureImpl fi, java.util.List<FeatureImpl> tempIntFis, java.util.List<FeatureImpl> tempRefFis, java.util.List<FeatureImpl> tempNsr)
-
setOffset2Feat
void setOffset2Feat(java.util.List<FeatureImpl> tempIntFis, java.util.List<FeatureImpl> tempRefFis, java.util.List<FeatureImpl> tempNsr, FeatureImpl fi, int next)
-
getOrCreateJcci
private FSClassRegistry.JCasClassInfo getOrCreateJcci(TypeImpl ti)
-
getJcci
FSClassRegistry.JCasClassInfo getJcci(java.lang.String typeName)
-
computeFeatureOffsets
private void computeFeatureOffsets(TypeImpl ti, int next)
Feature "ids" - offsets without adjusting for whether or not they're in the class itself- Parameters:
ti- a type to compute these fornext- - the next offset
-
isCommitted
public boolean isCommitted()
Description copied from interface:TypeSystemMgrCheck if this instance has been committed.- Specified by:
isCommittedin interfaceTypeSystemMgr- Returns:
trueiff this instance has been committed.- See Also:
TypeSystemMgr.isCommitted()
-
isAnnotationBaseOrSubtype
public boolean isAnnotationBaseOrSubtype(int typecode)
- Parameters:
typecode- for a type- Returns:
- true if type is AnnotationBase or a subtype of it
-
isAnnotationBaseOrSubtype
public boolean isAnnotationBaseOrSubtype(Type type)
-
isAnnotationOrSubtype
public boolean isAnnotationOrSubtype(Type type)
- Parameters:
type- a type- Returns:
- true if type is Annotation or a subtype of it
-
getFeature
@Deprecated public Feature getFeature(java.lang.String featureName)
Deprecated.
-
setFeatureFinal
public void setFeatureFinal(Type type)
Description copied from interface:TypeSystemMgrMake type feature final in the sense that no new features can be added to this type. Note that making a type feature final automatically makes all ancestors of that type feature final as well.- Specified by:
setFeatureFinalin interfaceTypeSystemMgr- Parameters:
type- The type to be made feature final.- See Also:
TypeSystemMgr.setFeatureFinal(org.apache.uima.cas.Type)
-
setInheritanceFinal
public void setInheritanceFinal(Type type)
Description copied from interface:TypeSystemMgrBlock any further inheritance from this type. Does not mean that the type can have no sub-types, just that no new ones can be introduced.- Specified by:
setInheritanceFinalin interfaceTypeSystemMgr- Parameters:
type- the type to block subtypes on- See Also:
TypeSystemMgr.setInheritanceFinal(org.apache.uima.cas.Type)
-
getTypeNameSpace
public TypeNameSpace getTypeNameSpace(java.lang.String name)
Description copied from interface:TypeSystemCreate a type name space object for the name parameter.- Specified by:
getTypeNameSpacein interfaceTypeSystem- Parameters:
name- The name of the name space.- Returns:
- A
TypeNameSpaceobject corresponding toname, ornull, ifnameis not a legal type name space identifier.
-
getArrayType
public Type getArrayType(Type componentType)
Description copied from interface:TypeSystemGet or Create an array type with component typecomponentType.- Specified by:
getArrayTypein interfaceTypeSystem- Parameters:
componentType- The type of the elements of the resulting array type. This can be any type, even another array type.- Returns:
- The array type with the corresponding component type. If it doesn't exist, a new TypeImplArray is created for it.
- See Also:
TypeSystem.getArrayType(Type)
-
addStringSubtype
public Type addStringSubtype(java.lang.String typeName, java.lang.String[] stringList) throws CASAdminException
Description copied from interface:TypeSystemMgrInherit from String. The only way you can inherit from String is by providing a restriction to a set of strings that are possible values for features of this type. This restriction will be checked when such feature values are set. Note that you can not introduce any features on such types, nor can you subtype them any further.- Specified by:
addStringSubtypein interfaceTypeSystemMgr- Parameters:
typeName- The name of the type to be created.stringList- The list of legal string values for this string type.- Returns:
- The resulting type, or
nullif the type is already defined. - Throws:
CASAdminException- If the type system is locked.- See Also:
TypeSystemMgr.addStringSubtype(java.lang.String, java.lang.String[])
-
addArrayType
TypeImpl_array addArrayType(Type componentType, SlotKinds.SlotKind slotKind, boolean isHeapStoredArray, java.lang.Class<?> javaClass)
Add an array type. This is called for builtin array types, and when processing a Feature specification that represents an FSArray of a particular type- Parameters:
componentType- the component type- Returns:
- a TypeImplArray
-
setTypeFinal
private static void setTypeFinal(Type type)
-
getFeature
private FeatureImpl getFeature(java.lang.String typeName, java.lang.String featureShortName)
-
getFeature
private FeatureImpl getFeature(Type type, java.lang.String featureShortName)
-
getFeatureOffset
public int getFeatureOffset(TypeImpl ti, java.lang.String featureShortName)
- Parameters:
ti- the typefeatureShortName- the name of the feature- Returns:
- the offset in the storage array for this feature
-
getTypeSystemMapper
CasTypeSystemMapper getTypeSystemMapper(TypeSystemImpl tgtTs)
-
getTypeSystemMapperInner
CasTypeSystemMapper getTypeSystemMapperInner(TypeSystemImpl tgtTs)
-
ll_getParentType
public int ll_getParentType(int typeCode)
Description copied from interface:LowLevelTypeSystemGet the parent type for the input type.- Specified by:
ll_getParentTypein interfaceLowLevelTypeSystem- Parameters:
typeCode- of some type- Returns:
- the type code of the parent type
-
ll_getAppropriateFeatures
public int[] ll_getAppropriateFeatures(int typecode)
Get an array of the appropriate features for this type.- Specified by:
ll_getAppropriateFeaturesin interfaceLowLevelTypeSystem- Parameters:
typecode- Input type code.- Returns:
- The array of appropriate features for
typeCode.
-
ll_subsumes
public boolean ll_subsumes(int superType, int type)Description copied from interface:LowLevelTypeSystemCheck subsumption between two types.- Specified by:
ll_subsumesin interfaceLowLevelTypeSystem- Parameters:
superType- -type- -- Returns:
trueifftype1subsumestype2.
-
ll_getCodeForTypeName
public int ll_getCodeForTypeName(java.lang.String typeName)
Description copied from interface:LowLevelTypeSystemGet the type code for a given type name.- Specified by:
ll_getCodeForTypeNamein interfaceLowLevelTypeSystem- Parameters:
typeName- The name of the type.- Returns:
- The code for the type. A return value of
0means that the a type of that name does not exist in the type system.
-
ll_getCodeForType
public int ll_getCodeForType(Type type)
Description copied from interface:LowLevelTypeSystemGet the code of an existing type object.- Specified by:
ll_getCodeForTypein interfaceLowLevelTypeSystem- Parameters:
type- A type object.- Returns:
- The type code for the input type.
-
ll_getCodeForFeatureName
public int ll_getCodeForFeatureName(java.lang.String featureName)
Description copied from interface:LowLevelTypeSystemGet the feature code for a given feature name.- Specified by:
ll_getCodeForFeatureNamein interfaceLowLevelTypeSystem- Parameters:
featureName- The name of the feature.- Returns:
- The code for the feature. A return value of
0means that the name does not represent a feature in the type system.
-
ll_getCodeForFeature
public int ll_getCodeForFeature(Feature feature)
Description copied from interface:LowLevelTypeSystemGet the code for a given feature object.- Specified by:
ll_getCodeForFeaturein interfaceLowLevelTypeSystem- Parameters:
feature- A feature object.- Returns:
- The code for the feature.
-
ll_getTypeForCode
public Type ll_getTypeForCode(int typeCode)
Description copied from interface:LowLevelTypeSystemGet a type object for a given code.- Specified by:
ll_getTypeForCodein interfaceLowLevelTypeSystem- Parameters:
typeCode- The code of the type.- Returns:
- A type object, or
nulliftypeCodeis not a valid type code.
-
getTypeForCode
public TypeImpl getTypeForCode(int typeCode)
-
getTypeForCode_checked
public TypeImpl getTypeForCode_checked(int typeCode)
-
isApprop
public boolean isApprop(int typecode, int featcode)Check if feature is appropriate for type (i.e., type is subsumed by domain type of feature).- Parameters:
typecode- -featcode- -- Returns:
- true if feature is appropriate for type (i.e., type is subsumed by domain type of feature).
-
getFeatureOffset
int getFeatureOffset(int feat)
Feature Code to Offset Offset has no clear meaning in V3- Returns:
- An offset
>0iffeatexists;0, else.
-
getLargestFeatureCode
private final int getLargestFeatureCode()
-
isFeature
final boolean isFeature(int featureCode)
-
ll_getFeatureForCode
public Feature ll_getFeatureForCode(int featureCode)
Description copied from interface:LowLevelTypeSystemGet a feature object for a given code.- Specified by:
ll_getFeatureForCodein interfaceLowLevelTypeSystem- Parameters:
featureCode- The code of the feature.- Returns:
- A feature object, or
nulliffeatureCodeis not a valid feature code.
-
getFeatureForCode
FeatureImpl getFeatureForCode(int featureCode)
-
getFeatureForCode_checked
FeatureImpl getFeatureForCode_checked(int featureCode)
-
ll_getDomainType
public int ll_getDomainType(int featureCode)
Description copied from interface:LowLevelTypeSystemGet the domain type for a given feature.- Specified by:
ll_getDomainTypein interfaceLowLevelTypeSystem- Parameters:
featureCode- Input feature code.- Returns:
- The domain type code for
featureCode.
-
ll_getRangeType
public int ll_getRangeType(int featureCode)
Description copied from interface:LowLevelTypeSystemGet the range type for a given feature.- Specified by:
ll_getRangeTypein interfaceLowLevelTypeSystem- Parameters:
featureCode- Input feature code.- Returns:
- The range type code for
featureCode.
-
getLowLevelTypeSystem
public LowLevelTypeSystem getLowLevelTypeSystem()
Description copied from interface:TypeSystemReturn the low-level view of this type system.- Specified by:
getLowLevelTypeSystemin interfaceTypeSystem- Returns:
- The
LowLevelTypeSystemversion of this type system.
-
ll_isStringSubtype
public boolean ll_isStringSubtype(int typecode)
Description copied from interface:LowLevelTypeSystemCheck if type is a string subtype. Returns false for plain string- Specified by:
ll_isStringSubtypein interfaceLowLevelTypeSystem- Parameters:
typecode- The type to be checked.- Returns:
trueifftypeis a subtype of String.
-
classifyAsRefType
boolean classifyAsRefType(java.lang.String name, TypeImpl superType)The range type of features may include special uima types that are not creatable, such as the primitive ones like integer, or string, or subtypes of string. Other types are reference types
-
isRefType
public boolean isRefType(TypeImpl type)
- Parameters:
type- the type to test- Returns:
- true if it's a reference type - one that can be created as a FeatureStructure
-
ll_isRefType
public boolean ll_isRefType(int typeCode)
Description copied from interface:LowLevelTypeSystemChecks if the type code is that of a reference type (anything that's not a basic type, currently Integer, String, Float, Boolean, Byte, Short, Long, Double, and subtypes of String - specifying allowed-values).- Specified by:
ll_isRefTypein interfaceLowLevelTypeSystem- Parameters:
typeCode- The type code to check.- Returns:
trueifftypeCodeis the type code of a reference type.
-
ll_getTypeClass
public final int ll_getTypeClass(int typeCode)
Description copied from interface:LowLevelTypeSystemDetermine 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_INTARRAY-- Integer array.TYPE_CLASS_FLOATARRAY-- Float array.TYPE_CLASS_STRINGARRAY-- String array.TYPE_CLASS_FSARRAY-- FS array.TYPE_CLASS_FS-- FS type, i.e., all other types, including all user-defined types.
- Specified by:
ll_getTypeClassin interfaceLowLevelTypeSystem- Parameters:
typeCode- The type code.- Returns:
- A type class for the type code.
TYPE_CLASS_INVALIDif the type code argument does not represent a valid type code.
-
ll_getArrayType
public int ll_getArrayType(int componentTypeCode)
Description copied from interface:LowLevelTypeSystemGet the type code for the array type withcomponentTypeCodeas component type code.- Specified by:
ll_getArrayTypein interfaceLowLevelTypeSystem- Parameters:
componentTypeCode- the type code of the components of the array- Returns:
- the type code of the requested Array type having components of componentTypeCode, or 0 if the componentTypeCode is invalid.
- See Also:
LowLevelTypeSystem.ll_getArrayType(int)
-
ll_isValidTypeCode
public boolean ll_isValidTypeCode(int typeCode)
Description copied from interface:LowLevelTypeSystemCheck the input type code.- Specified by:
ll_isValidTypeCodein interfaceLowLevelTypeSystem- Parameters:
typeCode- Type code to check.- Returns:
trueifftypeCodeis a valid type code.- See Also:
LowLevelTypeSystem.ll_isValidTypeCode(int)
-
ll_isArrayType
public boolean ll_isArrayType(int typeCode)
Description copied from interface:LowLevelTypeSystemCheck iftypeCodeis the type code of an array type.- Specified by:
ll_isArrayTypein interfaceLowLevelTypeSystem- Parameters:
typeCode- The type code to check.- Returns:
trueifftypeCodeis an array type code.
-
ll_getComponentType
public int ll_getComponentType(int arrayTypeCode)
Description copied from interface:LowLevelTypeSystemGet the component type of an array type code.- Specified by:
ll_getComponentTypein interfaceLowLevelTypeSystem- Parameters:
arrayTypeCode- The input array type code.- Returns:
- The type code for the component type, or
UNKNOWN_TYPE_CODEifarrayTypeCodeis not valid or not an array type.
-
ll_isPrimitiveType
public boolean ll_isPrimitiveType(int typeCode)
Description copied from interface:LowLevelTypeSystemCheck iftypeCodeis the type code of a primitive type.- Specified by:
ll_isPrimitiveTypein interfaceLowLevelTypeSystem- Parameters:
typeCode- The type code to check.- Returns:
trueifftypeCodeis a primitive type code.
-
ll_getStringSet
public java.lang.String[] ll_getStringSet(int typeCode)
Description copied from interface:LowLevelTypeSystemGet the string set (sorted) for a string subtype.- Specified by:
ll_getStringSetin interfaceLowLevelTypeSystem- Parameters:
typeCode- Input type code; should be a string subtype.- Returns:
- The set of allowable string values for subtypes of uima.cas.String. If the input type
code is not a proper subtype of String, returns
null.
-
getFeatures
public java.util.Iterator<Feature> getFeatures()
Description copied from interface:TypeSystemGet a list of features, in no particular order.- Specified by:
getFeaturesin interfaceTypeSystem- Returns:
- An iterator over the features.
-
intro
public int intro(int feat)
- Parameters:
feat- -- Returns:
- the domain type for a feature.
-
range
public int range(int feat)
Get the range type for a feature.- Parameters:
feat- -- Returns:
- -
-
computeArrayParentFromComponentType
private TypeImpl computeArrayParentFromComponentType(Type componentType)
Given a component type, return the parent type of the corresponding array type, without needing the corresponding array type to exist (yet). component type -> (member of) array type -> UIMA parent type of that array type. The UIMA Type parent of an array is either ArrayBase (for primitive arrays, plus String[] and TOP[] (see below) FsArray - for XYZ[] reference kinds of arrays The UIMA Type parent chain goes like this: primitive_array -> ArrayBase -> TOP (primitive: boolean, byte, short, int, long, float, double, String) String[] -> ArrayBase -> TOP TOP[] -> ArrayBase -> TOP XYZ[] -> FSArray -> TOP where XYZ is not a primitive, not String[], not TOP[] Arrays of TOP are handled differently from XYZ[] because - the creation of the FSArray type requires -- the creation of TOP[] type, which requires (unless this is done) -- the recursive creation of FSArray type - which causes a null pointer exception Note that the UIMA super chain is not used very much (mainly for subsumption, and for this there is special case code anyways), so this doesn't really matter. (2015 Sept) Note: the super type chain of the Java impl classes varies from the UIMA super type chain. It is used to factor out common behavior among classes of arrays. *********** NOTE: TBD update the rest of this comment for V3 ************** For non-JCas (in V3, this is only the XYZ[] and TOP[] kinds of arrays) CommonArrayFSImpl [ for arrays stored on the main heap ] ArrayFSImpl (for arrays of FS) FloatArrayFSImpl IntArrayFSImpl StringArrayFSImpl CommonAuxArrayFSImpl [ for arrays stored in Aux heaps ] BooleanArrayFSImpl ByteArrayFSImpl ShortArrayFSImpl LongArrayFSImpl DoubleArrayFSImpl For JCas: The corresponding types have only TOP as their supertypes but they implement the nonJCas interfaces for each subtype. Those interfaces implement CommonArrayFS interface- Parameters:
componentType- the UIMA type of the component of the array- Returns:
- the parent type of the corresponding array type
-
getJCasRegisteredType
public TypeImpl getJCasRegisteredType(int i)
Convert between fixed JCas class int (set when it is loaded) and this type system's TypeImpl.- Parameters:
i- the index from the typeIndexId of the JCas cover class- Returns:
- - the type impl associated with that JCas cover class
-
throwMissingUIMAtype
private void throwMissingUIMAtype(int typeIndex)
For a given JCasRegistry index, that doesn't have a corresponding UIMA type, throw an appropriate exception- Parameters:
typeIndex- the index in the JCasRegistry
-
dumpTypeSystem
public void dumpTypeSystem()
-
setJCasRegisteredType
void setJCasRegisteredType(int typeIndexID, TypeImpl ti)- Parameters:
typeIndexID- the JCasTypeID for the JCas cover class that will be used when creating instances of ti - may be a supertype of ti, if ti has no JCas class itself - may be a subtype of the supertype of ti, if ti has no JCas class itselfti- the UIMA type
-
getTypeClass
public static final int getTypeClass(TypeImpl ti)
-
getAllTypes
public java.util.List<TypeImpl> getAllTypes()
-
hashCode
public int hashCode()
HashCode and Equals used to compare two type system. Equal type systems are collapsed into one Equal means Same types Type are same if they have the same features and other flags Same Features- Overrides:
hashCodein classjava.lang.Object
-
compareTs
public static void compareTs(TypeSystem t1, TypeSystem t2)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
refreshFeature
public FeatureImpl refreshFeature(Feature f)
-
getAdjustedFeatureOffset
public static int getAdjustedFeatureOffset(java.lang.String featName)
******** OBSOLETE - only left in for supporting some jcas style in alpha level ************* This code is run when a JCas class is loaded and resolved, for the first time, as part of type system commit, or as part of statically loading the FSClassRegister class (where this is done for all the built-ins, once). It looks up the offset value in the type system (via a thread-local) hidden parameter: threadLocal value: referencing this type- Parameters:
featName- -- Returns:
- the offset in the int or ref data arrays for the named feature
-
getAdjustedFeatureOffset
static int getAdjustedFeatureOffset(TypeImpl type, java.lang.String featName)
-
fixupFSArrayTypes
void fixupFSArrayTypes(TypeImpl featRange, TOP arrayFs)
When deserializing Xmi and XCAS, Arrays of Feature Structures are encoded as FSArray types, but they may have a more restrictive typing, e.g. arrays of Annotation, with the type code of Annotation[]. This is determined by the range type of the feature referring to the array instance. A fixup is done when - the arrayFs is not already subtyped (could be for 0 length arrays) - it's not disabled (for backward compatibility with v2) If the feature is marked as multipleReferencesAllowed, the presumption is that all references are to the same subtype. 0-length arrays are created with the proper subtype already, and won't need fixing up The fixup updates the type of the Feature Structure from FSArray to the array type declared; no checking is done to insure the elements conform, however.
-
getGeneratorsForClassLoader
public FsGenerator3[] getGeneratorsForClassLoader(java.lang.ClassLoader cl, boolean isPear)
Called when switching or initializing CAS's shared-view-data instance of FsGenerator[] generators are kept in a map, unique for each type system, keyed by classloader.- Parameters:
cl- the class loaderisPear- -- Returns:
- the generators
-
createCallSite
public static final java.lang.invoke.MutableCallSite createCallSite(java.lang.Class<? extends TOP> clazz, java.lang.String featName)
Creates and returns a new MutableCallSite, // * recording it in list of all callsites for this type, in a map by typename // * // * Done this way because // * - can't be a classloader-wide list of call sites - some might not be associated with this type system // * - can't be a typesystem-wide list of call sites - the JCas class might be used by multiple type systems // * and the first one to load it would set this value. // * - has to be pairs of feature name, call-site, in order to get the value to set, later // * -- doesn't need to be a hashmap, can be an arraylist of entry // * Type being loaded may not be known at this point.- Parameters:
clazz- the JCas classfeatName- the short name of the feature- Returns:
- the created callsite
-
createCallSiteForBuiltIn
public static final java.lang.invoke.MutableCallSite createCallSiteForBuiltIn(java.lang.Class<? extends TOP> clazz, java.lang.String featName)
INTERNAL API - DO NOT USE, MAY CHANGE WITHOUT NOTICE!Creates and returns a new MutableCallSite for a built-in type. This handles the special case where the
staticTsiis initialized as a result of a builtin type JCas cover class being loaded in which case the callsite in the cover class is set after thestaticTsialready has been committed and therefore won't automatically get its callsites updated during the commit. So we need to create a proper callsite already pointing to the correct feature offset here.- Parameters:
clazz- the JCas classfeatName- the short name of the feature- Returns:
- the created callsite
-
iterator
public java.util.Iterator<Type> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<Type>
-
set_skip_loading_user_jcas
public void set_skip_loading_user_jcas(boolean v)
-
-