bzr branch
http://gegoxaren.bato24.eu/bzr/vqdr/trunk
1
by Gustav Hartvigsson
* Initial code - far from done |
1 |
namespace VQDR.Expression { |
2 |
|
|
3 |
public class VariableValueToken : ValueToken { |
|
4 |
|
|
5 |
protected string name; |
|
6 |
|
|
7 |
construct { |
|
8 |
this.priority = PRIO_VALUE; |
|
9 |
} |
|
10 |
|
|
11 |
public VariableValueToken (string name, int position) { |
|
12 |
base (position); |
|
13 |
this.name = name; |
|
14 |
} |
|
15 |
|
|
16 |
|
|
17 |
public override void evaluate_self (Context instance) throws GLib.Error { |
|
18 |
// in the original code there was a check to see if the intance |
|
19 |
// was null, this is not needed here as we don't allow null for that |
|
20 |
// value. |
|
21 |
try { |
|
22 |
result_value = instance.get_value (name); |
|
23 |
result_string = "[" + name + ":" + result_value.to_string () + "]"; |
|
24 |
} catch (GLib.Error? e) { |
|
25 |
result_value = result_min_value = result_max_value = 0; |
|
26 |
result_string = ""; |
|
27 |
|
|
28 |
GLib.Error? err = null; |
|
29 |
GLib.Error.propagate (out err, e); |
|
30 |
throw e; |
|
31 |
} |
|
32 |
} |
|
33 |
|
|
34 |
} |
|
35 |
|
|
36 |
}
|