Package org.apache.uima.cas.impl
Class CasTypeSystemMapper
java.lang.Object
org.apache.uima.cas.impl.CasTypeSystemMapper
This class gets initialized with two type systems, and then provides resources to map type and
feature codes between them.
It is used by some Binary serialization/ deserialization code to allow non-exact matched type
systems to send and receive CASes in a binary-like format.
Use cases:
Serializing: Source ts -%gt; generate serialized form in Target ts
Deserializing: Target ts -%gt; generate deserialized form in Source ts
- either from remote or
- from disk-stored-form
Mapping details:
Types are mapped by name.
Same-named types do not need to have the same number of features.
Same-named features must have same Range - otherwise, not mapped.
Types with 0 features mapped allowed.
LifeCycle:
Instance of this are created for a CAS when needed, and then
kept in the (source) TypeSystemImpl, in a map indexed by
the target type system (identity map)
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetSrcFeature
(TypeImpl tgtType, FeatureImpl tgtFeat) getSrcFeatures
(TypeImpl tgtType) Given a tgt type, return an array of source features in the order they would appear in the target.getTgtFeature
(TypeImpl srcType, FeatureImpl srcFeat) Get target feature, given src type and featuregetToFeature
(FeatureImpl[][] mapByTypeCode, TypeImpl fromType, FeatureImpl fromFeat) boolean
isEqual()
mapTypeCode2Other
(TypeImpl type, boolean src2tgt) mapTypeCodeTgt2Src
(int tgtTypeCode) mapTypeSrc2Tgt
(TypeImpl srcType) mapTypeTgt2Src
(TypeImpl tgtType)
-
Field Details
-
tsSrc
-
tsTgt
-
-
Constructor Details
-
CasTypeSystemMapper
-
-
Method Details
-
isEqual
public boolean isEqual() -
mapTypeSrc2Tgt
- Parameters:
srcType
- -- Returns:
- Type in other type system, or this one if map is empty
-
mapTypeTgt2Src
- Parameters:
tgtType
- -- Returns:
- 0 if type doesn't have corresponding code in other type system
-
mapTypeCodeTgt2Src
-
mapTypeCode2Other
- Parameters:
type
- -src2tgt
- -- Returns:
- 0 if type doesn't have corresponding code in other type system
-
getTgtFeature
Get target feature, given src type and feature- Parameters:
srcType
- the source typesrcFeat
- the source feature- Returns:
- the target feature or null
-
getSrcFeature
-
getSrcFeatures
Given a tgt type, return an array of source features in the order they would appear in the target.- Parameters:
tgtType
- -- Returns:
- array of corresponding source features, in target type order
-
getToFeature
public FeatureImpl getToFeature(FeatureImpl[][] mapByTypeCode, TypeImpl fromType, FeatureImpl fromFeat)
-