Class Variable.Global<X>
- java.lang.Object
-
- org.jscience.mathematics.function.Variable.Global<X>
-
- All Implemented Interfaces:
javolution.lang.Reference<X>
,Variable<X>
public static class Variable.Global<X> extends java.lang.Object implements Variable<X>
This class represents a simpleVariable
implementation withcontext-local
values. Instances of this class can be set independently by multiple-threads as long as each concurrent thread executes within aLocalContext
. For example:[code] public abstract class Engine { public static final Variable.Global> RPM = new Variable.Global >("rpm"); public abstract Function , Amount > getTorque(); } ... LocalContext.enter(); try { RPM.set(rpm); Amount torque = myEngine.getTorque().evaluate(); } finally { LocalContext.exit(); }[/code] It should be noted that parameterized evaluations are performed within a local context. Therefore, the example above could also be rewritten:[code] Amount torque = myEngine.getTorque().evaluate(rpm); [/code]
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jscience.mathematics.function.Variable
Variable.Global<X>, Variable.Local<X>
-
-
Constructor Summary
Constructors Constructor Description Global(java.lang.String symbol)
Creates a new global variable with a unique symbol.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description X
get()
java.lang.String
getSymbol()
Returns the symbol for this variable.void
set(X arg0)
-
-
-
Constructor Detail
-
Global
public Global(java.lang.String symbol)
Creates a new global variable with a unique symbol.- Parameters:
symbol
- the variable symbol.
-
-