public FeatureStructure copyFs(FeatureStructure aFS){
  assert ((CASImpl)aFS.getCAS()).getBaseCAS() == ((CASImpl)mSrcCas).getBaseCAS();
  FeatureStructure copy=mFsMap.get(aFS);
  if (copy != null) {
    return copy;
  }
  Type srcType=aFS.getType();
  if (aFS instanceof SofaFS) {
    String sofaId=((SofaFS)aFS).getSofaID();
    return getOrCreateView(mDestCas,sofaId).getSofa();
  }
  if (isDocumentAnnotation(aFS)) {
    String viewName=((AnnotationFS)aFS).getView().getViewName();
    CAS destView=mDestCas.getView(viewName);
    FeatureStructure destDocAnnot=destView.getDocumentAnnotation();
    if (destDocAnnot != null) {
      copyFeatures(aFS,destDocAnnot);
    }
    return destDocAnnot;
  }
  if (aFS.getType().isArray()) {
    copy=copyArray(aFS);
    mFsMap.put(aFS,copy);
    return copy;
  }
  Type destType;
  if (mDestCas.getTypeSystem() == mSrcCas.getTypeSystem()) {
    destType=srcType;
  }
 else {
    destType=mDestCas.getTypeSystem().getType(srcType.getName());
  }
  if (destType == null) {
    throw new UIMARuntimeException(UIMARuntimeException.TYPE_NOT_FOUND_DURING_CAS_COPY,new Object[]{srcType.getName()});
  }
  int typeCode=mLowLevelDestCas.ll_getTypeSystem().ll_getCodeForType(destType);
  int destFsAddr=mLowLevelDestCas.ll_createFS(typeCode);
  FeatureStructure destFs=mDestCas.getLowLevelCAS().ll_getFSForRef(destFsAddr);
  mFsMap.put(aFS,destFs);
  copyFeatures(aFS,destFs);
  return destFs;
}

public FeatureStructure copyFs ( FeatureStructure aFS ) { assert ( ( CASImpl ) aFS . getCAS ( ) ) . getBaseCAS ( ) == ( ( CASImpl ) mSrcCas ) . getBaseCAS ( ) ; FeatureStructure copy = mFsMap . get ( aFS ) ; if ( copy != null ) { return copy ; } Type srcType = aFS . getType ( ) ; if ( aFS instanceof SofaFS ) { String sofaId = ( ( SofaFS ) aFS ) . getSofaID ( ) ; return getOrCreateView ( mDestCas , sofaId ) . getSofa ( ) ; } if ( isDocumentAnnotation ( aFS ) ) { String viewName = ( ( AnnotationFS ) aFS ) . getView ( ) . getViewName ( ) ; CAS destView = mDestCas . getView ( viewName ) ; FeatureStructure destDocAnnot = destView . getDocumentAnnotation ( ) ; if ( destDocAnnot != null ) { copyFeatures ( aFS , destDocAnnot ) ; } return destDocAnnot ; } if ( aFS . getType ( ) . isArray ( ) ) { copy = copyArray ( aFS ) ; mFsMap . put ( aFS , copy ) ; return copy ; } Type destType ; if ( mDestCas . getTypeSystem ( ) == mSrcCas . getTypeSystem ( ) ) { destType = srcType ; } else { destType = mDestCas . getTypeSystem ( ) . getType ( srcType . getName ( ) ) ; } if ( destType == null ) { throw new UIMARuntimeException ( UIMARuntimeException . TYPE_NOT_FOUND_DURING_CAS_COPY , new Object [ ] { srcType . getName ( ) } ) ; } int typeCode = mLowLevelDestCas . ll_getTypeSystem ( ) . ll_getCodeForType ( destType ) ; int destFsAddr = mLowLevelDestCas . ll_createFS ( typeCode ) ; FeatureStructure destFs = mDestCas . getLowLevelCAS ( ) . ll_getFSForRef ( destFsAddr ) ; mFsMap . put ( aFS , destFs ) ; copyFeatures ( aFS , destFs ) ; return destFs ; }
copies an fs from the source cas to the destination cas . also copies any referenced fs , except that previously copied fs will not be copied again .
