| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- "use strict";
- // Autogenerated by cport.py on 2013-09-17 14:37
- var IndexKeyMatchableDocument = module.exports = function (pattern, doc){
- this._pattern = pattern;
- this._doc = doc;
- }, klass = IndexKeyMatchableDocument, base = Object , proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
- // DEPENDENCIES
- var SimpleArrayElementIterator = require('./SimpleArrayElementIterator.js'),
- SingleElementElementIterator = require('./SingleElementElementIterator.js');
- // File: matcher.cpp lines: 52-52
- proto._doc = undefined;
- // File: matcher.cpp lines: 51-51
- proto._pattern = undefined;
- // File: matcher.cpp lines: 52-52
- proto._doc = undefined;
- // File: matcher.cpp lines: 51-51
- proto._pattern = undefined;
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method _getElement
- * @param path
- *
- */
- proto._getElement = function _getElement(path){
- // File: matcher.cpp lines: 63-77
- var patternElement, docElement;
- for (var i in this._pattern) {
- patternElement = this._pattern[i];
- //verify( docIterator.more() );
- if(i >= this._doc.length) throw new Error("Ran out of docs in IndexKeyMatchableDocument:35");
- docElement = this._doc[i];
- if (path.equalsDottedField(patternElement.fieldName())) {
- return docElement;
- }
- }
- return {};
- };
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method getIterator
- * @param path
- *
- */
- proto.getIterator = function getIterator(path){
- // File: matcher.cpp lines: 55-59
- var e = this._getElement(path.fieldRef());
- if (e instanceof Array)
- return new SimpleArrayElementIterator( e, true );
- return new SingleElementElementIterator( e );
- };
- /**
- *
- * This method returns a JSON representation of the Document
- * @method toBSON
- * @param
- *
- */
- proto.toJSON = function toJSON(){
- // File: matcher.cpp lines: 39-42
- // TODO: this isn't quite correct because of dots
- // don't think it'll ever be called though
- return this._doc.replaceFieldNames(this._pattern);
- };
|