NorMatchExpression.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. "use strict";
  2. var ListOfMatchExpression = require('./ListOfMatchExpression');
  3. // Autogenerated by cport.py on 2013-09-17 14:37
  4. var NorMatchExpression = module.exports = function NorMatchExpression(){
  5. base.call(this);
  6. this._matchType = 'NOR';
  7. }, klass = NorMatchExpression, base = ListOfMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
  8. /**
  9. *
  10. * Writes a debug string for this object
  11. * @method debugString
  12. * @param level
  13. *
  14. */
  15. proto.debugString = function debugString(level) {
  16. // File: expression_tree.cpp lines: 138-141
  17. return this._debugAddSpace( level ) + "$nor\n" + this._debugList( level );
  18. };
  19. /**
  20. *
  21. * matches checks the input doc against the internal element path to see if it is a match
  22. * @method matches
  23. * @param doc
  24. * @param details
  25. *
  26. */
  27. proto.matches = function matches(doc,detail) {
  28. // File: expression_tree.cpp lines: 120-126
  29. for (var i = 0; i < this.numChildren(); i++) {
  30. if( this.getChild(i).matches( doc, null )) {
  31. return false;
  32. }
  33. }
  34. return true;
  35. };
  36. /**
  37. *
  38. * Check if the input element matches
  39. * @method matchesSingleElement
  40. * @param e
  41. *
  42. */
  43. proto.matchesSingleElement = function matchesSingleElement(e) {
  44. // File: expression_tree.cpp lines: 129-135
  45. for (var i = 0; i < this.numChildren(); i++) {
  46. if( this.getChild(i).matchesSingleElement( e )) {
  47. return false;
  48. }
  49. }
  50. return true;
  51. };
  52. /**
  53. *
  54. * clone this instance to a new one
  55. * @method shallowClone
  56. *
  57. */
  58. proto.shallowClone = function shallowClone(){
  59. // File: expression_tree.h lines: 105-110
  60. // virtual MatchExpression* shallowClone() const {
  61. // NorMatchExpression* self = new NorMatchExpression();
  62. // for (size_t i = 0; i < numChildren(); ++i) {
  63. // self->add(getChild(i)->shallowClone());
  64. // }
  65. // return self;
  66. // }
  67. var e = new NorMatchExpression();
  68. for (var i = 0; i < this.numChildren(); i++) {
  69. e.add(this.getChild(i).shallowClone());
  70. }
  71. if (this.getTag()) {
  72. e.setTag(this.getTag().clone());
  73. }
  74. return e;
  75. };