"use strict"; // Autogenerated by cport.py on 2013-09-17 14:37 var ArrayMatchingMatchExpression = module.exports = function (matchType){ this._matchType = matchType; }, klass = ArrayMatchingMatchExpression, base = Object , proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}}); // File: expression_array.h lines: 55-55 proto._elementPath = undefined; // File: expression_array.h lines: 54-54 proto._path = undefined; // File: expression_array.h lines: 55-55 proto._elementPath = undefined; // File: expression_array.h lines: 54-54 proto._path = undefined; /** * * Check if the input element is equivalent to us * @method equivalent * @param * */ proto.equivalent = function equivalent(other){ // File: expression_array.cpp lines: 63-79 if ( this._matchType != other._matchType) return false; var realOther = new ArrayMatchingMatchExpression(other); if (this._path != realOther._path) return false; if (this.numChildren() != realOther.numChildren()) return false; for (var i = 0; i < this.numChildren(); i++) if (!this.getChild(i).equivalent(realOther.getChild(i))) return false; return true; }; /** * * Initialize the input path as our element path * @method initPath * @param path * */ proto.initPath = function initPath(path){ // File: expression_array.cpp lines: 27-31 this._path = path; var status = this._elementPath.init(this._path); this._elementPath.setTraverseLeafArray(false); return status; }; /** * * This documentation was automatically generated. Please update when you touch this function. * @method matches * @param * */ proto.matches = function matches(doc, details){ // File: expression_array.cpp lines: 34-53 var element; for (var k in doc[this._elementPath]) { element = doc[this._elementPath][k]; if (!(element instanceof Array)) continue; var amIRoot = (element.length === 0); if (!this.matchesArray(element, amIRoot ? details : null)) continue; if (!amIRoot && details && details.needRecord() /* && !e.arrayOffset().eoo() same as amIRoot? */) { details.setElemMatchKey(element.fieldName()); } return true; } return false; }; /** * * This documentation was automatically generated. Please update when you touch this function. * @method matchesSingleElement * @param * */ proto.matchesSingleElement = function matchesSingleElement(element){ // File: expression_array.cpp lines: 56-59 if (!(element instanceof Array)) return false; return this.matchesArray(element, null); }; /** * * This documentation was automatically generated. Please update when you touch this function. * @method path * @param * */ proto.path = function path(){ // File: expression_array.h lines: 52-51 return this._path; }; /** * * Check if the input array matches * @method path * @param anArray * @param details * */ proto.matchesArray = function matchesArray(anArray, details){ throw new Error("not implemented"); };