@Override public void finished(RutaStream stream, List<RutaInferenceVisitor> visitors) { for (FeatureStructure each : fsList) { each.getCAS().addFsToIndexes(each); } }
public static int getAddr(FeatureStructure aFS) { return ((CASImpl) aFS.getCAS()).ll_getFSRef(aFS); }
public void finished(TextMarkerStream stream, List<TextMarkerInferenceVisitor> visitors) { for (FeatureStructure each : fsList) { each.getCAS().addFsToIndexes(each); } }
/** * Copies a generic {@code FeatureStructure} to another of the same type. * * @param from {@code FeatureStructure} to copy from. * @param to {@code FeatureStructure} to copy to. */ public void copy(FeatureStructure from, FeatureStructure to) { fsCopiers.getOrDefault(from.getType().getName(), this::defaultCopy).accept(from, to); to.getCAS().addFsToIndexes(to); } }
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 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; }
@Override public boolean match(FeatureStructure ref, FeatureStructure cand) { if (!subtypeMatch) { return ref.getType().equals(cand.getType()); } else { TypeSystem ts = ref.getCAS().getTypeSystem(); return ts.subsumes(ref.getType(), cand.getType()); } }
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; }
@Override public List<LinkWithRoleModel> getFeatureValue(AnnotationFeature aFeature, FeatureStructure aFS) { Feature linkFeature = aFS.getType().getFeatureByBaseName(aFeature.getName()); return wrapFeatureValue(aFeature, aFS.getCAS(), aFS.getFeatureValue(linkFeature)); }
@Override public List<LinkWithRoleModel> getFeatureValue(AnnotationFeature aFeature, FeatureStructure aFS) { Feature linkFeature = aFS.getType().getFeatureByBaseName(aFeature.getName()); return wrapFeatureValue(aFeature, aFS.getCAS(), aFS.getFeatureValue(linkFeature)); }
@Override public List<LinkWithRoleModel> getFeatureValue(AnnotationFeature aFeature, FeatureStructure aFS) { Feature linkFeature = aFS.getType().getFeatureByBaseName(aFeature.getName()); return wrapFeatureValue(aFeature, aFS.getCAS(), aFS.getFeatureValue(linkFeature)); }
@Override public List<LinkWithRoleModel> getFeatureValue(AnnotationFeature aFeature, FeatureStructure aFS) { Feature linkFeature = aFS.getType().getFeatureByBaseName(aFeature.getName()); return wrapFeatureValue(aFeature, aFS.getCAS(), aFS.getFeatureValue(linkFeature)); }
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; }
private void insertFS(FeatureStructure fs, Type type, CAS cas, boolean withParents) { TypeTreeNode typeTreeNode = getTreeNode(type, cas); FSTreeNode node = createFSNode(typeTreeNode, fs); typeTreeNode.addChild(node); if (withParents) { Type parent = fs.getCAS().getTypeSystem().getParent(type); if (parent != null) { insertFS(fs, parent, cas, withParents); } } }
public static void setFeature(FeatureStructure aFS, String aFeature, short... aValue) { Feature feat = getMandatoryFeature(aFS, aFeature); if (feat.getRange().isPrimitive()) { requireSingleValue(feat, aValue); aFS.setShortValue(feat, aValue[0]); } else if (aValue == null) { aFS.setFeatureValue(feat, null); } else { aFS.setFeatureValue(feat, createShortArray(aFS.getCAS(), aValue)); } }
public static void setFeature(FeatureStructure aFS, String aFeature, byte... aValue) { Feature feat = getMandatoryFeature(aFS, aFeature); if (feat.getRange().isPrimitive()) { requireSingleValue(feat, aValue); aFS.setByteValue(feat, aValue[0]); } else if (aValue == null) { aFS.setFeatureValue(feat, null); } else { aFS.setFeatureValue(feat, createByteArray(aFS.getCAS(), aValue)); } }
public static void setFeature(FeatureStructure aFS, String aFeature, double... aValue) { Feature feat = getMandatoryFeature(aFS, aFeature); if (feat.getRange().isPrimitive()) { requireSingleValue(feat, aValue); aFS.setDoubleValue(feat, aValue[0]); } else if (aValue == null) { aFS.setFeatureValue(feat, null); } else { aFS.setFeatureValue(feat, createDoubleArray(aFS.getCAS(), aValue)); } }
public static void setFeature(FeatureStructure aFS, String aFeature, long... aValue) { Feature feat = getMandatoryFeature(aFS, aFeature); if (feat.getRange().isPrimitive()) { requireSingleValue(feat, aValue); aFS.setLongValue(feat, aValue[0]); } else if (aValue == null) { aFS.setFeatureValue(feat, null); } else { aFS.setFeatureValue(feat, createLongArray(aFS.getCAS(), aValue)); } }