Lines Matching refs:operator
13 * returning an object with 'accumulator', 'operator', and 'operand' properties
24 // For operations, ignore the last operator if no operand was entered,
26 // operator. In either case, clear the operand and the defaults.
27 var operator = this.operand && this.operator;
28 var result = this.calculate_(operator, this.operand);
29 return this.reset_({accumulator: result, operator: input});
32 // operator and operands used as defaults, or if there is no current
33 // operator, use the default operators and operands instead. In any case,
34 // clear the operator and operand and return a transient state with a '='
35 // operator.
36 var operator = this.operator || this.defaults.operator;
37 var operand = this.operator ? this.operand : this.defaults.operand;
38 var result = this.calculate_(operator, operand);
39 var defaults = {operator: operator, operand: this.operand};
45 this.operator ? this.set_({operator: null}) :
51 this.set_({operator: null});
73 this.accumulator = this.operand = this.operator = null;
74 this.defaults = {operator: null, operand: null};
88 this.operator = ifDefined(state && state.operator, this.operator);
95 * Performs a calculation based on the passed in operator and operand, updating
96 * the model's state with the operator and operand used but returning the result
101 Model.prototype.calculate_ = function(operator, operand) {
104 this.set_({accumulator: String(x), operator: operator, operand: String(y)});
105 return (this.operator == '+') ? this.round_(x + y) :
106 (this.operator == '-') ? this.round_(x - y) :
107 (this.operator == '*') ? this.round_(x * y) :
108 (this.operator == '/') ? this.round_(x / y) :