]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 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.utils.variable;\r
13 \r
14 /**\r
15  * A container for a single dynamic part of a dynamic-enabled variable of a\r
16  * scene graph node. Dynamic-enabled means a variable that potentially has two\r
17  * values: one static (~ default) and one dynamic. If the dynamic part has a\r
18  * non-null value it should always be used instead of the static value. Use\r
19  * {@link #getActiveValue()} to get the current variable value to follow this\r
20  * policy in your client code.\r
21  * \r
22  * <p>\r
23  * Variables generally determine the way a node gets rendered.\r
24  * \r
25  * @author Tuukka Lehtonen\r
26  * \r
27  * @param <T> type of the contained field\r
28  */\r
29 public class DynamicVariable<T> {\r
30 \r
31     protected T dynamicValue;\r
32 \r
33     public T getDynamicValue() {\r
34         return dynamicValue;\r
35     }\r
36 \r
37     public void setDynamicValue(T dynamicValue) {\r
38         this.dynamicValue = dynamicValue;\r
39     }\r
40 \r
41     /**\r
42      * Resets the dynamic part of the variable to null.\r
43      */\r
44     public void reset() {\r
45         setDynamicValue(null);\r
46     }\r
47 \r
48 }\r