equal
deleted
inserted
replaced
37 def overlaps(that: Range): Boolean = this.contains(that.start) || that.contains(this.start) |
37 def overlaps(that: Range): Boolean = this.contains(that.start) || that.contains(this.start) |
38 def compare(that: Range): Int = if (overlaps(that)) 0 else this.start compare that.start |
38 def compare(that: Range): Int = if (overlaps(that)) 0 else this.start compare that.start |
39 |
39 |
40 def restrict(that: Range): Range = |
40 def restrict(that: Range): Range = |
41 Range(this.start max that.start, this.stop min that.stop) |
41 Range(this.start max that.start, this.stop min that.stop) |
|
42 } |
|
43 |
|
44 |
|
45 /* information associated with text range */ |
|
46 |
|
47 case class Info[A](val range: Text.Range, val info: A) |
|
48 { |
|
49 def contains[B](that: Info[B]): Boolean = this.range contains that.range |
|
50 def restrict(r: Text.Range): Info[A] = Info(range.restrict(r), info) |
42 } |
51 } |
43 |
52 |
44 |
53 |
45 /* editing */ |
54 /* editing */ |
46 |
55 |