"use strict"; var ArrayMatchingMatchExpression = require('./ArrayMatchingMatchExpression.js'); // Autogenerated by cport.py on 2013-09-17 14:37 var ElemMatchObjectMatchExpression = module.exports = function ElemMatchObjectMatchExpression(){ base.call(this); }, klass = ElemMatchObjectMatchExpression, base = ArrayMatchingMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}}); // File: expression_array.h lines: 77-77 proto._sub = undefined; /** * * Writes a debug string for this object * @method debugString * @param level * */ proto.debugString = function debugString(level){ // File: expression_array.cpp lines: 106-109 var debug = this._debugAddSpace(level); debug = debug + this.path() + " $elemMatch\n"; return debug + this._sub.debugString(level + 1); }; /** * * Return the _sub property * @method getChild * */ proto.getChild = function getChild(){ // File: expression_array.h lines: 74-73 return this._sub; }; /** * * Initialize the necessary items * @method init * @param path * @param type * */ proto.init = function init(path, sub){ // File: expression_array.cpp lines: 85-87 this._sub = sub; return this.initPath(path); }; /** * * Check if one of the items in the input array matches _sub * @method matchesArray * @param anArray * @param details * */ proto.matchesArray = function matchesArray(anArray, details){ // File: expression_array.cpp lines: 90-103 for (var i in anArray) { var inner = anArray[i]; if (!(inner instanceof Object)) continue; if (this._sub.matchesJSON(inner, null)) { if (details && details.needRecord()) { details.setElemMatchKey(i); } return true; } } return false; }; /** * * Return 1 since we have a single "sub" * @method numChildren * */ proto.numChildren = function numChildren(){ // File: expression_array.h lines: 73-72 return 1; }; /** * * clone this instance to a new one * @method shallowClone * */ proto.shallowClone = function shallowClone(){ // File: expression_array.h lines: 65-68 var element = new ElemMatchObjectMatchExpression(); element.init(this.path(), this._sub.shallowClone()); return element; };