| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- "use strict";
- var MatchExpression = require('./MatchExpression');
- // Autogenerated by cport.py on 2013-09-17 14:37
- var ArrayMatchingMatchExpression = module.exports = function ArrayMatchingMatchExpression(matchType){
- this._matchType = matchType;
- }, klass = ArrayMatchingMatchExpression, base = MatchExpression, 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");
- };
|