src/Pure/PIDE/text.scala
changeset 38577 4e4d3ea3725a
parent 38570 3fa11fb01f86
child 38578 1ebc6b76e5ff
equal deleted inserted replaced
38576:ce3eed2b16f7 38577:4e4d3ea3725a
    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