AtomicMatchExpression.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. "use strict";
  2. var AtomicMatchExpression = module.exports = function AtomicMatchExpression(){
  3. base.call(this);
  4. this._matchType = "ATOMIC";
  5. }, klass = AtomicMatchExpression, base = require("./MatchExpression"), proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}}); //jshint ignore:line
  6. /**
  7. *
  8. * Writes a debug string for this object
  9. * @method debugString
  10. * @param level
  11. *
  12. */
  13. proto.debugString = function debugString(level) {
  14. return this._debugAddSpace( level ) + "$atomic\n";
  15. };
  16. /**
  17. *
  18. * checks if this expression is == to the other
  19. * @method equivalent
  20. * @param other
  21. *
  22. */
  23. proto.equivalent = function equivalent(other) {
  24. return other._matchType === this._matchType;
  25. };
  26. /**
  27. *
  28. * matches checks the input doc against the internal element path to see if it is a match
  29. * @method matches
  30. * @param doc
  31. *
  32. */
  33. proto.matches = function matches(doc) {
  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. return true;
  45. };
  46. /**
  47. *
  48. * clone this instance to a new one
  49. * @method shallowClone
  50. *
  51. */
  52. proto.shallowClone = function shallowClone(){
  53. return new AtomicMatchExpression();
  54. };