| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- "use strict";
- var ArrayMatchingMatchExpression = require('./ArrayMatchingMatchExpression.js');
- // Autogenerated by cport.py on 2013-09-17 14:37
- var ElemMatchValueMatchExpression = module.exports = function ElemMatchValueMatchExpression(){
- base.call(this);
- this._matchType = 'ELEM_MATCH_VALUE';
- this._subs = [];
- }, klass = ElemMatchValueMatchExpression, base = ArrayMatchingMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
- // DEPENDENCIES
- var errors = require("../../Errors.js"),
- ErrorCodes = errors.ErrorCodes;
- // File: expression_array.h lines: 108-108
- proto._subs = undefined;
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method _arrayElementMatchesAll
- * @param
- *
- */
- proto._arrayElementMatchesAll = function _arrayElementMatchesAll(element){
- // File: expression_array.cpp lines: 152-157
- for (var i = 0; i < this._subs.length; i++ ) {
- if (!this._subs[i].matchesSingleElement(element))
- return false;
- }
- return true;
- };
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method add
- * @param
- *
- */
- proto.add = function add(sub){
- // File: expression_array.cpp lines: 132-134
- if (!sub) throw new Error(sub + " ElemMatchValueMatchExpression:36");
- this._subs.push(sub);
- };
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method debugString
- * @param
- *
- */
- proto.debugString = function debugString(level){
- // File: expression_array.cpp lines: 160-165
- var debug = this._debugAddSpace(level);
- debug = debug + this.path() + " $elemMatch\n";
- for (var i = 0; i < this._subs.length; i++) {
- debug = debug + this._subs[i].debugString(level + 1);
- }
- return debug;
- };
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method getChild
- * @param
- *
- */
- proto.getChild = function getChild(i){
- // File: expression_array.h lines: 103-102
- return this._subs[i];
- };
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method init
- * @param
- *
- */
- proto.init = function init(path, sub){
- // File: expression_array.cpp lines: 121-124
- this.initPath(path);
- if (sub)
- this.add(sub);
- return {code:ErrorCodes.OK};
- };
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method matchesArray
- * @param
- *
- */
- proto.matchesArray = function matchesArray(anArray, details){
- // File: expression_array.cpp lines: 137-149
- for (var i in anArray) {
- var inner = anArray[i];
- if (this._arrayElementMatchesAll(inner)) {
- if (details && details.needRecord()) {
- details.setElemMatchKey(i);
- }
- return true;
- }
- }
- return false;
- };
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method numChildren
- * @param
- *
- */
- proto.numChildren = function numChildren(){
- // File: expression_array.h lines: 102-101
- return this._subs.length;
- };
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method shallowClone
- * @param
- *
- */
- proto.shallowClone = function shallowClone(){
- // File: expression_array.h lines: 91-97
- var element = new ElemMatchValueMatchExpression();
- element.init(this.path());
- for (var i = 0; i < this._subs.length; ++i) {
- element.add(this._subs[i].shallowClone());
- }
- return element;
- };
|