OrMatchExpression.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. "use strict";
  2. var ListOfMatchExpression = require('./ListOfMatchExpression');
  3. // Autogenerated by cport.py on 2013-09-17 14:37
  4. var OrMatchExpression = module.exports = function OrMatchExpression (){
  5. base.call(this);
  6. this._expressions = [];
  7. this._matchType = 'OR';
  8. }, klass = OrMatchExpression, base = ListOfMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
  9. /**
  10. *
  11. * Writes a debug string for this object
  12. * @method debugString
  13. * @param level
  14. *
  15. */
  16. proto.debugString = function debugString(level) {
  17. // File: expression_tree.cpp lines: 112-115
  18. return this._debugAddSpace( level ) + "$or\n" + this._debugList( level );
  19. };
  20. /**
  21. *
  22. * matches checks the input doc against the internal element 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) {
  29. // File: expression_tree.cpp lines: 93-99
  30. for (var i = 0; i < this.numChildren(); i++) {
  31. if (this.getChild(i).matches( doc, null ) ){
  32. return true;
  33. }
  34. }
  35. return false;
  36. };
  37. /**
  38. *
  39. * Check if the input element matches
  40. * @method matchesSingleElement
  41. * @param e
  42. *
  43. */
  44. proto.matchesSingleElement = function matchesSingleElement(e) {
  45. // File: expression_tree.cpp lines: 102-108
  46. for (var i = 0; i < this.numChildren(); i++) {
  47. if( this.getChild(i).matchesSingleElement(e) ) {
  48. return true;
  49. }
  50. }
  51. return false;
  52. };
  53. /**
  54. *
  55. * clone this instance to a new one
  56. * @method shallowClone
  57. *
  58. */
  59. proto.shallowClone = function shallowClone(){
  60. // File: expression_tree.h lines: 86-91
  61. var clone = new OrMatchExpression();
  62. for (var i = 0; i < this.numChildren(); i++) {
  63. clone.add(this.getChild(i).shallowClone());
  64. }
  65. if (this.getTag()) {
  66. clone.setTag(this.getTag().clone());
  67. }
  68. return clone;
  69. };