|
JADE v6.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.dautelle.realtime.LocalContext.Variable
com.dautelle.math.functions.Function.Variable
This class represents a symbol on whose value a Function
depends. The actual value can be context-local. For example:
// f(x) = x² + x + 1, calculate f(1+2i)
Polynomial x = Polynomial.valueOf(Complex.ONE, Variable.X);
Constant one = Constant.valueOf(Complex.ONE);
Polynomial fx = (Polynomial) x.pow(2).plus(x).plus(one);
LocalContext.enter();
try {
Variable.X.setValue(Complex.valueOf(1, 2));
Complex result = (Complex) fx.evaluate();
System.out.println("f(1+2i) = " + result);
} finally {
LocalContext.exit();
}
> f(1+2i) = -1.0 + 6.0i
Instances of this class are unique (the implementation guarantees
that all instances have a different symbol).
Function.evaluate()| Field Summary | |
static Function.Variable |
T
The variable with symbol "t". |
static Function.Variable |
X
The variable with symbol "x". |
static Function.Variable |
Y
The variable with symbol "y". |
static Function.Variable |
Z
The variable with symbol "z". |
| Fields inherited from class com.dautelle.realtime.LocalContext.Variable |
MAX |
| Method Summary | |
int |
compareTo(java.lang.Object that)
Compares this variable with the specified variable for order. |
java.lang.String |
getSymbol()
Returns the symbol for this variable. |
java.lang.String |
toString()
Returns the string representation of this variable. |
static Function.Variable |
valueOf(java.lang.String symbol)
Returns the variable having the specified symbol. |
| Methods inherited from class com.dautelle.realtime.LocalContext.Variable |
getValue, setValue |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final Function.Variable X
"x".
public static final Function.Variable Y
"y".
public static final Function.Variable Z
"z".
public static final Function.Variable T
"t".
| Method Detail |
public static Function.Variable valueOf(java.lang.String symbol)
symbol - the symbol of the variable to return.
java.lang.IllegalArgumentException - if symbol.length() == 0public java.lang.String getSymbol()
public int compareTo(java.lang.Object that)
compareTo in interface java.lang.Comparablethat - the variable to compare with.
java.lang.ClassCastException - if the specified object is not a variable.public java.lang.String toString()
|
JADE v6.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||