/** * Find the chain head for the given link. * * @param aJCas the CAS. * @param aLink the link to search the chain for. * @return the chain. */ private FeatureStructure getChainForLink(JCas aJCas, AnnotationFS aLink) { Type chainType = CasUtil.getType(aJCas.getCas(), getChainTypeName()); for (FeatureStructure chainFs : selectFS(aJCas.getCas(), chainType)) { AnnotationFS linkFs = getFirstLink(chainFs); // Now we seek the link within the current chain while (linkFs != null) { if (WebAnnoCasUtil.isSame(linkFs, aLink)) { return chainFs; } linkFs = getNextLink(linkFs); } } // This should never happen unless the data in the CAS has been created wrongly throw new IllegalArgumentException("Link not part of any chain"); }
/** * Find the chain head for the given link. * * @param aJCas the CAS. * @param aLink the link to search the chain for. * @return the chain. */ private FeatureStructure getChainForLink(JCas aJCas, AnnotationFS aLink) { Type chainType = CasUtil.getType(aJCas.getCas(), getChainTypeName()); for (FeatureStructure chainFs : selectFS(aJCas.getCas(), chainType)) { AnnotationFS linkFs = getFirstLink(chainFs); // Now we seek the link within the current chain while (linkFs != null) { if (WebAnnoCasUtil.isSame(linkFs, aLink)) { return chainFs; } linkFs = getNextLink(linkFs); } } // This should never happen unless the data in the CAS has been created wrongly throw new IllegalArgumentException("Link not part of any chain"); }
/** * Create a new chain head feature structure. Already adds the chain to the CAS. */ private FeatureStructure newChain(JCas aJCas, AnnotationFS aFirstLink) { Type chainType = CasUtil.getType(aJCas.getCas(), getChainTypeName()); FeatureStructure newChain = aJCas.getCas().createFS(chainType); newChain.setFeatureValue(chainType.getFeatureByBaseName(getChainFirstFeatureName()), aFirstLink); aJCas.addFsToIndexes(newChain); return newChain; }
/** * Create a new chain head feature structure. Already adds the chain to the CAS. */ private FeatureStructure newChain(JCas aJCas, AnnotationFS aFirstLink) { Type chainType = CasUtil.getType(aJCas.getCas(), getChainTypeName()); FeatureStructure newChain = aJCas.getCas().createFS(chainType); newChain.setFeatureValue(chainType.getFeatureByBaseName(getChainFirstFeatureName()), aFirstLink); aJCas.addFsToIndexes(newChain); return newChain; }
Type chainType = CasUtil.getType(aJcas.getCas(), typeAdapter.getChainTypeName()); Feature chainFirst = chainType.getFeatureByBaseName(typeAdapter.getChainFirstFeatureName());
Type chainType = CasUtil.getType(aJcas.getCas(), typeAdapter.getChainTypeName()); Feature chainFirst = chainType.getFeatureByBaseName(typeAdapter.getChainFirstFeatureName());
private void deleteSpan(JCas aJCas, int aAddress) Type chainType = CasUtil.getType(aJCas.getCas(), getChainTypeName());
private void deleteSpan(JCas aJCas, int aAddress) Type chainType = CasUtil.getType(aJCas.getCas(), getChainTypeName());