Source: parser/parsedHedColumnSplice.js

  1. import ParsedHedSubstring from './parsedHedSubstring'
  2. /**
  3. * A template for an inline column splice in a {@link ParsedHedString} or {@link ParsedHedGroup}.
  4. */
  5. export class ParsedHedColumnSplice extends ParsedHedSubstring {
  6. /**
  7. * Constructor.
  8. *
  9. * @param {string} columnName The token for this tag.
  10. * @param {number[]} bounds The collection of HED schemas.
  11. */
  12. constructor(columnName, bounds) {
  13. super(columnName, bounds) // Sets originalTag and originalBounds
  14. this._normalized = this.format(false) // Sets various forms of the tag.
  15. }
  16. get normalized() {
  17. {
  18. return this._normalized
  19. }
  20. }
  21. /**
  22. * Nicely format this column splice template.
  23. *
  24. * @param {boolean} long Whether the tags should be in long form.
  25. * @returns {string}
  26. */
  27. // eslint-disable-next-line no-unused-vars
  28. format(long = true) {
  29. return '{' + this.originalTag + '}'
  30. }
  31. equivalent(other) {
  32. return other instanceof ParsedHedColumnSplice && this.originalTag === other.originalTag
  33. }
  34. }
  35. export default ParsedHedColumnSplice