SweepLineInterval.js 705 B

12345678910111213141516171819202122232425262728
  1. export default class SweepLineInterval {
  2. constructor() {
  3. SweepLineInterval.constructor_.apply(this, arguments)
  4. }
  5. static constructor_() {
  6. this._min = null
  7. this._max = null
  8. this._item = null
  9. if (arguments.length === 2) {
  10. const min = arguments[0], max = arguments[1]
  11. SweepLineInterval.constructor_.call(this, min, max, null)
  12. } else if (arguments.length === 3) {
  13. const min = arguments[0], max = arguments[1], item = arguments[2]
  14. this._min = min < max ? min : max
  15. this._max = max > min ? max : min
  16. this._item = item
  17. }
  18. }
  19. getMin() {
  20. return this._min
  21. }
  22. getItem() {
  23. return this._item
  24. }
  25. getMax() {
  26. return this._max
  27. }
  28. }