1 package org.simantics.document.linking.report.evaluator;
3 import java.util.Collections;
7 import org.eclipse.jface.resource.ImageDescriptor;
8 import org.simantics.db.ReadGraph;
9 import org.simantics.db.exception.DatabaseException;
10 import org.simantics.db.layer0.variable.Variable;
11 import org.simantics.document.linking.Activator;
12 import org.simantics.document.linking.ontology.DocumentLink;
13 import org.simantics.document.linking.report.DocumentLine;
14 import org.simantics.objmap.graph.annotations.OrderedSetType;
18 * Or node returns the first non null value of children.
20 * @author Marko Luukkainen <marko.luukkainen@vtt.fi>
24 @OrderedSetType(DocumentLink.URIs.EvaluatorTree_Or)
25 public class Or extends EvaluatorNode{
30 public String getValue(ReadGraph graph, Variable variable, Map<Object, Object> context) throws DatabaseException {
32 for (int i = 0 ; i < children.size(); i++) {
33 String s = children.get(i).getValue(graph, variable, context);
34 if (s != null && s.length() > 0)
42 public List<DocumentLine> getLines(ReadGraph graph, Variable variable, Map<Object, Object> context) throws DatabaseException {
43 for (int i = 0 ; i < children.size(); i++) {
44 List<DocumentLine> list = children.get(i).getLines(graph, variable, context);
48 return Collections.emptyList();
52 public String toString() {
57 public EvaluatorItem copy() {
64 public ImageDescriptor getImage() {
65 return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/text_list_numbers.png");