public class TypeSystemImpl extends Object implements TypeSystem, TypeSystemMgr, LowLevelTypeSystem
FEATURE_SEPARATOR, NAMESPACE_SEPARATOR, PARAM_EXCLUDE_PREBUILT_TYPESUNKNOWN_FEATURE_CODE| Constructor and Description |
|---|
TypeSystemImpl() |
| Modifier and Type | Method and Description |
|---|---|
Feature |
addFeature(String featureName,
Type domainType,
Type rangeType)
Add an feature to the type system.
|
Feature |
addFeature(String shortFeatName,
Type domainType,
Type rangeType,
boolean multipleReferencesAllowed)
Add an feature to the type system.
|
Type |
addStringSubtype(String typeName,
String[] stringList)
Inherit from String.
|
TypeImpl |
addType(String typeName,
Type superType)
Add a new type to the type system.
|
TypeSystemImpl |
commit()
Commit the type system, and load JCas Classes from the UIMA Framework's classloader.
|
TypeSystemImpl |
commit(ClassLoader cl)
Commit the type system, and load JCas classes from the passed in classloader.
|
static void |
compareTs(TypeSystem t1,
TypeSystem t2) |
static MutableCallSite |
createCallSite(Class<? extends TOP> clazz,
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 MutableCallSite |
createCallSiteForBuiltIn(Class<? extends TOP> clazz,
String featName)
INTERNAL API - DO NOT USE, MAY CHANGE WITHOUT NOTICE!
|
boolean |
directlySubsumes(TypeImpl t1,
TypeImpl t2) |
void |
dumpTypeSystem() |
boolean |
equals(Object obj) |
static int |
getAdjustedFeatureOffset(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).
|
List<TypeImpl> |
getAllTypes() |
Type |
getArrayType(Type componentType)
Get or Create an array type with component type
componentType. |
Vector<Type> |
getDirectlySubsumedTypes(Type type)
Get a vector of the types directly subsumed by a given type.
|
List<Type> |
getDirectSubtypes(Type type)
Get a List of the types directly subsumed by a given type.
|
Feature |
getFeature(String featureName)
Deprecated.
|
FeatureImpl |
getFeatureByFullName(String featureName)
Get an feature object for a given name.
|
int |
getFeatureOffset(TypeImpl ti,
String featureShortName) |
Iterator<Feature> |
getFeatures()
Get a list of features, in no particular order.
|
FsGenerator3[] |
getGeneratorsForClassLoader(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.
|
Vector<Feature> |
getIntroFeatures(Type type) |
TypeImpl |
getJCasRegisteredType(int i)
Convert between fixed JCas class int (set when it is loaded) and
this type system's TypeImpl.
|
int |
getLargestTypeCode() |
LowLevelTypeSystem |
getLowLevelTypeSystem()
Return the low-level view of this type system.
|
int |
getNumberOfFeatures()
Get the overall number of features defined in the type system.
|
int |
getNumberOfTypes()
Get the overall number of types defined in the type system.
|
Type |
getParent(Type t)
Get the parent type for input type.
|
List<Type> |
getProperlySubsumedTypes(Type type)
Return the list of all types subsumed by the input type.
|
TypeImpl |
getTopType()
Get the top type, i.e., the root of the type system.
|
TypeImpl |
getTopTypeImpl() |
TypeImpl |
getType(String typeName)
Get a type object for a given name.
|
int |
getTypeArraySize() |
static int |
getTypeClass(TypeImpl ti) |
TypeImpl |
getTypeForCode_checked(int typeCode) |
TypeImpl |
getTypeForCode(int typeCode) |
Iterator<Type> |
getTypeIterator()
Get an iterator over all types, in no particular order.
|
TypeNameSpace |
getTypeNameSpace(String name)
Create a type name space object for the name parameter.
|
int |
hashCode()
HashCode and Equals
used to compare two type system.
|
int |
intro(int feat) |
boolean |
isAnnotationBaseOrSubtype(int typecode) |
boolean |
isAnnotationBaseOrSubtype(Type type) |
boolean |
isAnnotationOrSubtype(Type type) |
boolean |
isApprop(int typecode,
int featcode)
Check if feature is appropriate for type (i.e., type is subsumed by domain type of feature).
|
boolean |
isCommitted()
Check if this instance has been committed.
|
boolean |
isInInt(Type rangeType) |
boolean |
isRefType(TypeImpl type) |
boolean |
isType(int typecode) |
Iterator<Type> |
iterator() |
int[] |
ll_getAppropriateFeatures(int typecode)
Get an array of the appropriate features for this type.
|
int |
ll_getArrayType(int componentTypeCode)
Get the type code for the array type with
componentTypeCode as component type
code. |
int |
ll_getCodeForFeature(Feature feature)
Get the code for a given feature object.
|
int |
ll_getCodeForFeatureName(String featureName)
Get the feature code for a given feature name.
|
int |
ll_getCodeForType(Type type)
Get the code of an existing type object.
|
int |
ll_getCodeForTypeName(String typeName)
Get the type code for a given type name.
|
int |
ll_getComponentType(int arrayTypeCode)
Get the component type of an array type code.
|
int |
ll_getDomainType(int featureCode)
Get the domain type for a given feature.
|
Feature |
ll_getFeatureForCode(int featureCode)
Get a feature object for a given code.
|
int |
ll_getParentType(int typeCode)
Get the parent type for the input type.
|
int |
ll_getRangeType(int featureCode)
Get the range type for a given feature.
|
String[] |
ll_getStringSet(int typeCode)
Get the string set (sorted) for a string subtype.
|
int |
ll_getTypeClass(int typeCode)
Determine the type class of a type.
|
Type |
ll_getTypeForCode(int typeCode)
Get a type object for a given code.
|
boolean |
ll_isArrayType(int typeCode)
Check if
typeCode is the type code of an array type. |
boolean |
ll_isPrimitiveType(int typeCode)
Check if
typeCode is the type code of a primitive type. |
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, Float, Boolean, Byte, Short, Long, Double,
and subtypes of String - specifying allowed-values).
|
boolean |
ll_isStringSubtype(int typecode)
Check if type is a string subtype.
|
boolean |
ll_isValidTypeCode(int typeCode)
Check the input type code.
|
boolean |
ll_subsumes(int superType,
int type)
Check subsumption between two types.
|
int |
range(int feat)
Get the range type for a feature.
|
FeatureImpl |
refreshFeature(Feature f) |
TypeImpl |
refreshType(Type t) |
void |
set_skip_loading_user_jcas(boolean v) |
void |
setFeatureFinal(Type type)
Make type feature final in the sense that no new features can be added to this type.
|
void |
setInheritanceFinal(Type type)
Block any further inheritance from this type.
|
boolean |
subsumes(int superType,
int type)
Check if the first argument subsumes the second
|
boolean |
subsumes(Type superType,
Type subType)
Does one type inherit from the other?
There are two versions.
|
String |
toString()
This writes out the type hierarchy in a human-readable form.
|
int |
unify(int t1,
int t2) |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic static final String DISABLE_TYPESYSTEM_CONSOLIDATION
public static final String ENABLE_STRICT_TYPE_SOURCE_CHECK
public static final boolean IS_DISABLE_TYPESYSTEM_CONSOLIDATION
public static final boolean IS_ENABLE_STRICT_TYPE_SOURCE_CHECK
public final TypeImpl intType
public final TypeImpl stringType
public final TypeImpl floatType
public final TypeImpl sofaType
public final TypeImpl annotType
public final TypeImpl annotBaseType
public final TypeImpl docType
public final TypeImpl byteType
public final TypeImpl booleanType
public final TypeImpl shortType
public final TypeImpl longType
public final TypeImpl doubleType
public final TypeImpl_list intListType
public final TypeImpl_list floatListType
public final TypeImpl_list stringListType
public final TypeImpl_list fsListType
public final TypeImpl_list intEListType
public final TypeImpl_list floatEListType
public final TypeImpl_list stringEListType
public final TypeImpl_list fsEListType
public final TypeImpl_list intNeListType
public final TypeImpl_list floatNeListType
public final TypeImpl_list stringNeListType
public final TypeImpl_list fsNeListType
public final Map<TypeSystemImpl,CasTypeSystemMapper> typeSystemMappers
public static final TypeSystemImpl staticTsi
public final int getTypeArraySize()
public Type getParent(Type t)
TypeSystemgetParent in interface TypeSystemt - The type we want to know the parent of.null for the top type.public final int getLargestTypeCode()
public boolean isType(int typecode)
typecode - to check if it's in the range of valid type codespublic TypeImpl getType(String typeName)
getType in interface TypeSystemtypeName - The name of the type.null if no such type exists.public FeatureImpl getFeatureByFullName(String featureName)
getFeatureByFullName in interface TypeSystemfeatureName - The name of the feature.null if no such feature exists.public TypeImpl addType(String typeName, Type superType) throws CASAdminException
addType in interface TypeSystemMgrtypeName - The name of the new type.superType - The type node under which the new type should be attached.null if typeName is already in use.CASAdminException - If typeName is not a legal type name, type system is locked, or
mother is inheritance final.public boolean isInInt(Type rangeType)
public Feature addFeature(String featureName, Type domainType, Type rangeType) throws CASAdminException
TypeSystemMgraddFeature in interface TypeSystemMgrfeatureName - 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.null if featureName is already
in use for domainType with the same range (if the range is different, an
exception is thrown).CASAdminException - If featureName is not a legal feature name, the type system is
locked or domainType is feature final. Also if
featureName has already been defined on domainType
(or a supertype) with a different range than rangeType.public Feature addFeature(String shortFeatName, Type domainType, Type rangeType, boolean multipleReferencesAllowed) throws CASAdminException
TypeSystemMgraddFeature in interface TypeSystemMgrshortFeatName - 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 the rangeType is 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 to true.null if featureName is already
in use for domainType with the same range (if the range is different, an
exception is thrown).CASAdminException - If featureName is not a legal feature name, the type system is
locked or domainType is feature final. Also if
featureName has already been defined on domainType
(or a supertype) with a different range than rangeType.TypeSystemMgr.addFeature(String, Type, Type)public Iterator<Type> getTypeIterator()
getTypeIterator in interface TypeSystempublic TypeImpl getTopType()
getTopType in interface TypeSystempublic TypeImpl getTopTypeImpl()
public List<Type> getProperlySubsumedTypes(Type type)
getProperlySubsumedTypes in interface TypeSystemtype - Input type.type.public Vector<Type> getDirectlySubsumedTypes(Type type)
getDirectlySubsumedTypes in interface TypeSystemtype - The input type.public List<Type> getDirectSubtypes(Type type)
TypeSystemgetDirectSubtypes in interface TypeSystemtype - The input type.public boolean subsumes(Type superType, Type subType)
subsumes in interface TypeSystemsuperType - Supertype.subType - Subtype.true iff sub inherits from super.public int getNumberOfTypes()
public int getNumberOfFeatures()
public int unify(int t1,
int t2)
public boolean subsumes(int superType,
int type)
superType - -type - -public String toString()
public TypeSystemImpl commit()
TypeSystemMgrcommit in interface TypeSystemMgrTypeSystemMgr.commit()public TypeSystemImpl commit(ClassLoader cl)
TypeSystemMgrcommit in interface TypeSystemMgrcl - the JCas class loaderTypeSystemMgr.commit(ClassLoader)public boolean isCommitted()
TypeSystemMgrisCommitted in interface TypeSystemMgrtrue iff this instance has been committed.TypeSystemMgr.isCommitted()public boolean isAnnotationBaseOrSubtype(int typecode)
typecode - for a typepublic boolean isAnnotationBaseOrSubtype(Type type)
public boolean isAnnotationOrSubtype(Type type)
type - a type@Deprecated public Feature getFeature(String featureName)
public void setFeatureFinal(Type type)
TypeSystemMgrsetFeatureFinal in interface TypeSystemMgrtype - The type to be made feature final.TypeSystemMgr.setFeatureFinal(org.apache.uima.cas.Type)public void setInheritanceFinal(Type type)
TypeSystemMgrsetInheritanceFinal in interface TypeSystemMgrtype - the type to block subtypes onTypeSystemMgr.setInheritanceFinal(org.apache.uima.cas.Type)public TypeNameSpace getTypeNameSpace(String name)
TypeSystemgetTypeNameSpace in interface TypeSystemname - The name of the name space.TypeNameSpace object corresponding to name, or
null, if name is not a legal type name space identifier.public Type getArrayType(Type componentType)
TypeSystemcomponentType.getArrayType in interface TypeSystemcomponentType - The type of the elements of the resulting array type. This can be any type, even
another array type.TypeSystem.getArrayType(Type)public Type addStringSubtype(String typeName, String[] stringList) throws CASAdminException
TypeSystemMgraddStringSubtype in interface TypeSystemMgrtypeName - The name of the type to be created.stringList - The list of legal string values for this string type.null if the type is already defined.CASAdminException - If the type system is locked.TypeSystemMgr.addStringSubtype(java.lang.String, java.lang.String[])public int getFeatureOffset(TypeImpl ti, String featureShortName)
ti - the typefeatureShortName - the name of the featurepublic int ll_getParentType(int typeCode)
LowLevelTypeSystemll_getParentType in interface LowLevelTypeSystemtypeCode - of some typepublic int[] ll_getAppropriateFeatures(int typecode)
ll_getAppropriateFeatures in interface LowLevelTypeSystemtypecode - Input type code.typeCode.public boolean ll_subsumes(int superType,
int type)
LowLevelTypeSystemll_subsumes in interface LowLevelTypeSystemsuperType - -type - -true iff type1 subsumes type2.public int ll_getCodeForTypeName(String typeName)
LowLevelTypeSystemll_getCodeForTypeName in interface LowLevelTypeSystemtypeName - The name of the type.0 means that the a type of that
name does not exist in the type system.public int ll_getCodeForType(Type type)
LowLevelTypeSystemll_getCodeForType in interface LowLevelTypeSystemtype - A type object.public int ll_getCodeForFeatureName(String featureName)
LowLevelTypeSystemll_getCodeForFeatureName in interface LowLevelTypeSystemfeatureName - The name of the feature.0 means that the name does
not represent a feature in the type system.public int ll_getCodeForFeature(Feature feature)
LowLevelTypeSystemll_getCodeForFeature in interface LowLevelTypeSystemfeature - A feature object.public Type ll_getTypeForCode(int typeCode)
LowLevelTypeSystemll_getTypeForCode in interface LowLevelTypeSystemtypeCode - The code of the type.null if typeCode is not a valid type
code.public TypeImpl getTypeForCode(int typeCode)
public TypeImpl getTypeForCode_checked(int typeCode)
public boolean isApprop(int typecode,
int featcode)
typecode - -featcode - -public Feature ll_getFeatureForCode(int featureCode)
LowLevelTypeSystemll_getFeatureForCode in interface LowLevelTypeSystemfeatureCode - The code of the feature.null if featureCode is not a valid
feature code.public int ll_getDomainType(int featureCode)
LowLevelTypeSystemll_getDomainType in interface LowLevelTypeSystemfeatureCode - Input feature code.featureCode.public int ll_getRangeType(int featureCode)
LowLevelTypeSystemll_getRangeType in interface LowLevelTypeSystemfeatureCode - Input feature code.featureCode.public LowLevelTypeSystem getLowLevelTypeSystem()
TypeSystemgetLowLevelTypeSystem in interface TypeSystemLowLevelTypeSystem version of
this type system.public boolean ll_isStringSubtype(int typecode)
LowLevelTypeSystemll_isStringSubtype in interface LowLevelTypeSystemtypecode - The type to be checked.true iff type is a subtype of String.public boolean isRefType(TypeImpl type)
type - the type to testpublic boolean ll_isRefType(int typeCode)
LowLevelTypeSystemll_isRefType in interface LowLevelTypeSystemtypeCode - The type code to check.true iff typeCode is the type code of a reference type.public final int ll_getTypeClass(int typeCode)
LowLevelTypeSystemTYPE_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.ll_getTypeClass in interface LowLevelTypeSystemtypeCode - The type code.TYPE_CLASS_INVALID if the type code
argument does not represent a valid type code.public int ll_getArrayType(int componentTypeCode)
LowLevelTypeSystemcomponentTypeCode as component type
code.ll_getArrayType in interface LowLevelTypeSystemcomponentTypeCode - the type code of the components of the arrayLowLevelTypeSystem.ll_getArrayType(int)public boolean ll_isValidTypeCode(int typeCode)
LowLevelTypeSystemll_isValidTypeCode in interface LowLevelTypeSystemtypeCode - Type code to check.true iff typeCode is a valid type code.LowLevelTypeSystem.ll_isValidTypeCode(int)public boolean ll_isArrayType(int typeCode)
LowLevelTypeSystemtypeCode is the type code of an array type.ll_isArrayType in interface LowLevelTypeSystemtypeCode - The type code to check.true iff typeCode is an array type code.public int ll_getComponentType(int arrayTypeCode)
LowLevelTypeSystemll_getComponentType in interface LowLevelTypeSystemarrayTypeCode - The input array type code.UNKNOWN_TYPE_CODE
if arrayTypeCode is not valid or not an array type.public boolean ll_isPrimitiveType(int typeCode)
LowLevelTypeSystemtypeCode is the type code of a primitive type.ll_isPrimitiveType in interface LowLevelTypeSystemtypeCode - The type code to check.true iff typeCode is a primitive type code.public String[] ll_getStringSet(int typeCode)
LowLevelTypeSystemll_getStringSet in interface LowLevelTypeSystemtypeCode - Input type code; should be a string subtype.null.public Iterator<Feature> getFeatures()
TypeSystemgetFeatures in interface TypeSystempublic int intro(int feat)
feat - -public int range(int feat)
feat - -public TypeImpl getJCasRegisteredType(int i)
i - the index from the typeIndexId of the JCas cover classpublic void dumpTypeSystem()
public static final int getTypeClass(TypeImpl ti)
public int hashCode()
public static void compareTs(TypeSystem t1, TypeSystem t2)
public FeatureImpl refreshFeature(Feature f)
public static int getAdjustedFeatureOffset(String featName)
featName - -public FsGenerator3[] getGeneratorsForClassLoader(ClassLoader cl, boolean isPear)
cl - the class loaderisPear - -public static final MutableCallSite createCallSite(Class<? extends TOP> clazz, String featName)
clazz - the JCas classfeatName - the short name of the featurepublic static final MutableCallSite createCallSiteForBuiltIn(Class<? extends TOP> clazz, String featName)
Creates and returns a new MutableCallSite for a built-in type. This handles the special case
where the staticTsi is 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 the staticTsi
already 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.
clazz - the JCas classfeatName - the short name of the featurepublic void set_skip_loading_user_jcas(boolean v)
Copyright © 2006–2021 The Apache Software Foundation. All rights reserved.