public static <T extends FeatureStructure> T selectByAddr(JCas aJCas, Class<T> aType, int aAddress) { return aType.cast(aJCas.getLowLevelCas().ll_getFSForRef(aAddress)); }
public static <T extends FeatureStructure> T selectByAddr(JCas aJCas, Class<T> aType, int aAddress) { return aType.cast(aJCas.getLowLevelCas().ll_getFSForRef(aAddress)); }
public static <T extends FeatureStructure> T selectByAddr(JCas aJCas, Class<T> aType, int aAddress) { return aType.cast(aJCas.getLowLevelCas().ll_getFSForRef(aAddress)); }
@Override public LowLevelCAS getLowLevelCas() { testLiveness(); return delegate.getLowLevelCas(); }
private void setTokenId(JCas aJCas, Map<Integer, String> aTokenAddress) { LowLevelCAS llCas = aJCas.getLowLevelCas(); int sentenceId = 1; for (Sentence sentence : select(aJCas, Sentence.class)) { int tokenId = 1; for (Token token : selectCovered(Token.class, sentence)) { aTokenAddress.put(llCas.ll_getFSRef(token), sentenceId + "-" + tokenId++); } sentenceId++; } }
private void setTokenPosition(JCas aJCas, Map<Integer, Integer> aTokenAddress) { LowLevelCAS llCas = aJCas.getLowLevelCas(); for (Token token : select(aJCas, Token.class)) { aTokenAddress.put(token.getBegin(), llCas.ll_getFSRef(token)); } }
private void setTokenPosition(JCas aJCas, Map<Integer, Integer> aTokenAddress) { LowLevelCAS llCas = aJCas.getLowLevelCas(); for (Token token : select(aJCas, Token.class)) { aTokenAddress.put(token.getBegin(), llCas.ll_getFSRef(token)); } }
private void setTokenId(JCas aJCas, Map<Integer, String> aTokenAddress) { LowLevelCAS llCas = aJCas.getLowLevelCas(); int sentenceId = 1; for (Sentence sentence : select(aJCas, Sentence.class)) { int tokenId = 1; for (Token token : selectCovered(Token.class, sentence)) { aTokenAddress.put(llCas.ll_getFSRef(token), sentenceId + "-" + tokenId++); } sentenceId++; } }
/** * Make a new ShortArray of given size * @param jcas The JCas * @param length The number of elements in the new array */ public ShortArray(JCas jcas, int length) { this(jcas.getLowLevelCas().ll_createShortArray(length), jcas.getType(typeIndexID)); }
/** * Make a new LongArray of given size * @param jcas The JCas * @param length The number of elements in the new array */ public LongArray(JCas jcas, int length) { this(jcas.getLowLevelCas().ll_createLongArray(length), jcas.getType(typeIndexID)); }
private void setTokenSentenceAddress(JCas aJCas, Map<Integer, Integer> aTokenListInSentence) { LowLevelCAS llCas = aJCas.getLowLevelCas(); for (Sentence sentence : select(aJCas, Sentence.class)) { for (Token token : selectCovered(Token.class, sentence)) { aTokenListInSentence.put(llCas.ll_getFSRef(token), llCas.ll_getFSRef(sentence)); } } }
private void setTokenSentenceAddress(JCas aJCas, Map<Integer, Integer> aTokenListInSentence) { LowLevelCAS llCas = aJCas.getLowLevelCas(); for (Sentence sentence : select(aJCas, Sentence.class)) { for (Token token : selectCovered(Token.class, sentence)) { aTokenListInSentence.put(llCas.ll_getFSRef(token), llCas.ll_getFSRef(sentence)); } } }
/** * Make a new DoubleArray of given size * @param jcas The JCas * @param length the length of the array */ public DoubleArray(JCas jcas, int length) { this(jcas.getLowLevelCas().ll_createDoubleArray(length), jcas.getType(typeIndexID)); }
/** * Make a new ByteArray of given size * @param jcas the JCas * @param length the length of the array in bytes */ public ByteArray(JCas jcas, int length) { this(jcas.getLowLevelCas().ll_createByteArray(length), jcas.getType(typeIndexID)); }
/** * Make a new BooleanArray of given size * @param jcas JCas reference * @param length of array */ public BooleanArray(JCas jcas, int length) { this(jcas.getLowLevelCas().ll_createBooleanArray(length), jcas.getType(typeIndexID)); }
/** * Make a new StringArray of given size * @param jcas The JCas * @param length The number of elements in the new array */ public StringArray(JCas jcas, int length) { this( /* addr */jcas.getLowLevelCas().ll_createArray(jcas.getType(typeIndexID).casTypeCode, length, true), /* type */jcas.getType(typeIndexID)); }
/** * Make a new IntegerArray of given size * @param jcas The JCas * @param length The number of elements in the new array */ public IntegerArray(JCas jcas, int length) { this( /* addr */jcas.getLowLevelCas().ll_createArray(jcas.getType(typeIndexID).casTypeCode, length), /* type */jcas.getType(typeIndexID)); // at this point we can use the jcasType value, as it is set // can't do this earlier as the very first statement is required by // JAVA to be the super or alternate constructor call jcasType.casImpl.checkArrayPreconditions(length); }
/** * Make a new FSArray of given size * @param jcas The JCas * @param length The number of elements in the new array */ public FSArray(JCas jcas, int length) { this( /* addr */jcas.getLowLevelCas().ll_createArray(jcas.getType(typeIndexID).casTypeCode, length), /* type */jcas.getType(typeIndexID)); // at this point we can use the jcasType value, as it is set // can't do this earlier as the very first statement is required by // JAVA to be the super or alternate constructor call jcasType.casImpl.checkArrayPreconditions(length); }
/** * Make a new FloatArray of given size * @param jcas the JCas * @param length the size of the array */ public FloatArray(JCas jcas, int length) { this( /* addr */ jcas.getLowLevelCas().ll_createArray(jcas.getType(typeIndexID).casTypeCode, length), /* type */ jcas.getType(typeIndexID)); // at this point we can use the jcasType value, as it is set // can't do this earlier as the very first statement is required by // JAVA to be the super or alternate constructor call jcasType.casImpl.checkArrayPreconditions(length); }
private void updateOffsets(CAS sourceView, JCas targetView, AlignedString as, PositiveIntSet aCopiedFs) throws CASException, AnalysisEngineProcessException { // We only update annotations that were copied, nothing that was already there. IntListIterator it = aCopiedFs.iterator(); while (it.hasNext()) { FeatureStructure fs = targetView.getLowLevelCas().ll_getFSForRef(it.next()); if (fs instanceof Annotation) { // Now we update the offsets Annotation a = (Annotation) fs; // System.out.printf("Orig %s %3d %3d : %s%n", a.getType().getShortName(), // a.getBegin(), a.getEnd(), // sourceView.getDocumentText().substring(a.getBegin(), a.getEnd())); // System.out.printf("Before %s %3d %3d : %s%n", a.getType().getShortName(), // a.getBegin(), a.getEnd(), a.getCoveredText()); Interval resolved = as.resolve(new ImmutableInterval(a.getBegin(), a.getEnd())); a.setBegin(resolved.getStart()); a.setEnd(resolved.getEnd()); // System.out.printf("After %s %3d %3d : %s%n", a.getType().getShortName(), // a.getBegin(), a.getEnd(), a.getCoveredText()); } } } }