1 /** 2 * @fileoverview A class representing number literals. 3 */ 4 5 goog.provide('xrx.xpath.Number'); 6 7 goog.require('xrx.xpath.Expr'); 8 9 10 11 /** 12 * Constructs a number expression. 13 * 14 * @param {number} value The number value. 15 * @constructor 16 * @extends {xrx.xpath.Expr} 17 */ 18 xrx.xpath.Number = function(value) { 19 xrx.xpath.Expr.call(this, xrx.xpath.DataType.NUMBER); 20 21 /** 22 * @type {number} 23 * @private 24 */ 25 this.value_ = value; 26 }; 27 goog.inherits(xrx.xpath.Number, xrx.xpath.Expr); 28 29 30 /** 31 * @override 32 * @return {number} The number result. 33 */ 34 xrx.xpath.Number.prototype.evaluate = function(ctx) { 35 return this.value_; 36 }; 37 38 39 /** 40 * @override 41 */ 42 xrx.xpath.Number.prototype.toString = function() { 43 return 'Number: ' + this.value_; 44 }; 45