NotMatchExpression.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. "use strict";
  2. var MatchExpression = require('./MatchExpression');
  3. // Autogenerated by cport.py on 2013-09-17 14:37
  4. var NotMatchExpression = module.exports = function NotMatchExpression(){
  5. base.call(this);
  6. this._matchType = 'NOT';
  7. }, klass = NotMatchExpression, base = Object , proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
  8. // File: expression_tree.h lines: 152-152
  9. proto._exp = undefined;
  10. /**
  11. *
  12. * Writes a debug string for this object
  13. * @method debugString
  14. * @param level
  15. *
  16. */
  17. proto.debugString = function debugString(level) {
  18. // File: expression_tree.cpp lines: 146-149
  19. return this._debugAddSpace( level ) + "$not\n" + this._exp._debugString( level + 1 );
  20. };
  21. /**
  22. *
  23. * checks if this expression is == to the other
  24. * @method equivalent
  25. * @param other
  26. *
  27. */
  28. proto.equivalent = function equivalent(other) {
  29. // File: expression_tree.cpp lines: 152-156
  30. return other._matchType == 'NOT' && this._exp.equivalent(other.getChild(0));
  31. };
  32. /**
  33. *
  34. * Return the _exp property
  35. * @method getChild
  36. *
  37. */
  38. proto.getChild = function getChild() {
  39. // File: expression_tree.h lines: 148-147
  40. return this._exp;
  41. };
  42. /**
  43. *
  44. * Initialize the necessary items
  45. * @method init
  46. * @param exp
  47. *
  48. */
  49. proto.init = function init(exp) {
  50. // File: expression_tree.h lines: 123-125
  51. this._exp = exp;
  52. return {'code':'OK'};
  53. };
  54. /**
  55. *
  56. * matches checks the input doc against the internal element path to see if it is a match
  57. * @method matches
  58. * @param doc
  59. * @param details
  60. *
  61. */
  62. proto.matches = function matches(doc,details) {
  63. // File: expression_tree.h lines: 135-136
  64. return ! this._exp.matches( doc,null );
  65. };
  66. /**
  67. *
  68. * Check if the input element matches
  69. * @method matchesSingleElement
  70. * @param e
  71. *
  72. */
  73. proto.matchesSingleElement = function matchesSingleElement(e) {
  74. // File: expression_tree.h lines: 139-140
  75. return ! this._exp.matchesSingleElement( e );
  76. };
  77. /**
  78. *
  79. * Return the number of children contained by this expression
  80. * @method numChildren
  81. * @param
  82. *
  83. */
  84. proto.numChildren = function numChildren(){
  85. // File: expression_tree.h lines: 147-146
  86. return 1;
  87. };
  88. /**
  89. *
  90. * clone this instance to a new one
  91. * @method shallowClone
  92. *
  93. */
  94. proto.shallowClone = function shallowClone(){
  95. // File: expression_tree.h lines: 128-132
  96. var e = new NotMatchExpression();
  97. e.init(this._exp.shallowClone());
  98. return e;
  99. };