| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- "use strict";
- /**
- * MatchDetails
- * @class MatchDetails
- * @namespace mungedb-aggregate.pipeline.matcher
- * @module mungedb-aggregate
- * @constructor
- **/
- var MatchDetails = module.exports = function (){
- this._elemMatchKeyRequested = false;
- this.resetOutput();
- }, klass = MatchDetails, base = Object , proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
- proto._elemMatchKey = undefined;
- proto._elemMatchKeyRequested = undefined;
- proto._loadedRecord = undefined;
- /**
- *
- * Set _loadedRecord to false and _elemMatchKey to undefined
- * @method resetOutput
- *
- */
- proto.resetOutput = function resetOutput(){
- this._loadedRecord = false;
- this._elemMatchKey = undefined;
- };
- /**
- *
- * Return a string representation of ourselves
- * @method toString
- *
- */
- proto.toString = function toString(){
- return "loadedRecord: " + this._loadedRecord + " " + "elemMatchKeyRequested: " + this._elemMatchKeyRequested + " " + "elemMatchKey: " + ( this._elemMatchKey ? this._elemMatchKey : "NONE" ) + " ";
- };
- /**
- *
- * Set the _loadedRecord property
- * @method setLoadedRecord
- * @param loadedRecord
- *
- */
- proto.setLoadedRecord = function setLoadedRecord(loadedRecord){
- this._loadedRecord = loadedRecord;
- };
- /**
- *
- * Return the _loadedRecord property
- * @method hasLoadedRecord
- *
- */
- proto.hasLoadedRecord = function hasLoadedRecord(){
- return this._loadedRecord;
- };
- /**
- *
- * Return the _elemMatchKeyRequested property
- * @method needRecord
- *
- */
- proto.needRecord = function needRecord(){
- return this._elemMatchKeyRequested;
- };
- /**
- *
- * Set the _elemMatchKeyRequested property to true
- * @method requestElemMatchKey
- *
- */
- proto.requestElemMatchKey = function requestElemMatchKey(){
- this._elemMatchKeyRequested = true;
- };
- /**
- *
- * Return the _elemMatchKey property so we can check if exists
- * @method hasElemMatchKey
- *
- */
- proto.hasElemMatchKey = function hasElemMatchKey(){
- return (typeof this._elemMatchKey !== 'undefined');
- };
- /**
- *
- * Return the _elemMatchKey property
- * @method elemMatchKey
- *
- */
- proto.elemMatchKey = function elemMatchKey(){
- if (!this.hasElemMatchKey()) throw new Error("no elem match key MatchDetails:29");
- return this._elemMatchKey;
- };
- /**
- *
- * If we request an _elemMatchKey then set it to the input
- * @method setElemMatchKey
- * @param elemMatchKey
- *
- */
- proto.setElemMatchKey = function setElemMatchKey(elemMatchKey){
- if ( this._elemMatchKeyRequested ) {
- this._elemMatchKey = elemMatchKey;
- }
- };
|