Просмотр исходного кода

ref #3253: Fill AndMatchExpression.js

Brennan Chesley 12 лет назад
Родитель
Сommit
5c5a5f76c2
1 измененных файлов с 32 добавлено и 93 удалено
  1. 32 93
      lib/pipeline/matcher/AndMatchExpression.js

+ 32 - 93
lib/pipeline/matcher/AndMatchExpression.js

@@ -1,33 +1,14 @@
-"use strict"
-
+"use strict";
 
+ListOfMatchExpressions = require('ListOfMatchExpressions');
 
 // Autogenerated by cport.py on 2013-09-17 14:37
 var AndMatchExpression = module.exports = function (){
-
-}, klass = AndMatchExpression, base =  Object  , proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
-
-
-
-
-
-/**
- * 
- * This documentation was automatically generated. Please update when you touch this function.
- * @method AndMatchExpression
- * @param
- *
- */
-proto.AndMatchExpression = function AndMatchExpression( /*  AND  */ ){
-// File: expression_tree.h lines: 61-60
-//         AndMatchExpression() : ListOfMatchExpression( AND ){}
-
+	this._matchType = 'AND';
+}, klass = AndMatchExpression, base =  ListOfMatchExpressions, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 
 
 
-}
-
-
 /**
  * 
  * This documentation was automatically generated. Please update when you touch this function.
@@ -35,18 +16,10 @@ proto.AndMatchExpression = function AndMatchExpression( /*  AND  */ ){
  * @param
  *
  */
-proto.debugString = function debugString( /*  StringBuilder& debug, int level  */ ){
-
+proto.debugString = function debugString( level ) { //  StringBuilder& debug, int level
 // File: expression_tree.cpp lines: 85-88
-//     void AndMatchExpression::debugString( StringBuilder& debug, int level ) const {
-//         _debugAddSpace( debug, level );
-//         debug << "$and\n";
-//         _debugList( debug, level );
-//     }
-
-
-
-}
+	return this._debugAddSpace(level) + "$and\n" + this._debugList(level);
+};
 
 
 /**
@@ -56,23 +29,18 @@ proto.debugString = function debugString( /*  StringBuilder& debug, int level  *
  * @param
  *
  */
-proto.matches = function matches( /*  const MatchableDocument* doc, MatchDetails* details  */ ){
-
-// File: expression_tree.cpp lines: 64-72
-//     bool AndMatchExpression::matches( const MatchableDocument* doc, MatchDetails* details ) const {
-//         for ( size_t i = 0; i < numChildren(); i++ ) {
-//             if ( !getChild(i)->matches( doc, details ) ) {
-//                 if ( details )
-//                     details->resetOutput();
-//                 return false;
-//             }
-//         }
-//         return true;
-//     }
-
-
-
-}
+proto.matches = function matches( doc, details ) { //  const MatchableDocument* doc, MatchDetails* details
+// File: expression_tree.cpp lines: 64-72	
+	for (var i = 0; i < this.numChildren(); i++) {
+		if (!this.getChild(i).matches(doc,details)) {
+			if (details) {
+				details.resetOutput();
+			}
+			return false;
+		}
+	}
+	return true;
+};
 
 
 /**
@@ -82,21 +50,15 @@ proto.matches = function matches( /*  const MatchableDocument* doc, MatchDetails
  * @param
  *
  */
-proto.matchesSingleElement = function matchesSingleElement( /*  const BSONElement& e  */ ){
-
+proto.matchesSingleElement = function matchesSingleElement( e ){ //  const BSONElement& e
 // File: expression_tree.cpp lines: 75-81
-//     bool AndMatchExpression::matchesSingleElement( const BSONElement& e ) const {
-//         for ( size_t i = 0; i < numChildren(); i++ ) {
-//             if ( !getChild(i)->matchesSingleElement( e ) ) {
-//                 return false;
-//             }
-//         }
-//         return true;
-//     }
-
-
-
-}
+	for (var i = 0; i < this.numChildren(); i++) {
+		if (!this.getChild(i).matchesSingleElement(e)) {
+			return false;
+		}
+	}
+	return true;
+};
 
 
 /**
@@ -108,32 +70,9 @@ proto.matchesSingleElement = function matchesSingleElement( /*  const BSONElemen
  */
 proto.shallowClone = function shallowClone( /*  */ ){
 // File: expression_tree.h lines: 67-72
-//         virtual MatchExpression* shallowClone() const {
-//             AndMatchExpression* self = new AndMatchExpression();
-//             for (size_t i = 0; i < numChildren(); ++i) {
-//                 self->add(getChild(i)->shallowClone());
-//             }
-//             return self;
-//         }
-
-
-
-
-}
-
-
-/**
- * 
- * This documentation was automatically generated. Please update when you touch this function.
- * @method ~AndMatchExpression
- * @param
- *
- */
-proto.~AndMatchExpression = function ~AndMatchExpression( /*  */ ){
-// File: expression_tree.h lines: 62-61
-//         virtual ~AndMatchExpression(){}
-
-
-
+	var e = new AndMatchExpression();
+	for (var i = 0; i < this.numChildren(); i++) {
+		e.add(this.getChild(i).shallowClone());
+	}
+};
 
-}