Browse Source

EAGLESIX-2987 made formatting consistent

Austin Meagher 11 years ago
parent
commit
1e8fab77fc
1 changed files with 28 additions and 56 deletions
  1. 28 56
      lib/pipeline/matcher/AllElemMatchOp.js

+ 28 - 56
lib/pipeline/matcher/AllElemMatchOp.js

@@ -2,8 +2,7 @@
 
 var MatchExpression = require('./MatchExpression');
 
-
-// Autogenerated by cport.py on 2013-09-17 14:37
+// From expression_array.h
 var AllElemMatchOp = module.exports = function AllElemMatchOp(){
 	base.call(this);
 	this._matchType = 'ALL';
@@ -11,26 +10,15 @@ var AllElemMatchOp = module.exports = function AllElemMatchOp(){
 	this._list = [];
 }, klass = AllElemMatchOp, base =  MatchExpression , proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 
-// DEPENDENCIES
 var errors = require("../../Errors.js"),
 	ErrorCodes = errors.ErrorCodes,
 	ElementPath = require('./ElementPath.js');
 
-// File: expression_array.h lines: 175-175
-//         ElementPath _elementPath;
-
+// ElementPath _elementPath
 proto._elementPath = undefined;
-
-
-// File: expression_array.h lines: 176-176
-//         std::vector< const ArrayMatchingMatchExpression* > _list;
-
+// std::vector< MatchExpression* > _list;
 proto._list = undefined;
-
-
-// File: expression_array.h lines: 174-174
-//         StringData _path;
-
+// StringData _path;
 proto._path = undefined;
 
 /**
@@ -40,18 +28,16 @@ proto._path = undefined;
  * @param anArray
  *
  */
-proto._allMatch = function _allMatch( anArray ){ //  const BSONObj& anArray
-	// File: expression_array.cpp lines: 208-215
-	if(this._list.length === 0) { return false; }
+proto._allMatch = function _allMatch(anArray) {
+	if (this._list.length === 0) return false;
 
 	for (var i = 0; i < this._list.length; i++) {
-		if( ! this._list[i].matchesArray( anArray, null ) ) { return false; }
+		if (!this._list[i].matchesArray(anArray, null)) return false;
 	}
 
 	return true;
 };
 
-
 /**
  *
  * This method adds a new expression to the internal array of expression
@@ -59,13 +45,11 @@ proto._allMatch = function _allMatch( anArray ){ //  const BSONObj& anArray
  * @param expr
  *
  */
-proto.add = function add( expr ){//  const ArrayMatchingMatchExpression* expr
-	// File: expression_array.cpp lines: 184-186
+proto.add = function add(expr) {
 	if (!expr) throw new Error("AllElemMatchOp:add#68 failed to verify expr");
 	this._list.push(expr);
 };
 
-
 /**
  *
  * Writes a debug string for this object
@@ -73,15 +57,13 @@ proto.add = function add( expr ){//  const ArrayMatchingMatchExpression* expr
  * @param level
  *
  */
-proto.debugString = function debugString( level ){ //   StringBuilder& debug, int level
-	// File: expression_array.cpp lines: 219-224
+proto.debugString = function debugString(level) {
 	console.debug(this._debugAddSpace(level) + this._path + " AllElemMatchOp: " + this._path + '\n');
 	for (var i = 0; i < this._list.length; i++) {
 		this._list[i].debugString(level +1);
 	}
 };
 
-
 /**
  *
  * checks if this expression is == to the other
@@ -89,29 +71,27 @@ proto.debugString = function debugString( level ){ //   StringBuilder& debug, in
  * @param other
  *
  */
-proto.equivalent = function equivalent( other ){//  const MatchExpression* other
-// File: expression_array.cpp lines: 227-242
+proto.equivalent = function equivalent(other) {
 	if (this.matchType() != other.matchType()) {
 		return false;
 	}
 
-	if( this._path != other._path ) {
+	if (this._path != other._path) {
 		return false;
 	}
 
-	if( this._list.length != other._list.length ) {
+	if (this._list.length != other._list.length) {
 		return false;
 	}
+
 	for (var i = 0; i < this._list.length; i++) {
-		if ( !this._list[i].equivalent( other._list[i] ) ) {
+		if (!this._list[i].equivalent(other._list[i])) {
 			return false;
 		}
 	}
 	return true;
 };
 
-
-
 /**
  *
  * gets the specified item from the list
@@ -119,12 +99,10 @@ proto.equivalent = function equivalent( other ){//  const MatchExpression* other
  * @param i
  *
  */
-proto.getChild = function getChild( i ){ //  size_t i
-// File: expression_array.h lines: 167-166
+proto.getChild = function getChild(i) {
 	return this._list[i];
 };
 
-
 /**
  *
  * Initialize the necessary items
@@ -132,11 +110,10 @@ proto.getChild = function getChild( i ){ //  size_t i
  * @param path
  *
  */
-proto.init = function init( path ){ //  const StringData& path
-// File: expression_array.cpp lines: 177-181
+proto.init = function init(path) {
 	this._path = path;
-	var s = this._elementPath.init( this._path );
-	this._elementPath.setTraverseLeafArray( false );
+	var s = this._elementPath.init(this._path);
+	this._elementPath.setTraverseLeafArray(false);
 	return s;
 };
 
@@ -148,17 +125,18 @@ proto.init = function init( path ){ //  const StringData& path
  * @param details
  *
  */
-proto.matches = function matches(doc, details){
-	// File: expression_array.cpp lines: 189-198
+proto.matches = function matches(doc, details) {
 	var self = this,
 		checker = function(element) {
-			if (!(element instanceof Array))
+			if (!(element instanceof Array)) {
 				return false;
+			}
 
 			//var amIRoot = (element.length === 0);
 
-			if (self._allMatch(element))
+			if (self._allMatch(element)) {
 				return true;
+			}
 
 			/*
 			if (!amIRoot && details && details.needRecord() {
@@ -177,15 +155,13 @@ proto.matches = function matches(doc, details){
  * @param e
  *
  */
-proto.matchesSingleElement = function matchesSingleElement( e ){ //  const BSONElement& e
-	// File: expression_array.cpp lines: 201-205
+proto.matchesSingleElement = function matchesSingleElement(e) {
 	if (!(e instanceof Array)) {
 		return false;
 	}
 	return this._allMatch(e);
 };
 
-
 /**
  *
  * return the length of the internal array
@@ -193,8 +169,7 @@ proto.matchesSingleElement = function matchesSingleElement( e ){ //  const BSONE
  * @param
  *
  */
-proto.numChildren = function numChildren( /*  */ ){
-// File: expression_array.h lines: 166-165
+proto.numChildren = function numChildren() {
 	return this._list.length;
 };
 
@@ -206,8 +181,7 @@ proto.numChildren = function numChildren( /*  */ ){
  * @param
  *
  */
-proto.path = function path( /*  */ ){
-// File: expression_array.h lines: 169-168
+proto.path = function path() {
 	return this._path;
 };
 
@@ -219,11 +193,9 @@ proto.path = function path( /*  */ ){
  * @param
  *
  */
-proto.shallowClone = function shallowClone( /*  */ ){
-// File: expression_array.h lines: 145-152
+proto.shallowClone = function shallowClone() {
 	var e = new AllElemMatchOp();
-	e.init( this._path );
+	e.init(this._path);
 	e._list = this._list.slice(0);
 	return e;
 };
-