ExistsMatchExpression.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. "use strict";
  2. var LeafMatchExpression = require('./LeafMatchExpression');
  3. // Autogenerated by cport.py on 2013-09-17 14:37
  4. var ExistsMatchExpression = module.exports = function ExistsMatchExpression(){
  5. base.call(this);
  6. this._matchType = 'EXISTS';
  7. }, klass = ExistsMatchExpression, base = LeafMatchExpression, 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_leaf.cpp lines: 286-294
  17. return this._debugAddSpace( level ) + this.path() + " exists" + (this.getTag() ? " " + this.getTag().debugString() : "") + "\n";
  18. };
  19. /**
  20. *
  21. * checks if this expression is == to the other
  22. * @method equivalent
  23. * @param other
  24. *
  25. */
  26. proto.equivalent = function equivalent(other) {
  27. // File: expression_leaf.cpp lines: 297-302
  28. if(this._matchType != other._matchType) {
  29. return false;
  30. }
  31. return this.path() == other.path();
  32. };
  33. /**
  34. *
  35. * Initialize the necessary items
  36. * @method init
  37. * @param path
  38. * @param type
  39. *
  40. */
  41. proto.init = function init(path) {
  42. // File: expression_leaf.cpp lines: 278-279
  43. return this.initPath( path );
  44. };
  45. /**
  46. *
  47. * Check if the input element matches
  48. * @method matchesSingleElement
  49. * @param e
  50. *
  51. */
  52. proto.matchesSingleElement = function matchesSingleElement(e) {
  53. // File: expression_leaf.cpp lines: 282-283
  54. if(typeof(e) == 'undefined')
  55. return false;
  56. if(e === null)
  57. return true;
  58. if(typeof(e) == 'object')
  59. return (Object.keys(e).length > 0);
  60. else
  61. return true;
  62. };
  63. /**
  64. *
  65. * clone this instance to a new one
  66. * @method shallowClone
  67. *
  68. */
  69. proto.shallowClone = function shallowClone(){
  70. // File: expression_leaf.h lines: 220-223
  71. var e = new ExistsMatchExpression();
  72. e.init(this.path());
  73. return e;
  74. };