src/Tools/jEdit/src/proofdocument/Token.scala
author wenzelm
Sun Oct 19 16:51:55 2008 +0200 (2008-10-19 ago)
changeset 34318 c13e168a8ae6
child 34388 23b8351ecbbe
permissions -rw-r--r--
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
     1 package isabelle.proofdocument
     2 
     3 class Token[C](var start : Int, var stop : Int, val isCommandStart : Boolean,
     4                val isComment : Boolean) {
     5   var next : Token[C] = null
     6   var previous : Token[C] = null
     7   var command : C = null.asInstanceOf[C]
     8   
     9   def length = stop - start
    10 
    11   def shift(offset : Int, bottomClamp : Int) {
    12     start = bottomClamp max (start + offset)
    13     stop = bottomClamp max (stop + offset)
    14   }
    15   
    16   override def hashCode() : Int = (31 + start) * 31 + stop
    17 
    18   override def equals(obj : Any) : Boolean = {
    19     if (super.equals(obj))
    20       return true;
    21     
    22     if (null == obj)
    23       return false;
    24     
    25     obj match {
    26       case other: Token[_] => 
    27         (start == other.start) && (stop == other.stop)
    28       case other: Any => false  
    29     }
    30   }
    31 }