]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.scenegraph.profile;\r
13 \r
14 import org.simantics.db.Resource;\r
15 import org.simantics.scenegraph.INode;\r
16 import org.simantics.scenegraph.g2d.G2DSceneGraph;\r
17 \r
18 /**\r
19  * @author Antti Villberg\r
20  * \r
21  * @see ProfileKeys\r
22  */\r
23 public interface EvaluationContext extends Observer {\r
24 \r
25     /**\r
26      * @return the runtime resource this evaluation context is attached to (i.e.\r
27      *         runtime diagram resource)\r
28      */\r
29     Resource getResource();\r
30 \r
31     /**\r
32      * @return the scene graph this profile evaluation context is attached to\r
33      */\r
34     G2DSceneGraph getSceneGraph();\r
35 \r
36     /**\r
37      * Get a constant data item attached to the evaluation context by the\r
38      * evaluation system.\r
39      * \r
40      * @param key\r
41      * @return\r
42      * @see ProfileKeys\r
43      */\r
44     <T> T getConstant(String key);\r
45 \r
46     /**\r
47      * Get the specified temporary property for the specified node. Temporary\r
48      * properties are removed between each round of application of currently\r
49      * active profile entries.\r
50      * \r
51      * @param node node to get the property for\r
52      * @param key key of property to get\r
53      * @return <code>null</code> if property is not set for the specified node\r
54      */\r
55     <T> T getTemporaryProperty(INode node, String key);\r
56 \r
57     /**\r
58      * Set value of temporary property for the evaluation process where this\r
59      * evaluation context is used. Temporary properties are removed between each\r
60      * round of application of currently active profile entries.\r
61      * \r
62      * @param node node to set the property for\r
63      * @param key key of property to set\r
64      * @param value value of the property to set\r
65      */\r
66     <T> void setTemporaryProperty(INode node, String key, T value);\r
67 \r
68     /**\r
69      * Get the specified (persistent) property for the specified node. These\r
70      * properties stay available through the lifetime of the evaluation context\r
71      * i.e. the lifetime of the runtime diagram it is associated with.\r
72      * \r
73      * @param node node to get the property for\r
74      * @param key key of property to get\r
75      * @return <code>null</code> if property is not set for the specified node\r
76      */\r
77     <T> T getProperty(INode node, String key);\r
78 \r
79     /**\r
80      * Set value of temporary property for the evaluation process where this\r
81      * evaluation context is used. These properties stay available through the\r
82      * lifetime of the evaluation context i.e. the lifetime of the runtime\r
83      * diagram it is associated with.\r
84      * \r
85      * @param node node to set the property for\r
86      * @param key key of property to set\r
87      * @param value value of the property to set\r
88      * @return previous value of property\r
89      */\r
90     <T> T setProperty(INode node, String key, T value);\r
91 \r
92 }\r