void addSofaFsToIndex(SofaFS sofa) { this.svd.baseCAS.getBaseIndexRepository().addFS(sofa); }
public void addSofa(FeatureStructure sofa, String sofaName, String mimeType) { if (this.svd.sofaNameSet.contains(sofaName)) { CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFANAME_ALREADY_EXISTS, new String[] { sofaName }); throw e; } final int llsofa = ll_getFSRef(sofa); if (0 == ll_getIntValue(llsofa, TypeSystemImpl.sofaNumFeatCode)) { ll_setIntValue(llsofa, TypeSystemImpl.sofaNumFeatCode, ++this.svd.viewCount); } ll_setStringValue(llsofa, TypeSystemImpl.sofaIdFeatCode, sofaName); ll_setStringValue(llsofa, TypeSystemImpl.sofaMimeFeatCode, mimeType); this.getBaseIndexRepository().addFS(sofa); this.svd.sofaNameSet.add(sofaName); }
private XCASDeserializerHandler(CASImpl aCAS, OutOfTypeSystemData ootsData) { super(); this.cas = aCAS.getBaseCAS(); // Reset the CAS. cas.resetNoQuestions(); this.fsTree = new RedBlackTree<FSInfo>(); this.idLess = new ArrayList<FSInfo>(); this.buffer = new StringBuffer(); this.outOfTypeSystemData = ootsData; this.indexRepositories = new ArrayList<FSIndexRepository>(); this.views = new ArrayList<CAS>(); // using the baseCas for indexing Sofas indexRepositories.add(this.cas.getBaseIndexRepository()); // There should always be another index for the Initial View indexRepositories.add(this.cas.getView(CAS.NAME_DEFAULT_SOFA).getIndexRepository()); this.sofaTypeCode = cas.ll_getTypeSystem().ll_getCodeForType( cas.getTypeSystem().getType(CAS.TYPE_NAME_SOFA)); this.annotBaseType = this.cas.getAnnotationType(); this.sofaRefMap = new IntVector(); this.indexMap = new IntVector(); // add entry for baseCAS ... point non-compliant annotations at first Sofa sofaRefMap.add(1); // add entry for baseCAS ... _indexed=0 stays in 0 indexMap.add(0); }
casBeingFilled.getBaseIndexRepository().addFS(sofa); CAS view = casBeingFilled.getView(sofa); if (sofa.getSofaRef() == 1) {
/** * Convert a Type System and Index Repository into a * CASMgrSerializer object which can be serialized * * @param casMgr the type system and index repo definitions * @return a serializable object version of these */ public static CASMgrSerializer serializeCASMgr(CASMgr casMgr) { CASMgrSerializer ser = new CASMgrSerializer(); ser.addTypeSystem((TypeSystemImpl) casMgr.getCAS().getTypeSystem()); ser.addIndexRepository((FSIndexRepositoryImpl) ((CASImpl) casMgr.getCAS()) .getBaseIndexRepository()); return ser; }
void refreshView(CAS cas, SofaFS aSofa) { if (aSofa != null) { // save address of SofaFS this.mySofaRef = ((FeatureStructureImpl) aSofa).getAddress(); } else { // this is the InitialView this.mySofaRef = -1; } // toss the JCas, if it exists this.jcas = null; // create the indexRepository for this Sofa this.indexRepository = new FSIndexRepositoryImpl(this, (FSIndexRepositoryImpl) ((CASImpl) cas) .getBaseIndexRepository()); this.indexRepository.commit(); // save new sofa index if (this.mySofaRef == -1) { ((CASImpl) cas).setSofaIndexRepository(1, this.indexRepository); } else { ((CASImpl) cas).setSofaIndexRepository(aSofa, this.indexRepository); } }
FSIndexRepositoryImpl ir = (FSIndexRepositoryImpl) cas.getBaseCAS().getBaseIndexRepository(); int[] fsarray = ir.getIndexedFSs(); try {
cas.getBaseIndexRepository().addFS(sofa); CAS view = cas.getView(sofa); if (sofa.getSofaRef() == 1) {
(FSIndexRepositoryImpl) cas.getBaseIndexRepository()); this.indexRepository.commit();
/** * Push the indexed FSs onto the queue. */ private void enqueueIndexed() { FSIndexRepositoryImpl ir = (FSIndexRepositoryImpl) cas.getBaseCAS().getBaseIndexRepository(); int[] fsarray = ir.getIndexedFSs(); for (int k = 0; k < fsarray.length; k++) { enqueueIndexed(fsarray[k], 0); } // Get indexes for each SofaFS in the CAS int numViews = cas.getBaseSofaCount(); for (int sofaNum = 1; sofaNum <= numViews; sofaNum++) { FSIndexRepositoryImpl loopIR = (FSIndexRepositoryImpl) cas.getBaseCAS() .getSofaIndexRepository(sofaNum); if (loopIR != null) { fsarray = loopIR.getIndexedFSs(); for (int k = 0; k < fsarray.length; k++) { enqueueIndexed(fsarray[k], sofaNum); } } } }
this.indexRepositories = new ArrayList<FSIndexRepository>(); this.views = new ArrayList<CAS>(); indexRepositories.add(this.casBeingFilled.getBaseIndexRepository());