|
JScience v3.3 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.mathematics.functions.Variable.Global<X>
public static class Variable.Global<X>
This class represents a simple Variable implementation with
context-local values.
Instances of this class can be set independently by multiple-threads
as long as each concurrent thread executes within a
LocalContext. For example:
It should be noted that parameterized evaluations are performed within
a local context. Therefore, the example
above could also be rewritten:
public abstract class Engine {
public static final Variable.Global<Measure<AngularVelocity>> RPM
= new Variable.Global<Measure<AngularVelocity>>("rpm");
public abstract Function<Measure<AngularVelocity>, Measure<Torque>> getTorque();
}
...
LocalContext.enter();
try {
RPM.set(rpm);
Measure<Torque> torque = myEngine.getTorque().evaluate();
} finally {
LocalContext.exit();
}
Measure<Torque> torque = myEngine.getTorque().evaluate(rpm);
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.jscience.mathematics.functions.Variable |
|---|
Variable.Global<X>, Variable.Local<X> |
| Constructor Summary | |
|---|---|
Variable.Global(java.lang.String symbol)
Creates a new global variable with a unique symbol. |
|
| Method Summary | |
|---|---|
X |
get()
|
java.lang.String |
getSymbol()
Returns the symbol for this variable. |
void |
set(X arg0)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Variable.Global(java.lang.String symbol)
symbol - the variable symbol.| Method Detail |
|---|
public java.lang.String getSymbol()
Variable
getSymbol in interface Variable<X>public X get()
get in interface Reference<X>public void set(X arg0)
set in interface Reference<X>
|
JScience v3.3 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||