]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/utils/variable/DynamicVariable.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / utils / variable / DynamicVariable.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.scenegraph.utils.variable;
13
14 /**
15  * A container for a single dynamic part of a dynamic-enabled variable of a
16  * scene graph node. Dynamic-enabled means a variable that potentially has two
17  * values: one static (~ default) and one dynamic. If the dynamic part has a
18  * non-null value it should always be used instead of the static value. Use
19  * {@link #getActiveValue()} to get the current variable value to follow this
20  * policy in your client code.
21  * 
22  * <p>
23  * Variables generally determine the way a node gets rendered.
24  * 
25  * @author Tuukka Lehtonen
26  * 
27  * @param <T> type of the contained field
28  */
29 public class DynamicVariable<T> {
30
31     protected T dynamicValue;
32
33     public T getDynamicValue() {
34         return dynamicValue;
35     }
36
37     public void setDynamicValue(T dynamicValue) {
38         this.dynamicValue = dynamicValue;
39     }
40
41     /**
42      * Resets the dynamic part of the variable to null.
43      */
44     public void reset() {
45         setDynamicValue(null);
46     }
47
48 }