]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/EvaluationContext.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scenegraph.profile / src / org / simantics / scenegraph / profile / EvaluationContext.java
diff --git a/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/EvaluationContext.java b/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/EvaluationContext.java
new file mode 100644 (file)
index 0000000..96b9955
--- /dev/null
@@ -0,0 +1,92 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.scenegraph.profile;\r
+\r
+import org.simantics.db.Resource;\r
+import org.simantics.scenegraph.INode;\r
+import org.simantics.scenegraph.g2d.G2DSceneGraph;\r
+\r
+/**\r
+ * @author Antti Villberg\r
+ * \r
+ * @see ProfileKeys\r
+ */\r
+public interface EvaluationContext extends Observer {\r
+\r
+    /**\r
+     * @return the runtime resource this evaluation context is attached to (i.e.\r
+     *         runtime diagram resource)\r
+     */\r
+    Resource getResource();\r
+\r
+    /**\r
+     * @return the scene graph this profile evaluation context is attached to\r
+     */\r
+    G2DSceneGraph getSceneGraph();\r
+\r
+    /**\r
+     * Get a constant data item attached to the evaluation context by the\r
+     * evaluation system.\r
+     * \r
+     * @param key\r
+     * @return\r
+     * @see ProfileKeys\r
+     */\r
+    <T> T getConstant(String key);\r
+\r
+    /**\r
+     * Get the specified temporary property for the specified node. Temporary\r
+     * properties are removed between each round of application of currently\r
+     * active profile entries.\r
+     * \r
+     * @param node node to get the property for\r
+     * @param key key of property to get\r
+     * @return <code>null</code> if property is not set for the specified node\r
+     */\r
+    <T> T getTemporaryProperty(INode node, String key);\r
+\r
+    /**\r
+     * Set value of temporary property for the evaluation process where this\r
+     * evaluation context is used. Temporary properties are removed between each\r
+     * round of application of currently active profile entries.\r
+     * \r
+     * @param node node to set the property for\r
+     * @param key key of property to set\r
+     * @param value value of the property to set\r
+     */\r
+    <T> void setTemporaryProperty(INode node, String key, T value);\r
+\r
+    /**\r
+     * Get the specified (persistent) property for the specified node. These\r
+     * properties stay available through the lifetime of the evaluation context\r
+     * i.e. the lifetime of the runtime diagram it is associated with.\r
+     * \r
+     * @param node node to get the property for\r
+     * @param key key of property to get\r
+     * @return <code>null</code> if property is not set for the specified node\r
+     */\r
+    <T> T getProperty(INode node, String key);\r
+\r
+    /**\r
+     * Set value of temporary property for the evaluation process where this\r
+     * evaluation context is used. These properties stay available through the\r
+     * lifetime of the evaluation context i.e. the lifetime of the runtime\r
+     * diagram it is associated with.\r
+     * \r
+     * @param node node to set the property for\r
+     * @param key key of property to set\r
+     * @param value value of the property to set\r
+     * @return previous value of property\r
+     */\r
+    <T> T setProperty(INode node, String key, T value);\r
+\r
+}\r