]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/If.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.document.linking.ui / src / org / simantics / document / linking / report / evaluator / If.java
index 2ac3620f83dbc9c811f7e35327b204a648ffc9fd..e0e7839391ca9fefc508d8dc32bf818db8a3c8af 100644 (file)
@@ -1,89 +1,89 @@
-package org.simantics.document.linking.report.evaluator;\r
-\r
-import java.util.Collections;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.document.linking.Activator;\r
-import org.simantics.document.linking.ontology.DocumentLink;\r
-import org.simantics.document.linking.report.DocumentLine;\r
-import org.simantics.objmap.graph.annotations.OrderedSetType;\r
-\r
-/**\r
- * Checks that the first size does not return null or "false". \r
- * Depending on results evaluates the second child or the third (if it exists).\r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-@OrderedSetType(DocumentLink.URIs.EvaluatorTree_If)\r
-public class If extends EvaluatorNode{\r
-\r
-       @Override\r
-       public String getValue(ReadGraph graph, Variable variable, Map<Object, Object> context) throws DatabaseException {\r
-               if (children.size() > 3)\r
-                       throw new DatabaseException("If node has more than 3 children.");\r
-               \r
-               String ifVal = children.get(0).getValue(graph, variable, context);\r
-               if (ifVal != null && ifVal.length() > 0 && !Boolean.FALSE.toString().equals(ifVal)) {\r
-                       return children.get(1).getValue(graph, variable, context);\r
-               } else if (children.size() == 3) {\r
-                       return children.get(2).getValue(graph, variable, context);\r
-               }\r
-               return null;\r
-       }\r
-       \r
-       @Override\r
-       public List<DocumentLine> getLines(ReadGraph graph,     Variable variable, Map<Object, Object> context) throws DatabaseException {\r
-               if (children.size() > 3)\r
-                       throw new DatabaseException("If node has more than 3 children.");\r
-               String ifVal = children.get(0).getValue(graph, variable, context);\r
-               if (ifVal != null && ifVal.length() > 0 && !Boolean.FALSE.toString().equals(ifVal)) {\r
-                       return children.get(1).getLines(graph, variable, context);\r
-               } else if (children.size() == 3) {\r
-                       return children.get(2).getLines(graph, variable, context);\r
-               }\r
-               return Collections.emptyList();\r
-       }\r
-       \r
-\r
-       @Override\r
-       public String toString() {\r
-               return "if";\r
-       }\r
-       \r
-       @Override\r
-       public List<Class<? extends EvaluatorItem>> getPossibleChildren(boolean add) {\r
-               if (add && children.size() == 3)\r
-                       return Collections.emptyList();\r
-               return super.getPossibleChildren(add);\r
-       }\r
-       \r
-       @Override\r
-       public EvaluatorItem copy() {\r
-               If node = new If();\r
-               copyChildren(node);\r
-               return node;\r
-               \r
-       }\r
-       \r
-       @Override\r
-       public ImageDescriptor getImage() {\r
-               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/help.png");\r
-       }\r
-       \r
-       @Override\r
-       public boolean acceptChild(EvaluatorItem item) {\r
-               return children.size() < 3;\r
-       }\r
-       \r
-       @Override\r
-       public boolean acceptChild(int index, EvaluatorItem item) {\r
-               return children.size() < 3;\r
-       }\r
-\r
-}\r
+package org.simantics.document.linking.report.evaluator;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.variable.Variable;
+import org.simantics.document.linking.Activator;
+import org.simantics.document.linking.ontology.DocumentLink;
+import org.simantics.document.linking.report.DocumentLine;
+import org.simantics.objmap.graph.annotations.OrderedSetType;
+
+/**
+ * Checks that the first size does not return null or "false". 
+ * Depending on results evaluates the second child or the third (if it exists).
+ * 
+ * @author Marko Luukkainen <marko.luukkainen@vtt.fi>
+ *
+ */
+@OrderedSetType(DocumentLink.URIs.EvaluatorTree_If)
+public class If extends EvaluatorNode{
+
+       @Override
+       public String getValue(ReadGraph graph, Variable variable, Map<Object, Object> context) throws DatabaseException {
+               if (children.size() > 3)
+                       throw new DatabaseException("If node has more than 3 children.");
+               
+               String ifVal = children.get(0).getValue(graph, variable, context);
+               if (ifVal != null && ifVal.length() > 0 && !Boolean.FALSE.toString().equals(ifVal)) {
+                       return children.get(1).getValue(graph, variable, context);
+               } else if (children.size() == 3) {
+                       return children.get(2).getValue(graph, variable, context);
+               }
+               return null;
+       }
+       
+       @Override
+       public List<DocumentLine> getLines(ReadGraph graph,     Variable variable, Map<Object, Object> context) throws DatabaseException {
+               if (children.size() > 3)
+                       throw new DatabaseException("If node has more than 3 children.");
+               String ifVal = children.get(0).getValue(graph, variable, context);
+               if (ifVal != null && ifVal.length() > 0 && !Boolean.FALSE.toString().equals(ifVal)) {
+                       return children.get(1).getLines(graph, variable, context);
+               } else if (children.size() == 3) {
+                       return children.get(2).getLines(graph, variable, context);
+               }
+               return Collections.emptyList();
+       }
+       
+
+       @Override
+       public String toString() {
+               return "if";
+       }
+       
+       @Override
+       public List<Class<? extends EvaluatorItem>> getPossibleChildren(boolean add) {
+               if (add && children.size() == 3)
+                       return Collections.emptyList();
+               return super.getPossibleChildren(add);
+       }
+       
+       @Override
+       public EvaluatorItem copy() {
+               If node = new If();
+               copyChildren(node);
+               return node;
+               
+       }
+       
+       @Override
+       public ImageDescriptor getImage() {
+               return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/help.png");
+       }
+       
+       @Override
+       public boolean acceptChild(EvaluatorItem item) {
+               return children.size() < 3;
+       }
+       
+       @Override
+       public boolean acceptChild(int index, EvaluatorItem item) {
+               return children.size() < 3;
+       }
+
+}