Package org.apache.uima.cas.impl

# Class TypeImpl

java.lang.Object
org.apache.uima.cas.impl.TypeImpl

All Implemented Interfaces:
  `Comparable<TypeImpl>`, `Iterable<Feature>`, `Type`

Direct Known Subclasses:
  `TypeImpl_annotBase`, `TypeImpl_array`, `TypeImpl_list`, `TypeImpl_primitive`

public class TypeImpl extends Object implements Type, Comparable<TypeImpl>
The implementation of types in the type system. UIMA Version 3 Instances of this class are not shared by different type systems because they contain a ref to the TypeSystemImpl (needed by FeaturePath and maybe other things) - even for built-ins. - However, the JCas cover class definitions are shared by all type systems for built-in types Feature offsets are set from the (changing) value of nbrOfIntDataFields and nbrOfRefDataFields

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected boolean`
  `isBuiltIn`
  when set, processing skipped for - augment features from jcas - conformance checking between jcas and type system - validating the superclass chain upon load of jcas class
  `protected final boolean`
  `isCreatableAndNotBuiltinArray`
  False for non creatable (as Feature Structures) values (e.g.
  `protected boolean`
  `isFeatureFinal`
  `protected boolean`
  `isInheritanceFinal`
  `protected final boolean`
  `isLongOrDouble`
  `final boolean`
  `isRefType`
  false for primitives, strings, string subtypes
  `protected Class<?>`
  `javaClass`
  `static final TypeImpl`
  `singleton`
  A special instance used in CasCopier to identify a missing type

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `compareTo(TypeImpl t)`
  compareTo must return 0 for "equal" types equal means same name, same flags, same supertype chain, same subtypes, and same features Makes use of hashcodelong to probablistically shortcut computation for equal case for not equal types, do by parts
  `boolean`
  `equals(Object obj)`
  Equal TypeImpl.
  `Vector<Feature>`
  `getAppropriateFeatures()`
  Deprecated.
  use `getFeatures()`
  `int`
  `getCode()`
  Return the internal integer code for this type.
  `SlotKinds.SlotKind`
  `getComponentSlotKind()`
  `TypeImpl`
  `getComponentType()`
  For array types, returns the component type of the array type.
  `Feature`
  `getFeature(String featureName)`
  Deprecated.
  use getFeatureByBaseName instead
  `FeatureImpl`
  `getFeatureByBaseName(String featureShortName)`
  Retrieve a feature for this type.
  `FeatureImpl[]`
  `getFeatureImpls()`
  This impl depends on features never being removed from types, only added Minimal Java object generation, maximal reuse
  `List<Feature>`
  `getFeatures()`
  guaranteed to be non-null, but might be empty list
  `Stream<FeatureImpl>`
  `getFeaturesAsStream()`
  `int`
  `getFsSpaceReq()`
  Get the v2 heap size for types with features
  `int`
  `getFsSpaceReq(int length)`
  get the v2 heap size for types
  `int`
  `getFsSpaceReq(TOP fs)`
  `String`
  `getJCasClassName()`
  `List<FeatureImpl>`
  `getMergedStaticFeaturesIntroducedByThisType()`
  `String`
  `getName()`
  Get the name of the type.
  `int`
  `getNbrOfLongOrDoubleFeatures()`
  `int`
  `getNumberOfFeatures()`
  Get the number of features for which this type defines the range.
  `String`
  `getShortName()`
  Get the unqualified, short name of this type.
  `TypeImpl`
  `getSuperType()`
  Get the super type.
  `TypeSystemImpl`
  `getTypeSystem()`
  Get the type hierarchy that this type belongs to.
  `int`
  `hashCode()`
  `long`
  `hashCodeNameLong()`
  `boolean`
  `hasRefFeature()`
  `boolean`
  `isAnnotationBaseType()`
  `boolean`
  `isAnnotationType()`
  Check if this is an annotation type.
  `boolean`
  `isAppropriateFeature(Feature feature)`
  `boolean`
  `isArray()`
  Check if the type is an array type.
  `boolean`
  `isCreatableAndNotBuiltinArray()`
  `boolean`
  `isFeatureFinal()`
  Check if type is feature final, i.e., if no more new features may be defined for it.
  `boolean`
  `isInheritanceFinal()`
  Check if type is inheritance final, i.e., if new types can be derived from it.
  `boolean`
  `isLongOrDouble()`
  `boolean`
  `isPrimitive()`
  Check if the type is one of the primitive types.
  `boolean`
  `isStringOrStringSubtype()`
  `boolean`
  `isStringSubtype()`
  Check if the type is a String subtype.
  `boolean`
  `isTopType()`
  `boolean`
  `isTypedFsArray()`
  `Iterator<Feature>`
  `iterator()`
  `void`
  `prettyPrint(StringBuilder sb, int indent)`
  `void`
  `prettyPrintWithSubTypes(StringBuilder sb, int indent)`
  `boolean`
  `subsumes(TypeImpl ti)`
  `boolean`
  `subsumesStrictly(TypeImpl ti)`
  `boolean`
  `subsumesValue(Object v)`
  `String`
  `toString()`
  `String`
  `toString(int indent)`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface java.lang.Iterable

  `forEach, spliterator`

  ### Methods inherited from interface org.apache.uima.cas.Type

  `subsumes`

- ## Field Details

  - ### javaClass

    protected Class<?> javaClass

  - ### isFeatureFinal

    protected boolean isFeatureFinal

  - ### isInheritanceFinal

    protected boolean isInheritanceFinal

  - ### isLongOrDouble

    protected final boolean isLongOrDouble

  - ### isBuiltIn

    protected boolean isBuiltIn
    when set, processing skipped for - augment features from jcas - conformance checking between jcas and type system - validating the superclass chain upon load of jcas class

  - ### isCreatableAndNotBuiltinArray

    protected final boolean isCreatableAndNotBuiltinArray
    False for non creatable (as Feature Structures) values (e.g. byte, integer, string) and also false for array built-ins (which can be Feature Structures, can be added-to-indexes, etc.)

  - ### isRefType

    public final boolean isRefType
    false for primitives, strings, string subtypes

  - ### singleton

    public static final TypeImpl singleton
    A special instance used in CasCopier to identify a missing type

- ## Method Details

  - ### getName

    public String getName()
    Get the name of the type.
    Specified by:
      `getName` in interface `Type`
    Returns:
      The name of the type.

  - ### getJCasClassName

    public String getJCasClassName()

  - ### getSuperType

    public TypeImpl getSuperType()
    Get the super type.
    Returns:
      The super type or null for Top.

  - ### getCode

    public int getCode()
    Return the internal integer code for this type. This is only useful if you want to work with the low-level API.
    Returns:
      The internal code for this type, `>=0`.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### toString

    public String toString(int indent)

  - ### prettyPrint

    public void prettyPrint(StringBuilder sb, int indent)

  - ### prettyPrintWithSubTypes

    public void prettyPrintWithSubTypes(StringBuilder sb, int indent)

  - ### getAppropriateFeatures

    @Deprecated public Vector<Feature> getAppropriateFeatures()
    Deprecated.
    use `getFeatures()`
    Get a vector of the features for which this type is the domain. Features will be returned in no particular order.
    Specified by:
      `getAppropriateFeatures` in interface `Type`
    Returns:
      The vector.

  - ### getNumberOfFeatures

    public int getNumberOfFeatures()
    Get the number of features for which this type defines the range.
    Specified by:
      `getNumberOfFeatures` in interface `Type`
    Returns:
      The number of features.

  - ### isAppropriateFeature

    public boolean isAppropriateFeature(Feature feature)

  - ### isAnnotationType

    public boolean isAnnotationType()
    Check if this is an annotation type.
    Returns:
      `true`, if `this` is an annotation type or subtype; `false`, else.

  - ### isAnnotationBaseType

    public boolean isAnnotationBaseType()
    Returns:
      true for AnnotationBaseType or any subtype

  - ### isCreatableAndNotBuiltinArray

    public boolean isCreatableAndNotBuiltinArray()

  - ### getTypeSystem

    public TypeSystemImpl getTypeSystem()
    Get the type hierarchy that this type belongs to.
    Returns:
      The type hierarchy.

  - ### getFeatureByBaseName

    public FeatureImpl getFeatureByBaseName(String featureShortName)
    Description copied from interface: `Type`
    Retrieve a feature for this type. Inherited features can also be retrieved this way.
    Specified by:
      `getFeatureByBaseName` in interface `Type`
    Parameters:
      `featureShortName` - The short, unqualified name of the feature.
    Returns:
      The feature, if it exists; `null`, else.
    See Also:
      - `Type.getFeatureByBaseName(String)`

  - ### getShortName

    public String getShortName()
    Description copied from interface: `Type`
    Get the unqualified, short name of this type.
    Specified by:
      `getShortName` in interface `Type`
    Returns:
      The short name of this type.
    See Also:
      - `Type.getShortName()`

  - ### isFeatureFinal

    public boolean isFeatureFinal()
    Description copied from interface: `Type`
    Check if type is feature final, i.e., if no more new features may be defined for it.
    Specified by:
      `isFeatureFinal` in interface `Type`
    Returns:
      If type is feature final.
    See Also:
      - `Type.isFeatureFinal()`

  - ### isInheritanceFinal

    public boolean isInheritanceFinal()
    Description copied from interface: `Type`
    Check if type is inheritance final, i.e., if new types can be derived from it.
    Specified by:
      `isInheritanceFinal` in interface `Type`
    Returns:
      If type is inheritance final.
    See Also:
      - `Type.isInheritanceFinal()`

  - ### isLongOrDouble

    public boolean isLongOrDouble()

  - ### getFeature

    @Deprecated public Feature getFeature(String featureName)
    Deprecated.
    use getFeatureByBaseName instead
    Parameters:
      `featureName` - -
    Returns:
      -

  - ### getFeatures

    public List<Feature> getFeatures()
    guaranteed to be non-null, but might be empty list
    Specified by:
      `getFeatures` in interface `Type`
    Returns:
      -

  - ### getFeatureImpls

    public FeatureImpl[] getFeatureImpls()
    This impl depends on features never being removed from types, only added Minimal Java object generation, maximal reuse
    Returns:
      the list of feature impls

  - ### getFeaturesAsStream

    public Stream<FeatureImpl> getFeaturesAsStream()

  - ### getMergedStaticFeaturesIntroducedByThisType

    public List<FeatureImpl> getMergedStaticFeaturesIntroducedByThisType()

  - ### isPrimitive

    public boolean isPrimitive()
    Description copied from interface: `Type`
    Check if the type is one of the primitive types.
    Specified by:
      `isPrimitive` in interface `Type`
    Returns:
      `true` iff type is a primitive type.
    See Also:
      - `Type.isPrimitive()`

  - ### isArray

    public boolean isArray()
    Description copied from interface: `Type`
    Check if the type is an array type.
    Specified by:
      `isArray` in interface `Type`
    Returns:
      `true` iff the type is an array type.
    See Also:
      - `Type.isArray()`

  - ### isStringSubtype

    public boolean isStringSubtype()
    Description copied from interface: `Type`
    Check if the type is a String subtype. Note: returns false if a plain string
    Specified by:
      `isStringSubtype` in interface `Type`
    Returns:
      `true` iff the type is a String subtype type; false for plain string
    See Also:
      - `Type.isStringSubtype()`

  - ### isStringOrStringSubtype

    public boolean isStringOrStringSubtype()
    Specified by:
      `isStringOrStringSubtype` in interface `Type`
    Returns:
      true if is a String or a StringSubtype

  - ### getComponentType

    public TypeImpl getComponentType()
    Description copied from interface: `Type`
    For array types, returns the component type of the array type. For all other types, it will return `null`.
    Specified by:
      `getComponentType` in interface `Type`
    Returns:
      The component type of an array type.

  - ### getComponentSlotKind

    public SlotKinds.SlotKind getComponentSlotKind()

  - ### subsumes

    public boolean subsumes(TypeImpl ti)
    Parameters:
      `ti` - the subtype to check
    Returns:
      true if this type subsumes the subtype (is equal to or a supertype of the subtype)

  - ### subsumesStrictly

    public boolean subsumesStrictly(TypeImpl ti)
    Parameters:
      `ti` - the subtype to check
    Returns:
      true if this type subsumes the subtype (is equal to or a supertype of the subtype)

  - ### subsumesValue

    public boolean subsumesValue(Object v)
    Parameters:
      `v` - the value to test
    Returns:
      true if value v can be assigned to an object of this type

  - ### getFsSpaceReq

    public int getFsSpaceReq()
    Get the v2 heap size for types with features
    Returns:
      the main heap size for this FeatureStructure, assuming it's not a heap stored array (see below)

  - ### getFsSpaceReq

    public int getFsSpaceReq(int length)
    get the v2 heap size for types
    Parameters:
      `length` - for heap-stored arrays, the array length
    Returns:
      the main heap size for this FeatureStructure

  - ### getFsSpaceReq

    public int getFsSpaceReq(TOP fs)

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### hashCodeNameLong

    public long hashCodeNameLong()

  - ### equals

    public boolean equals(Object obj)
    Equal TypeImpl. Works across type systems.
    Overrides:
      `equals` in class `Object`

  - ### compareTo

    public int compareTo(TypeImpl t)
    compareTo must return 0 for "equal" types equal means same name, same flags, same supertype chain, same subtypes, and same features Makes use of hashcodelong to probablistically shortcut computation for equal case for not equal types, do by parts
    Specified by:
      `compareTo` in interface `Comparable<TypeImpl>`

  - ### hasRefFeature

    public boolean hasRefFeature()

  - ### getNbrOfLongOrDoubleFeatures

    public int getNbrOfLongOrDoubleFeatures()

  - ### isTypedFsArray

    public boolean isTypedFsArray()
    Returns:
      true if this type is an array of specific (not TOP) Feature structures, not FSArray

  - ### isTopType

    public boolean isTopType()

  - ### iterator

    public Iterator<Feature> iterator()
    Specified by:
      `iterator` in interface `Iterable<Feature>`