1
namespace VQDR.Expression {
3
class AddOperatorToken : OperatorToken, UnaryOperator {
5
public override bool is_unary {get; set; default = false;}
7
public override int priority {protected get {
11
return PRIO_ADDICTIVE;
13
} protected construct set {}} // set_priority will have no effect.
16
mandatory_num_child = 2;
20
protected AddOperatorToken (int position) {
24
public override void evaluate_self (Context instance) throws GLib.Error {
25
Token r_child = get_right_child (),
26
l_child = get_left_child ();
28
if (r_child == null || l_child == null) {
29
var sb = new StringBuilder ("(AddOperationToken) Missing ");
30
if (r_child == null) {
32
} else if (l_child == null) {
35
sb.append ("both left and right ");
37
sb.append ("tokens.");
38
throw new VQDR.Common.EvaluationError.MISSING_TOKEN (sb.str);
42
l_child.evaluate (instance);
43
r_child.evaluate (instance);
45
result_value = l_child.result_value + l_child.result_value;
46
result_max_value = l_child.result_max_value + l_child.result_max_value;
47
result_min_value = l_child.result_min_value + l_child.result_min_value;
48
reorder_max_min_values ();
49
result_string = l_child.result_string + "+" + l_child.result_string;