| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 | 
							- "use strict";
 
- var ArrayFilterEntries = require("./ArrayFilterEntries");
 
- var InMatchExpression = module.exports = function InMatchExpression(){
 
- 	base.call(this);
 
- 	this._matchType = "MATCH_IN";
 
- 	this._arrayEntries = new ArrayFilterEntries();
 
- }, klass = InMatchExpression, base = require("./LeafMatchExpression"), proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}}); //jshint ignore:line
 
- proto._arrayEntries = null;
 
- /**
 
-  *
 
-  * Initialize the necessary items
 
-  * @method init
 
-  * @param path
 
-  *
 
-  */
 
- proto.init = function init(path) {
 
- 	return this.initPath( path );
 
- };
 
- /**
 
-  *
 
-  * Check if the input element matches a real element
 
-  * @method _matchesRealElement
 
-  * @param e
 
-  *
 
-  */
 
- proto._matchesRealElement = function _matchesRealElement(e) {
 
- 	if(this._arrayEntries.contains(e)) { // array wrapper.... so no e "in" array
 
- 		return true;
 
- 	}
 
- 	for (var i = 0; i < this._arrayEntries.numRegexes(); i++) {
 
- 		if ( this._arrayEntries.regex(i).matchesSingleElement( e ) )
 
- 			return true;
 
- 	}
 
- 	return false;
 
- };
 
- /**
 
-  *
 
-  * Check if the input element matches
 
-  * @method matchesSingleElement
 
-  * @param e
 
-  *
 
-  */
 
- proto.matchesSingleElement = function matchesSingleElement(e) {
 
- 	if( this._arrayEntries.hasNull() &&
 
- 		(	e === null ||
 
- 			e === undefined ||
 
- 			typeof(e) === "object" && Object.keys(e).length === 0
 
- 		))
 
- 	{
 
- 		return true;
 
- 	}
 
- 	if (this._matchesRealElement( e )) {
 
- 		return true;
 
- 	}
 
- 	return false;
 
- };
 
- /**
 
-  *
 
-  * Writes a debug string for this object
 
-  * @method debugString
 
-  * @param level
 
-  *
 
-  */
 
- proto.debugString = function debugString(level) {
 
- 	return this._debugAddSpace( level ) +
 
- 		this.path() + " $in " +
 
- 		this._arrayEntries +
 
- 		(this.getTag() ? this.getTag().debugString() : "") +
 
- 		"\n";
 
- };
 
- /**
 
-  *
 
-  * checks if this expression is == to the other
 
-  * @method equivalent
 
-  * @param other
 
-  *
 
-  */
 
- proto.equivalent = function equivalent(other) {
 
- 	if (other._matchType !== "MATCH_IN") {
 
- 		return false;
 
- 	}
 
- 	return this.path() === other.path() && this._arrayEntries.equivalent( other._arrayEntries );
 
- };
 
- /**
 
-  *
 
-  * clone this instance to a new one
 
-  * @method shallowClone
 
-  *
 
-  */
 
- proto.shallowClone = function shallowClone(){
 
- 	var e = new InMatchExpression();
 
- 	this.copyTo( e );
 
- 	if ( this.getTag() ){
 
- 		e.setTag(this.getTag().Clone());
 
- 	}
 
- 	return e;
 
- };
 
- /**
 
-  *
 
-  * Copy our array to the input array
 
-  * @method copyTo
 
-  * @param toFillIn
 
-  *
 
-  */
 
- proto.copyTo = function copyTo(toFillIn) {
 
- 	toFillIn.init(this.path());
 
- 	this._arrayEntries.copyTo( toFillIn._arrayEntries );
 
- };
 
- /**
 
-  *
 
-  * Return the _arrayEntries property
 
-  * @method getArrayFilterEntries
 
-  *
 
-  */
 
- proto.getArrayFilterEntries = function getArrayFilterEntries(){
 
- 	return this._arrayEntries;
 
- };
 
- /**
 
-  *
 
-  * Return the _arrayEntries property
 
-  * @method getData
 
-  *
 
-  */
 
- proto.getData = function getData(){
 
- 	return this._arrayEntries;
 
- };
 
 
  |