org.apache.uima.cas.impl

## Class CasTypeSystemMapper

- java.lang.Object
- - org.apache.uima.cas.impl.CasTypeSystemMapper

-     public class CasTypeSystemMapper
      extends Object

  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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `TypeSystemImpl` | `tsSrc`
    `WeakReference<TypeSystemImpl>` | `tsTgt`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CasTypeSystemMapper(TypeSystemImpl tsSrc, TypeSystemImpl tsTgt)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean[]` | `getFSrcInTgt(int tCode)`
    `int[]` | `getTgtFeatOffsets2Src(int tCode)`
    `boolean` | `isEqual()`
    `int` | `mapTypeCode2Other(int c, boolean src2tgt)`
    `int` | `mapTypeCodeSrc2Tgt(int c)`
    `int` | `mapTypeCodeTgt2Src(int c)`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### tsSrc

          public final TypeSystemImpl tsSrc

    - #### tsTgt

          public final WeakReference<TypeSystemImpl> tsTgt

  - ### Constructor Detail

    - #### CasTypeSystemMapper

          public CasTypeSystemMapper(TypeSystemImpl tsSrc,
                                     TypeSystemImpl tsTgt)
                              throws ResourceInitializationException

      Throws:
        `ResourceInitializationException`

  - ### Method Detail

    - #### isEqual

          public boolean isEqual()

    - #### mapTypeCodeSrc2Tgt

          public int mapTypeCodeSrc2Tgt(int c)

      Parameters:
        `c` - -
      Returns:
        0 if type doesn't have corresponding code in other type system

    - #### mapTypeCodeTgt2Src

          public int mapTypeCodeTgt2Src(int c)

      Parameters:
        `c` - -
      Returns:
        0 if type doesn't have corresponding code in other type system

    - #### mapTypeCode2Other

          public int mapTypeCode2Other(int c,
                                       boolean src2tgt)

      Parameters:
        `c` - -
        `src2tgt` - -
      Returns:
        0 if type doesn't have corresponding code in other type system

    - #### getTgtFeatOffsets2Src

          public int[] getTgtFeatOffsets2Src(int tCode)

      Parameters:
        `tCode` - - source type code
      Returns:
        int vec of 0-based feat offsets in src of feats in tgt, in the order of the target

    - #### getFSrcInTgt

          public boolean[] getFSrcInTgt(int tCode)

Copyright © 2006–2021 The Apache Software Foundation. All rights reserved.