]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/utils/variable/DynamicVariable.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / utils / variable / DynamicVariable.java
diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/utils/variable/DynamicVariable.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/utils/variable/DynamicVariable.java
new file mode 100644 (file)
index 0000000..c4beee7
--- /dev/null
@@ -0,0 +1,48 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 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.utils.variable;\r
+\r
+/**\r
+ * A container for a single dynamic part of a dynamic-enabled variable of a\r
+ * scene graph node. Dynamic-enabled means a variable that potentially has two\r
+ * values: one static (~ default) and one dynamic. If the dynamic part has a\r
+ * non-null value it should always be used instead of the static value. Use\r
+ * {@link #getActiveValue()} to get the current variable value to follow this\r
+ * policy in your client code.\r
+ * \r
+ * <p>\r
+ * Variables generally determine the way a node gets rendered.\r
+ * \r
+ * @author Tuukka Lehtonen\r
+ * \r
+ * @param <T> type of the contained field\r
+ */\r
+public class DynamicVariable<T> {\r
+\r
+    protected T dynamicValue;\r
+\r
+    public T getDynamicValue() {\r
+        return dynamicValue;\r
+    }\r
+\r
+    public void setDynamicValue(T dynamicValue) {\r
+        this.dynamicValue = dynamicValue;\r
+    }\r
+\r
+    /**\r
+     * Resets the dynamic part of the variable to null.\r
+     */\r
+    public void reset() {\r
+        setDynamicValue(null);\r
+    }\r
+\r
+}\r