AndMatchExpression.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. "use strict";
  2. var ListOfMatchExpression = require('./ListOfMatchExpression');
  3. // Autogenerated by cport.py on 2013-09-17 14:37
  4. var AndMatchExpression = module.exports = function AndMatchExpression(){
  5. base.call(this);
  6. this._expressions = [];
  7. this._matchType = 'AND';
  8. }, klass = AndMatchExpression, base = ListOfMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
  9. /**
  10. *
  11. * This documentation was automatically generated. Please update when you touch this function.
  12. * @method debugString
  13. * @param
  14. *
  15. */
  16. proto.debugString = function debugString( level ) { // StringBuilder& debug, int level
  17. // File: expression_tree.cpp lines: 85-88
  18. return this._debugAddSpace(level) + "$and\n" + this._debugList(level);
  19. };
  20. /**
  21. *
  22. * matches checks the input doc against the internal path to see if it is a match
  23. * @method matches
  24. * @param doc
  25. * @param details
  26. *
  27. */
  28. proto.matches = function matches(doc, details) { // const MatchableDocument* doc, MatchDetails* details
  29. // File: expression_tree.cpp lines: 64-72
  30. var tChild;
  31. for (var i = 0; i < this.numChildren(); i++) {
  32. tChild = this.getChild(i);
  33. if (!tChild.matches(doc, details)) {
  34. if (details) {
  35. details.resetOutput();
  36. }
  37. return false;
  38. }
  39. }
  40. return true;
  41. };
  42. /**
  43. *
  44. * This documentation was automatically generated. Please update when you touch this function.
  45. * @method matchesSingleElement
  46. * @param
  47. *
  48. */
  49. proto.matchesSingleElement = function matchesSingleElement( e ){ // const BSONElement& e
  50. // File: expression_tree.cpp lines: 75-81
  51. for (var i = 0; i < this.numChildren(); i++) {
  52. if (!this.getChild(i).matchesSingleElement(e)) {
  53. return false;
  54. }
  55. }
  56. return true;
  57. };
  58. /**
  59. *
  60. * This documentation was automatically generated. Please update when you touch this function.
  61. * @method shallowClone
  62. * @param
  63. *
  64. */
  65. proto.shallowClone = function shallowClone( /* */ ){
  66. // File: expression_tree.h lines: 67-72
  67. var e = new AndMatchExpression();
  68. for (var i = 0; i < this.numChildren(); i++) {
  69. e.add(this.getChild(i).shallowClone());
  70. }
  71. };