Class TypeSystemImpl

java.lang.Object
org.apache.uima.cas.impl.TypeSystemImpl
All Implemented Interfaces:
Iterable<Type>, TypeSystemMgr, LowLevelTypeSystem, TypeSystem

public class TypeSystemImpl extends 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 Details

    • DISABLE_TYPESYSTEM_CONSOLIDATION

      public static final 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:
    • ENABLE_STRICT_TYPE_SOURCE_CHECK

      public static final 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:
    • 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
    • intType

      public final TypeImpl intType
    • stringType

      public final TypeImpl stringType
    • floatType

      public final TypeImpl floatType
    • 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
    • booleanType

      public final TypeImpl booleanType
    • shortType

      public final TypeImpl shortType
    • longType

      public final TypeImpl longType
    • doubleType

      public final TypeImpl doubleType
    • 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
    • typeSystemMappers

      public final 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
  • Constructor Details

    • TypeSystemImpl

      public TypeSystemImpl()
  • Method Details

    • getTypeArraySize

      public final int getTypeArraySize()
    • getIntroFeatures

      public Vector<Feature> getIntroFeatures(Type type)
    • getParent

      public Type getParent(Type t)
      Description copied from interface: TypeSystem
      Get the parent type for input type.
      Specified by:
      getParent in interface TypeSystem
      Parameters:
      t - The type we want to know the parent of.
      Returns:
      The parent type, or null for 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(String typeName)
      Get a type object for a given name.
      Specified by:
      getType in interface TypeSystem
      Parameters:
      typeName - The name of the type.
      Returns:
      A type object, or null if no such type exists.
    • getFeatureByFullName

      public FeatureImpl getFeatureByFullName(String featureName)
      Get an feature object for a given name.
      Specified by:
      getFeatureByFullName in interface TypeSystem
      Parameters:
      featureName - The name of the feature.
      Returns:
      An feature object, or null if no such feature exists.
    • addType

      public TypeImpl addType(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:
      addType in interface TypeSystemMgr
      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 null if typeName is already in use.
      Throws:
      CASAdminException - If typeName is not a legal type name, type system is locked, or mother is inheritance final.
    • isInInt

      public boolean isInInt(Type rangeType)
    • addFeature

      public Feature addFeature(String featureName, Type domainType, Type rangeType) throws CASAdminException
      Description copied from interface: TypeSystemMgr
      Add 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:
      addFeature in interface TypeSystemMgr
      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 null if featureName is already in use for domainType with the same range (if the range is different, an exception is thrown).
      Throws:
      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.
    • addFeature

      public Feature addFeature(String shortFeatName, Type domainType, Type rangeType, boolean multipleReferencesAllowed) throws CASAdminException
      Description copied from interface: TypeSystemMgr
      Add an feature to the type system.
      Specified by:
      addFeature in interface TypeSystemMgr
      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 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.
      Returns:
      The new feature object, or null if featureName is already in use for domainType with the same range (if the range is different, an exception is thrown).
      Throws:
      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.
      See Also:
    • getTypeIterator

      public Iterator<Type> getTypeIterator()
      Get an iterator over all types, in no particular order.
      Specified by:
      getTypeIterator in interface TypeSystem
      Returns:
      The iterator.
    • getTopType

      public TypeImpl getTopType()
      Get the top type, i.e., the root of the type system.
      Specified by:
      getTopType in interface TypeSystem
      Returns:
      The top type.
    • getTopTypeImpl

      public TypeImpl getTopTypeImpl()
    • getProperlySubsumedTypes

      public 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:
      getProperlySubsumedTypes in interface TypeSystem
      Parameters:
      type - Input type.
      Returns:
      The list of types subsumed by type.
    • getDirectlySubsumedTypes

      public Vector<Type> getDirectlySubsumedTypes(Type type)
      Get a vector of the types directly subsumed by a given type.
      Specified by:
      getDirectlySubsumedTypes in interface TypeSystem
      Parameters:
      type - The input type.
      Returns:
      A vector of the directly subsumed types.
    • getDirectSubtypes

      public List<Type> getDirectSubtypes(Type type)
      Description copied from interface: TypeSystem
      Get a List of the types directly subsumed by a given type.
      Specified by:
      getDirectSubtypes in interface TypeSystem
      Parameters:
      type - The input type.
      Returns:
      A List of the directly subsumed types.
    • directlySubsumes

      public boolean directlySubsumes(TypeImpl t1, TypeImpl t2)
    • 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:
      subsumes in interface TypeSystem
      Parameters:
      superType - Supertype.
      subType - Subtype.
      Returns:
      true iff sub inherits from super.
    • 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 String toString()
      This writes out the type hierarchy in a human-readable form.
      Overrides:
      toString in class Object
    • commit

      public TypeSystemImpl commit()
      Description copied from interface: TypeSystemMgr
      Commit 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:
      commit in interface TypeSystemMgr
      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:
    • commit

      public TypeSystemImpl commit(ClassLoader cl)
      Description copied from interface: TypeSystemMgr
      Commit 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:
      commit in interface TypeSystemMgr
      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:
    • isCommitted

      public boolean isCommitted()
      Description copied from interface: TypeSystemMgr
      Check if this instance has been committed.
      Specified by:
      isCommitted in interface TypeSystemMgr
      Returns:
      true iff this instance has been committed.
      See Also:
    • 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(String featureName)
      Deprecated.
    • setFeatureFinal

      public void setFeatureFinal(Type type)
      Description copied from interface: TypeSystemMgr
      Make 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:
      setFeatureFinal in interface TypeSystemMgr
      Parameters:
      type - The type to be made feature final.
      See Also:
    • setInheritanceFinal

      public void setInheritanceFinal(Type type)
      Description copied from interface: TypeSystemMgr
      Block 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:
      setInheritanceFinal in interface TypeSystemMgr
      Parameters:
      type - the type to block subtypes on
      See Also:
    • getTypeNameSpace

      public TypeNameSpace getTypeNameSpace(String name)
      Description copied from interface: TypeSystem
      Create a type name space object for the name parameter.
      Specified by:
      getTypeNameSpace in interface TypeSystem
      Parameters:
      name - The name of the name space.
      Returns:
      A TypeNameSpace object corresponding to name, or null, if name is not a legal type name space identifier.
    • getArrayType

      public Type getArrayType(Type componentType)
      Description copied from interface: TypeSystem
      Get or Create an array type with component type componentType.
      Specified by:
      getArrayType in interface TypeSystem
      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:
    • addStringSubtype

      public Type addStringSubtype(String typeName, String[] stringList) throws CASAdminException
      Description copied from interface: TypeSystemMgr
      Inherit 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:
      addStringSubtype in interface TypeSystemMgr
      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 null if the type is already defined.
      Throws:
      CASAdminException - If the type system is locked.
      See Also:
    • getFeatureOffset

      public int getFeatureOffset(TypeImpl ti, String featureShortName)
      Parameters:
      ti - the type
      featureShortName - the name of the feature
      Returns:
      the offset in the storage array for this feature
    • ll_getParentType

      public int ll_getParentType(int typeCode)
      Description copied from interface: LowLevelTypeSystem
      Get the parent type for the input type.
      Specified by:
      ll_getParentType in interface LowLevelTypeSystem
      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_getAppropriateFeatures in interface LowLevelTypeSystem
      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: LowLevelTypeSystem
      Check subsumption between two types.
      Specified by:
      ll_subsumes in interface LowLevelTypeSystem
      Parameters:
      superType - -
      type - -
      Returns:
      true iff type1 subsumes type2.
    • ll_getCodeForTypeName

      public int ll_getCodeForTypeName(String typeName)
      Description copied from interface: LowLevelTypeSystem
      Get the type code for a given type name.
      Specified by:
      ll_getCodeForTypeName in interface LowLevelTypeSystem
      Parameters:
      typeName - The name of the type.
      Returns:
      The code for the type. A return value of 0 means 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: LowLevelTypeSystem
      Get the code of an existing type object.
      Specified by:
      ll_getCodeForType in interface LowLevelTypeSystem
      Parameters:
      type - A type object.
      Returns:
      The type code for the input type.
    • ll_getCodeForFeatureName

      public int ll_getCodeForFeatureName(String featureName)
      Description copied from interface: LowLevelTypeSystem
      Get the feature code for a given feature name.
      Specified by:
      ll_getCodeForFeatureName in interface LowLevelTypeSystem
      Parameters:
      featureName - The name of the feature.
      Returns:
      The code for the feature. A return value of 0 means that the name does not represent a feature in the type system.
    • ll_getCodeForFeature

      public int ll_getCodeForFeature(Feature feature)
      Description copied from interface: LowLevelTypeSystem
      Get the code for a given feature object.
      Specified by:
      ll_getCodeForFeature in interface LowLevelTypeSystem
      Parameters:
      feature - A feature object.
      Returns:
      The code for the feature.
    • ll_getTypeForCode

      public Type ll_getTypeForCode(int typeCode)
      Description copied from interface: LowLevelTypeSystem
      Get a type object for a given code.
      Specified by:
      ll_getTypeForCode in interface LowLevelTypeSystem
      Parameters:
      typeCode - The code of the type.
      Returns:
      A type object, or null if typeCode is 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).
    • ll_getFeatureForCode

      public Feature ll_getFeatureForCode(int featureCode)
      Description copied from interface: LowLevelTypeSystem
      Get a feature object for a given code.
      Specified by:
      ll_getFeatureForCode in interface LowLevelTypeSystem
      Parameters:
      featureCode - The code of the feature.
      Returns:
      A feature object, or null if featureCode is not a valid feature code.
    • ll_getDomainType

      public int ll_getDomainType(int featureCode)
      Description copied from interface: LowLevelTypeSystem
      Get the domain type for a given feature.
      Specified by:
      ll_getDomainType in interface LowLevelTypeSystem
      Parameters:
      featureCode - Input feature code.
      Returns:
      The domain type code for featureCode.
    • ll_getRangeType

      public int ll_getRangeType(int featureCode)
      Description copied from interface: LowLevelTypeSystem
      Get the range type for a given feature.
      Specified by:
      ll_getRangeType in interface LowLevelTypeSystem
      Parameters:
      featureCode - Input feature code.
      Returns:
      The range type code for featureCode.
    • getLowLevelTypeSystem

      public LowLevelTypeSystem getLowLevelTypeSystem()
      Description copied from interface: TypeSystem
      Return the low-level view of this type system.
      Specified by:
      getLowLevelTypeSystem in interface TypeSystem
      Returns:
      The LowLevelTypeSystem version of this type system.
    • ll_isStringSubtype

      public boolean ll_isStringSubtype(int typecode)
      Description copied from interface: LowLevelTypeSystem
      Check if type is a string subtype. Returns false for plain string
      Specified by:
      ll_isStringSubtype in interface LowLevelTypeSystem
      Parameters:
      typecode - The type to be checked.
      Returns:
      true iff type is a subtype of String.
    • 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: LowLevelTypeSystem
      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).
      Specified by:
      ll_isRefType in interface LowLevelTypeSystem
      Parameters:
      typeCode - The type code to check.
      Returns:
      true iff typeCode is the type code of a reference type.
    • ll_getTypeClass

      public final int ll_getTypeClass(int typeCode)
      Description copied from interface: LowLevelTypeSystem
      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_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.
      This method is on the CAS, not the type system, since the specific properties of types are specific to the CAS. The type system does not know, for example, that the CAS treats arrays specially.
      Specified by:
      ll_getTypeClass in interface LowLevelTypeSystem
      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_getArrayType

      public int ll_getArrayType(int componentTypeCode)
      Description copied from interface: LowLevelTypeSystem
      Get the type code for the array type with componentTypeCode as component type code.
      Specified by:
      ll_getArrayType in interface LowLevelTypeSystem
      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:
    • ll_isValidTypeCode

      public boolean ll_isValidTypeCode(int typeCode)
      Description copied from interface: LowLevelTypeSystem
      Check the input type code.
      Specified by:
      ll_isValidTypeCode in interface LowLevelTypeSystem
      Parameters:
      typeCode - Type code to check.
      Returns:
      true iff typeCode is a valid type code.
      See Also:
    • ll_isArrayType

      public boolean ll_isArrayType(int typeCode)
      Description copied from interface: LowLevelTypeSystem
      Check if typeCode is the type code of an array type.
      Specified by:
      ll_isArrayType in interface LowLevelTypeSystem
      Parameters:
      typeCode - The type code to check.
      Returns:
      true iff typeCode is an array type code.
    • ll_getComponentType

      public int ll_getComponentType(int arrayTypeCode)
      Description copied from interface: LowLevelTypeSystem
      Get the component type of an array type code.
      Specified by:
      ll_getComponentType in interface LowLevelTypeSystem
      Parameters:
      arrayTypeCode - The input array type code.
      Returns:
      The type code for the component type, or UNKNOWN_TYPE_CODE if arrayTypeCode is not valid or not an array type.
    • ll_isPrimitiveType

      public boolean ll_isPrimitiveType(int typeCode)
      Description copied from interface: LowLevelTypeSystem
      Check if typeCode is the type code of a primitive type.
      Specified by:
      ll_isPrimitiveType in interface LowLevelTypeSystem
      Parameters:
      typeCode - The type code to check.
      Returns:
      true iff typeCode is a primitive type code.
    • ll_getStringSet

      public String[] ll_getStringSet(int typeCode)
      Description copied from interface: LowLevelTypeSystem
      Get the string set (sorted) for a string subtype.
      Specified by:
      ll_getStringSet in interface LowLevelTypeSystem
      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 Iterator<Feature> getFeatures()
      Description copied from interface: TypeSystem
      Get a list of features, in no particular order.
      Specified by:
      getFeatures in interface TypeSystem
      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:
      -
    • 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
    • dumpTypeSystem

      public void dumpTypeSystem()
    • getTypeClass

      public static final int getTypeClass(TypeImpl ti)
    • getAllTypes

      public 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:
      hashCode in class Object
    • compareTs

      public static void compareTs(TypeSystem t1, TypeSystem t2)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • refreshType

      public TypeImpl refreshType(Type t)
    • refreshFeature

      public FeatureImpl refreshFeature(Feature f)
    • getAdjustedFeatureOffset

      public 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). 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
    • getGeneratorsForClassLoader

      public 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.
      Parameters:
      cl - the class loader
      isPear - -
      Returns:
      the generators
    • createCallSite

      public static final 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. // * - 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 class
      featName - the short name of the feature
      Returns:
      the created callsite
    • createCallSiteForBuiltIn

      public static final MutableCallSite createCallSiteForBuiltIn(Class<? extends TOP> clazz, 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 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.

      Parameters:
      clazz - the JCas class
      featName - the short name of the feature
      Returns:
      the created callsite
    • iterator

      public Iterator<Type> iterator()
      Specified by:
      iterator in interface Iterable<Type>
    • set_skip_loading_user_jcas

      public void set_skip_loading_user_jcas(boolean v)