Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 38x 38x 59x 3x 56x 3x 60x 87x 83x 83x 4x 4x 185x 81x 81x 104x 104x 6x | import Immutable from 'immutable'; export class NumberRange extends Immutable.Record({ start: 0, end: 0, }) { constructor(start: number, end: number) { if (!(start < end)) { throw new Error(`Invalid NumberRange(${start}, ${end})`); } super({ start: start, end: end, }); } toString(): string { return `NumberRange(${this.start}, ${this.end})`; } contains(number: number): boolean { return number >= this.start && number < this.end; } isEntirelyAfter(otherRangeOrNumber: NumberRange|number): boolean { if (otherRangeOrNumber instanceof NumberRange) { const otherRange = otherRangeOrNumber; return otherRange.end <= this.start; } const otherNumber = otherRangeOrNumber; return otherNumber < this.start; } isEntirelyBefore(otherRangeOrNumber: NumberRange|number): boolean { if (otherRangeOrNumber instanceof NumberRange) { const otherRange = otherRangeOrNumber; return otherRange.start >= this.end; } const otherNumber = otherRangeOrNumber; return otherNumber >= this.end; } intersects(otherRange: NumberRange): boolean { return !this.isEntirelyAfter(otherRange) && !this.isEntirelyBefore(otherRange); } } |