1 /** 2 * @fileoverview Context information about nodes in their nodeset. 3 */ 4 5 goog.provide('xrx.xpath.Context'); 6 7 8 9 /** 10 * Provides information for where something is in the XML tree. 11 * 12 * @param {!xrx.node} node A node in the XML tree. 13 * @param {number=} opt_position The position of this node in its nodeset, 14 * defaults to 1. 15 * @param {number=} opt_last Index of the last node in this nodeset, 16 * defaults to 1. 17 * @constructor 18 */ 19 xrx.xpath.Context = function(node, opt_position, opt_last) { 20 21 /** 22 * @private 23 * @type {!xrx.node} 24 */ 25 this.node_ = node; 26 27 /** 28 * @private 29 * @type {number} 30 */ 31 this.position_ = opt_position || 1; 32 33 /** 34 * @private 35 * @type {number} opt_last 36 */ 37 this.last_ = opt_last || 1; 38 }; 39 40 41 /** 42 * Returns the node for this context object. 43 * 44 * @return {!xrx.node} The node for this context object. 45 */ 46 xrx.xpath.Context.prototype.getNode = function() { 47 return this.node_; 48 }; 49 50 51 /** 52 * Returns the position for this context object. 53 * 54 * @return {number} The position for this context object. 55 */ 56 xrx.xpath.Context.prototype.getPosition = function() { 57 return this.position_; 58 }; 59 60 61 /** 62 * Returns the last field for this context object. 63 * 64 * @return {number} The last field for this context object. 65 */ 66 xrx.xpath.Context.prototype.getLast = function() { 67 return this.last_; 68 }; 69