本文整理了Java中org.apache.uima.cas.ArrayFS.get()
方法的一些代码示例,展示了ArrayFS.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArrayFS.get()
方法的具体详情如下:
包路径:org.apache.uima.cas.ArrayFS
类名称:ArrayFS
方法名:get
[英]Get the i-th feature structure from the array.
[中]从数组中获取第i个要素结构。
代码示例来源:origin: CLLKazan/UIMA-Ext
public static boolean contain(ArrayFS arr, FeatureStructure targetFS) {
if (arr == null) {
return false;
}
for (int i = 0; i < arr.size(); i++) {
if (Objects.equal(arr.get(i), targetFS)) {
return true;
}
}
return false;
}
代码示例来源:origin: org.apache.uima/uimafit-core
/**
* Fetch all annotations of the given type or its sub-types from the given FS array.
*
* @param aArray
* the FS array
* @param aType
* the CAS type.
* @return a new collection of all feature structures of the given type.
*/
public static Collection<FeatureStructure> create(ArrayFS aArray, Type aType) {
TypeSystem ts = aArray.getCAS().getTypeSystem();
List<FeatureStructure> data = new ArrayList<FeatureStructure>(aArray.size());
for (int i = 0; i < aArray.size(); i++) {
FeatureStructure value = aArray.get(i);
if (value != null && (aType == null || ts.subsumes(aType, value.getType()))) {
data.add(value);
}
}
return asList(data.toArray(new FeatureStructure[data.size()]));
}
代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor
@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
if (FeatureStructure.class.equals(adapter)) {
if (arrayFS instanceof ArrayFS) {
ArrayFS array = (ArrayFS) arrayFS;
return array.get(slot());
}
}
if (AnnotationFS.class.equals(adapter)) {
FeatureStructure fs = (FeatureStructure) getAdapter(FeatureStructure.class);
if (fs instanceof AnnotationFS) {
return fs;
}
}
return null;
}
代码示例来源:origin: nlpie/biomedicus
/**
* Copies one array of fs references to another.
*
* @param from the array to copy from
* @param to the array to copy to
*/
private void copyFsArray(FeatureStructure from, FeatureStructure to) {
ArrayFS sourceFses = (ArrayFS) from;
ArrayFS targetFses = (ArrayFS) to;
for (int index = 0; index < sourceFses.size(); index++) {
FeatureStructure arrayMember = sourceFses.get(index);
FeatureStructure toFs = featureStructureEncounteredCallback.apply(arrayMember);
targetFses.set(index, toFs);
}
}
代码示例来源:origin: edu.utah.bmi.nlp/nlp-core
for (int i = 0; i < arrayFS.size(); i++) {
FeatureStructure featureStructure = arrayFS.get(i);
if (featureStructure != null) {
DefaultMutableTreeNode fsValueNode = new DefaultMutableTreeNode(
代码示例来源:origin: org.apache.uima/uimaj-tools
for (int i = 0; i < arrayFS.size(); i++) {
FeatureStructure featureStructure = arrayFS.get(i);
if (featureStructure != null) {
DefaultMutableTreeNode fsValueNode = new DefaultMutableTreeNode(
代码示例来源:origin: webanno/webanno
FeatureStructure link = links.get(cfg.getAID(user).index);
代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor
return hasChildren(array.get(value.slot()));
代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor
} else if (arrayFS instanceof ArrayFS) {
ArrayFS array = (ArrayFS) arrayFS;
return array.get(slot);
} else {
throw new CasEditorError("Unkown array type!");
代码示例来源:origin: webanno/webanno
position.getFeature()));
for (int i = 0; i < links.size(); i++) {
FeatureStructure link = links.get(i);
DiffAdapter adapter = getAdapter(aFS.getType().getName());
LinkFeatureDecl decl = adapter.getLinkFeature(position.getFeature());
FeatureStructure repLink = ((ArrayFS) repFS.getFeatureValue(
repFS.getType().getFeatureByBaseName(decl.name)))
.get(repAID.index);
AnnotationFS repTarget = (AnnotationFS) repLink.getFeatureValue(
repLink.getType().getFeatureByBaseName(decl.targetFeature));
FeatureStructure repLink = ((ArrayFS) repFS.getFeatureValue(
repFS.getType().getFeatureByBaseName(decl.name)))
.get(repAID.index);
String linkRole = repLink.getStringValue(repLink.getType()
.getFeatureByBaseName(decl.roleFeature));
代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor
@Override
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof FeatureValue) {
FeatureValue value = (FeatureValue) parentElement;
if (!value.getFeature().getRange().isArray()) {
FeatureStructure childStructure = (FeatureStructure) value.getValue();
return getElements(childStructure);
} else {
FeatureStructure arrayFS = value.getFeatureStructure().getFeatureValue(value.getFeature());
return getElements(arrayFS);
}
} else if (parentElement instanceof ArrayValue) {
ArrayValue value = (ArrayValue) parentElement;
ArrayFS array = (ArrayFS) value.getFeatureStructure();
return getElements(array.get(value.slot()));
}
else {
throw new CasEditorError("Unexpected element type!");
}
}
代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor
@Override
protected boolean updateSelection(IStructuredSelection selection) {
boolean result = false;
if (selection.size() == 1) {
if (selection.getFirstElement() instanceof FeatureValue) {
FeatureValue featureValue = (FeatureValue) selection.getFirstElement();
result = !featureValue.getFeature().getRange().isPrimitive() &&
featureValue.getFeatureStructure().getFeatureValue(featureValue.getFeature()) == null;
}
else if (selection.getFirstElement() instanceof ArrayValue) {
ArrayValue value = (ArrayValue) selection.getFirstElement();
if (value.getFeatureStructure() instanceof ArrayFS) {
ArrayFS array = (ArrayFS) value.getFeatureStructure();
if (array.get(value.slot()) == null) {
result = true;
}
}
}
}
return result;
}
}
代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor
@Override
protected boolean updateSelection(IStructuredSelection selection) {
boolean result = false;
if (selection.size() == 1) {
if (selection.getFirstElement() instanceof FeatureValue) {
FeatureValue featureValue = (FeatureValue) selection.getFirstElement();
result = !featureValue.getFeature().getRange().isPrimitive() &&
featureValue.getFeatureStructure().getFeatureValue(featureValue.getFeature()) != null;
}
else if (selection.getFirstElement() instanceof ArrayValue) {
ArrayValue arrayValue = (ArrayValue) selection.getFirstElement();
if (arrayValue.getFeatureStructure() instanceof ArrayFS) {
ArrayFS array = (ArrayFS) arrayValue.getFeatureStructure();
result = array.get(arrayValue.slot()) != null;
}
}
}
return result;
}
}
代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor
ArrayFS array = (ArrayFS) value.getFeatureStructure();
FeatureStructure fs = array.get(value.slot());
代码示例来源:origin: org.apache.uima/ruta-ep-caseditor
int size = array.size();
for (int i = 0; i < size; i++) {
FeatureStructure fs = array.get(i);
if (fs instanceof FeatureStructure) {
Type fsType = fs.getType();
代码示例来源:origin: org.apache.uima/textmarker-ep-caseditor
FeatureStructure fs = array.get(i);
if (fs instanceof FeatureStructure) {
Type fsType = fs.getType();
代码示例来源:origin: de.tudarmstadt.ukp.dkpro.core/de.tudarmstadt.ukp.dkpro.core.stanfordnlp-gpl
ArrayFS destFS = mDestCas.createArrayFS(len);
for (int i = 0; i < len; i++) {
FeatureStructure srcElem = arrayFs.get(i);
if (srcElem != null) {
FeatureStructure copyElem = copyFs(arrayFs.get(i));
destFS.set(i, copyElem);
内容来源于网络,如有侵权,请联系作者删除!