Package org.apache.uima.cas.impl
Class TypeSystemUtils
- java.lang.Object
-
- org.apache.uima.cas.impl.TypeSystemUtils
-
public abstract class TypeSystemUtils extends java.lang.ObjectType Utilities - all static, so class is abstract to prevent creation Used by Feature Path
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classTypeSystemUtils.FeatureParse(package private) static classTypeSystemUtils.NameSpaceParse(package private) static classTypeSystemUtils.ParsingErrorstatic classTypeSystemUtils.PathValid(package private) static classTypeSystemUtils.TypeParse(package private) static classTypeSystemUtils.TypeSystemParse
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringNAMESPACE_SEPARATOR_AS_STRING
-
Constructor Summary
Constructors Constructor Description TypeSystemUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intclassifyType(Type type)Classify types into FS type, array type etc.static booleanisIdentifier(java.lang.String s)(package private) static booleanisIdentifierChar(char c)(package private) static booleanisIdentifierStart(char c)(package private) static booleanisNonQualifiedName(java.lang.String s)private static TypeSystemUtils.PathValidisPathValid(TypeImpl type, java.util.Deque<java.lang.String> path, TypeSystemUtils.PathValid status)Recursively called on each successive path element.static TypeSystemUtils.PathValidisPathValid(Type type, java.util.List<java.lang.String> path)Given a starting Type and a list of features representing a feature path, checks if a feature path is valid for a given type.private static TypeSystemUtils.PathValidisPathValidInSubtypes(TypeImpl type, java.lang.String fName, java.util.Deque<java.lang.String> nextPath)Called when the Feature Name is not a valid feature of the currenttype.(package private) static booleanisTypeName(java.lang.String name)Check ifnameis a possible type name.(package private) static booleanisTypeNameSpaceName(java.lang.String name)
-
-
-
Field Detail
-
NAMESPACE_SEPARATOR_AS_STRING
private static final java.lang.String NAMESPACE_SEPARATOR_AS_STRING
- See Also:
- Constant Field Values
-
-
Method Detail
-
isIdentifier
public static boolean isIdentifier(java.lang.String s)
-
isNonQualifiedName
static boolean isNonQualifiedName(java.lang.String s)
-
isIdentifierStart
static boolean isIdentifierStart(char c)
-
isIdentifierChar
static boolean isIdentifierChar(char c)
-
isTypeName
static boolean isTypeName(java.lang.String name)
Check ifnameis a possible type name. Does not check if this type actually exists!- Parameters:
name- The name to check.- Returns:
trueiffnameis a possible type name.
-
isTypeNameSpaceName
static boolean isTypeNameSpaceName(java.lang.String name)
-
isPathValid
public static final TypeSystemUtils.PathValid isPathValid(Type type, java.util.List<java.lang.String> path)
Given a starting Type and a list of features representing a feature path, checks if a feature path is valid for a given type.
We distinguish three cases:
PathValid.NEVER: there is no object oftypeon whichpathcan ever be defined.PathValid.ALWAYS: if all intermediate objects are non-null, thispathwill always be defined on any object oftype.PathValid.POSSIBLE: some objects oftypewill havepathdefined, while others may not.
-
isPathValid
private static final TypeSystemUtils.PathValid isPathValid(TypeImpl type, java.util.Deque<java.lang.String> path, TypeSystemUtils.PathValid status)
Recursively called on each successive path element. Pops a feature name off the path, and checks if it exists for the type. -- if exists, gets its range type and iterates via recursion. Stops when the queue of feature names is empty.- Parameters:
type-path-status- the returned value if the feature is found.- Returns:
-
isPathValidInSubtypes
private static final TypeSystemUtils.PathValid isPathValidInSubtypes(TypeImpl type, java.lang.String fName, java.util.Deque<java.lang.String> nextPath)
Called when the Feature Name is not a valid feature of the currenttype. It examines all the subtypes to see if it can find one for which the feature is valid. If the feature name is found in any subtype (recursively) of the type - given one subtype is found having the feature, continue the checking of subsequent features in the path - to see if there's some path where all the features are found. -- if so, return PathValid.POSSIBLE. -- if not, loop to try other subtypes. - if no subtypes have all the features, return PathValid.NEVER. The subtypes are descended when the feature name isn't a feature of a subtype, to see if a sub-sub-type might define the feature. The subtypes for one type are iterated while they have no match at any depth for the feature name- Parameters:
type- the type whose subtypes should be checkedfName-nextPath-- Returns:
-
classifyType
public static final int classifyType(Type type)
Classify types into FS type, array type etc. For the full list of return types, see theLowLevelCAS.TYPE_CLASS*constants, as well as the documentation forLowLevelCAS.ll_getTypeClass(int).- Parameters:
type- The type to classify.- Returns:
- An integer encoding the the type class. See above.
-
-