public static <T extends FeatureStructure> T selectByAddr(CAS aCas, Class<T> aType, int aAddress) { return aType.cast(aCas.getLowLevelCAS().ll_getFSForRef(aAddress)); }
public static <T extends FeatureStructure> T selectByAddr(CAS aCas, Class<T> aType, int aAddress) { return aType.cast(aCas.getLowLevelCAS().ll_getFSForRef(aAddress)); }
/** * Gets the named view; if the view doesn't exist it will be created. */ private static CASImpl getOrCreateView(CAS aCas, String aViewName) { //TODO: there should be some way to do this without the try...catch try { // throws if view doesn't exist return (CASImpl) aCas.getView(aViewName).getLowLevelCAS(); } catch(CASRuntimeException e) { //create the view return (CASImpl) aCas.createView(aViewName).getLowLevelCAS(); } }
public String getValueAsString(FeatureStructure fs) { if (fs != null) { LowLevelCAS llCas = fs.getCAS().getLowLevelCAS(); return ll_getValueAsString(llCas.ll_getFSRef(fs), llCas); } else { return null; } }
public static Set<FeatureStructure> collectIndexed(CAS aCas) { LowLevelCAS llcas = aCas.getLowLevelCAS(); Set<FeatureStructure> fses = new TreeSet<>(Comparator.comparingInt(llcas::ll_getFSRef)); FSIterator<FeatureStructure> i = aCas.getIndexRepository().getAllIndexedFS( aCas.getTypeSystem().getTopType()); i.forEachRemaining(fses::add); return fses; }
public static Set<FeatureStructure> collectReachable(CAS aCas) { LowLevelCAS llcas = aCas.getLowLevelCAS(); Set<FeatureStructure> fses = new TreeSet<>(Comparator.comparingInt(llcas::ll_getFSRef)); FSIterator<FeatureStructure> i = aCas.getIndexRepository().getAllIndexedFS( aCas.getTypeSystem().getTopType()); i.forEachRemaining(fs -> collect(fses, fs)); return fses; }
public static Set<FeatureStructure> collectIndexed(CAS aCas) { LowLevelCAS llcas = aCas.getLowLevelCAS(); Set<FeatureStructure> fses = new TreeSet<>((fs1, fs2) -> llcas.ll_getFSRef(fs1) - llcas.ll_getFSRef(fs2)); FSIterator<FeatureStructure> i = aCas.getIndexRepository().getAllIndexedFS( aCas.getTypeSystem().getTopType()); i.forEachRemaining(fs -> fses.add(fs)); return fses; }
public Type getType(FeatureStructure fs) { if (fs != null) { LowLevelCAS llCas = fs.getCAS().getLowLevelCAS(); FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs), llCas); if (featurePathValue != null) { return featurePathValue.getFeatureType(); } } return null; }
public static Set<FeatureStructure> collectIndexed(CAS aCas) { LowLevelCAS llcas = aCas.getLowLevelCAS(); Set<FeatureStructure> fses = new TreeSet<>((fs1, fs2) -> llcas.ll_getFSRef(fs1) - llcas.ll_getFSRef(fs2)); FSIterator<FeatureStructure> i = aCas.getIndexRepository().getAllIndexedFS( aCas.getTypeSystem().getTopType()); i.forEachRemaining(fs -> fses.add(fs)); return fses; }
public Float getFloatValue(FeatureStructure fs) { if (fs != null) { LowLevelCAS llCas = fs.getCAS().getLowLevelCAS(); FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs), llCas); if ((featurePathValue != null) && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_FLOAT)) { return featurePathValue.getFloatValue(); } } return null; }
public Byte getByteValue(FeatureStructure fs) { if (fs != null) { LowLevelCAS llCas = fs.getCAS().getLowLevelCAS(); FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs), llCas); if ((featurePathValue != null) && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_BYTE)) { return featurePathValue.getByteValue(); } } return null; }
public Double getDoubleValue(FeatureStructure fs) { if (fs != null) { LowLevelCAS llCas = fs.getCAS().getLowLevelCAS(); FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs), llCas); if ((featurePathValue != null) && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_DOUBLE)) { return featurePathValue.getDoubleValue(); } } return null; }
public Integer getIntValue(FeatureStructure fs) { if (fs != null) { LowLevelCAS llCas = fs.getCAS().getLowLevelCAS(); FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs), llCas); if ((featurePathValue != null) && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_INT)) { return featurePathValue.getIntValue(); } } return null; }
public Short getShortValue(FeatureStructure fs) { if (fs != null) { LowLevelCAS llCas = fs.getCAS().getLowLevelCAS(); FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs), llCas); if ((featurePathValue != null) && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_SHORT)) { return featurePathValue.getShortValue(); } } return null; }
public FeatureStructure find(FeatureStructure fs) { LowLevelCAS llc = fs.getCAS().getLowLevelCAS(); final int addr = llc.ll_getFSRef(fs); final int resultAddr = this.tree.getKeyForNode(this.tree.findKey(addr)); if (resultAddr > 0) { return llc.ll_getFSForRef(resultAddr); } return null; }
public Boolean getBooleanValue(FeatureStructure fs) { if (fs != null) { LowLevelCAS llCas = fs.getCAS().getLowLevelCAS(); FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs), llCas); if ((featurePathValue != null) && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_BOOLEAN)) { return featurePathValue.getBooleanValue(); } } return null; }
public String getStringValue(FeatureStructure fs) { if (fs != null) { LowLevelCAS llCas = fs.getCAS().getLowLevelCAS(); FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs), llCas); if ((featurePathValue != null) && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_STRING)) { return featurePathValue.getStringValue(); } } return null; }
public Long getLongValue(FeatureStructure fs) { if (fs != null) { LowLevelCAS llCas = fs.getCAS().getLowLevelCAS(); FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs), llCas); if ((featurePathValue != null) && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_LONG)) { return featurePathValue.getLongValue(); } } return null; }
public static Set<FeatureStructure> collectReachable(CAS aCas) { LowLevelCAS llcas = aCas.getLowLevelCAS(); Set<FeatureStructure> fses = new TreeSet<>((fs1, fs2) -> llcas.ll_getFSRef(fs1) - llcas.ll_getFSRef(fs2)); FSIterator<FeatureStructure> i = aCas.getIndexRepository().getAllIndexedFS( aCas.getTypeSystem().getTopType()); i.forEachRemaining(fs -> collect(fses, fs)); return fses; }
public static Set<FeatureStructure> collectReachable(CAS aCas) { LowLevelCAS llcas = aCas.getLowLevelCAS(); Set<FeatureStructure> fses = new TreeSet<>((fs1, fs2) -> llcas.ll_getFSRef(fs1) - llcas.ll_getFSRef(fs2)); FSIterator<FeatureStructure> i = aCas.getIndexRepository().getAllIndexedFS( aCas.getTypeSystem().getTopType()); i.forEachRemaining(fs -> collect(fses, fs)); return fses; }