GraphComponent.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import Assert from '../util/Assert'
  2. export default class GraphComponent {
  3. constructor() {
  4. GraphComponent.constructor_.apply(this, arguments)
  5. }
  6. static constructor_() {
  7. this._label = null
  8. this._isInResult = false
  9. this._isCovered = false
  10. this._isCoveredSet = false
  11. this._isVisited = false
  12. if (arguments.length === 0) {} else if (arguments.length === 1) {
  13. const label = arguments[0]
  14. this._label = label
  15. }
  16. }
  17. setVisited(isVisited) {
  18. this._isVisited = isVisited
  19. }
  20. setInResult(isInResult) {
  21. this._isInResult = isInResult
  22. }
  23. isCovered() {
  24. return this._isCovered
  25. }
  26. isCoveredSet() {
  27. return this._isCoveredSet
  28. }
  29. setLabel(label) {
  30. this._label = label
  31. }
  32. getLabel() {
  33. return this._label
  34. }
  35. setCovered(isCovered) {
  36. this._isCovered = isCovered
  37. this._isCoveredSet = true
  38. }
  39. updateIM(im) {
  40. Assert.isTrue(this._label.getGeometryCount() >= 2, 'found partial label')
  41. this.computeIM(im)
  42. }
  43. isInResult() {
  44. return this._isInResult
  45. }
  46. isVisited() {
  47. return this._isVisited
  48. }
  49. }