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

ref #3312: Fill NotMatchExpression.js

Brennan Chesley 12 лет назад
Родитель
Сommit
a6f4cf4909
1 измененных файлов с 29 добавлено и 104 удалено
  1. 29 104
      lib/pipeline/matcher/NotMatchExpression.js

+ 29 - 104
lib/pipeline/matcher/NotMatchExpression.js

@@ -1,10 +1,10 @@
-"use strict"
-
+"use strict";
 
 
+var MatchExpression = require('./MatchExpression');
 
 
 // Autogenerated by cport.py on 2013-09-17 14:37
 // Autogenerated by cport.py on 2013-09-17 14:37
-var NotMatchExpression = module.exports = function (){
-
+var NotMatchExpression = module.exports = function NotMatchExpression(){
+	this._matchType = 'NOT';
 }, klass = NotMatchExpression, base =  Object  , proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 }, klass = NotMatchExpression, base =  Object  , proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 
 
 
 
@@ -13,33 +13,6 @@ var NotMatchExpression = module.exports = function (){
 
 
 proto._exp = undefined;
 proto._exp = undefined;
 
 
-
-// File: expression_tree.h lines: 152-152
-//         boost::scoped_ptr<MatchExpression> _exp;
-
-proto._exp = undefined;
-
-
-
-
-
-/**
- * 
- * This documentation was automatically generated. Please update when you touch this function.
- * @method NotMatchExpression
- * @param
- *
- */
-proto.NotMatchExpression = function NotMatchExpression( /*  NOT  */ ){
-// File: expression_tree.h lines: 118-117
-//         NotMatchExpression() : MatchExpression( NOT ){}
-
-
-
-
-}
-
-
 /**
 /**
  * 
  * 
  * This documentation was automatically generated. Please update when you touch this function.
  * This documentation was automatically generated. Please update when you touch this function.
@@ -47,18 +20,10 @@ proto.NotMatchExpression = function NotMatchExpression( /*  NOT  */ ){
  * @param
  * @param
  *
  *
  */
  */
-proto.debugString = function debugString( /*  StringBuilder& debug, int level  */ ){
-
+proto.debugString = function debugString( level ) { //  StringBuilder& debug, int level
 // File: expression_tree.cpp lines: 146-149
 // File: expression_tree.cpp lines: 146-149
-//     void NotMatchExpression::debugString( StringBuilder& debug, int level ) const {
-//         _debugAddSpace( debug, level );
-//         debug << "$not\n";
-//         _exp->debugString( debug, level + 1 );
-//     }
-
-
-
-}
+	return this._debugAddSpace( level ) + "$not\n" + this._exp._debugString( level + 1 );
+};
 
 
 
 
 /**
 /**
@@ -68,19 +33,10 @@ proto.debugString = function debugString( /*  StringBuilder& debug, int level  *
  * @param
  * @param
  *
  *
  */
  */
-proto.equivalent = function equivalent( /*  const MatchExpression* other  */ ){
-
+proto.equivalent = function equivalent( other ) { //  const MatchExpression* other 
 // File: expression_tree.cpp lines: 152-156
 // File: expression_tree.cpp lines: 152-156
-//     bool NotMatchExpression::equivalent( const MatchExpression* other ) const {
-//         if ( matchType() != other->matchType() )
-//             return false;
-// 
-//         return _exp->equivalent( other->getChild(0) );
-//     }
-
-
-
-}
+	return other._matchType == 'NOT' && this._exp.equivalent(other.getChild(0));
+};
 
 
 
 
 /**
 /**
@@ -90,14 +46,11 @@ proto.equivalent = function equivalent( /*  const MatchExpression* other  */ ){
  * @param
  * @param
  *
  *
  */
  */
-proto.getChild = function getChild( /*  size_t i  */ ){
+proto.getChild = function getChild( i ) { //  size_t i
 // File: expression_tree.h lines: 148-147
 // File: expression_tree.h lines: 148-147
 //         virtual MatchExpression* getChild( size_t i ) const { return _exp.get(); }
 //         virtual MatchExpression* getChild( size_t i ) const { return _exp.get(); }
-
-
-
-
-}
+	return this._exp;
+};
 
 
 
 
 /**
 /**
@@ -107,17 +60,11 @@ proto.getChild = function getChild( /*  size_t i  */ ){
  * @param
  * @param
  *
  *
  */
  */
-proto.init = function init( /*  MatchExpression* exp  */ ){
+proto.init = function init( exp ) { //  MatchExpression* exp 
 // File: expression_tree.h lines: 123-125
 // File: expression_tree.h lines: 123-125
-//         virtual Status init( MatchExpression* exp ) {
-//             _exp.reset( exp );
-//             return Status::OK();
-//         }
-
-
-
-
-}
+	this._exp.reset( exp );
+	return {'code':'OK'};
+};
 
 
 
 
 /**
 /**
@@ -127,16 +74,10 @@ proto.init = function init( /*  MatchExpression* exp  */ ){
  * @param
  * @param
  *
  *
  */
  */
-proto.matches = function matches( /*  const MatchableDocument* doc, MatchDetails* details = 0  */ ){
+proto.matches = function matches( doc,details ) { //  const MatchableDocument* doc, MatchDetails* details = 0
 // File: expression_tree.h lines: 135-136
 // File: expression_tree.h lines: 135-136
-//         virtual bool matches( const MatchableDocument* doc, MatchDetails* details = 0 ) const {
-//             return !_exp->matches( doc, NULL );
-//         }
-
-
-
-
-}
+	return ! this._exp.matches( doc,null );
+};
 
 
 
 
 /**
 /**
@@ -146,16 +87,10 @@ proto.matches = function matches( /*  const MatchableDocument* doc, MatchDetails
  * @param
  * @param
  *
  *
  */
  */
-proto.matchesSingleElement = function matchesSingleElement( /*  const BSONElement& e  */ ){
+proto.matchesSingleElement = function matchesSingleElement( e ) { //  const BSONElement& e
 // File: expression_tree.h lines: 139-140
 // File: expression_tree.h lines: 139-140
-//         virtual bool matchesSingleElement( const BSONElement& e ) const {
-//             return !_exp->matchesSingleElement( e );
-//         }
-
-
-
-
-}
+	return ! this._exp.matchesSingleElement( e );
+};
 
 
 
 
 /**
 /**
@@ -167,12 +102,8 @@ proto.matchesSingleElement = function matchesSingleElement( /*  const BSONElemen
  */
  */
 proto.numChildren = function numChildren( /*  */ ){
 proto.numChildren = function numChildren( /*  */ ){
 // File: expression_tree.h lines: 147-146
 // File: expression_tree.h lines: 147-146
-//         virtual size_t numChildren() const { return 1; }
-
-
-
-
-}
+	return 1;
+};
 
 
 
 
 /**
 /**
@@ -184,14 +115,8 @@ proto.numChildren = function numChildren( /*  */ ){
  */
  */
 proto.shallowClone = function shallowClone( /*  */ ){
 proto.shallowClone = function shallowClone( /*  */ ){
 // File: expression_tree.h lines: 128-132
 // File: expression_tree.h lines: 128-132
-//         virtual MatchExpression* shallowClone() const {
-//             NotMatchExpression* self = new NotMatchExpression();
-//             MatchExpression* child = _exp->shallowClone();
-//             self->init(child);
-//             return self;
-//         }
-
-
-
+	var e = new NotMatchExpression();
+	e.init(this._exp.shallowClone());
+	return e;
+};
 
 
-}