hints for cleanup code
authorWalther Neuper <wneuper@ist.tugraz.at>
Thu, 06 Jul 2017 16:10:34 +0200
changeset 518570fd252d8c7c
parent 5182 b92a484edea0
child 5186 ee2e5914c211
hints for cleanup code
isac-java/src/java/isac/gui/mawen/editor/AstComponent.scala
isac-java/src/java/isac/gui/mawen/editor/AstInfoUtil.scala
     1.1 --- a/isac-java/src/java/isac/gui/mawen/editor/AstComponent.scala	Thu Jul 06 15:36:25 2017 +0200
     1.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/AstComponent.scala	Thu Jul 06 16:10:34 2017 +0200
     1.3 @@ -14,7 +14,6 @@
     1.4  import isac.gui.mawen.editor.Box.DrawBox
     1.5  import isac.interfaces.IEditor
     1.6  
     1.7 -
     1.8  /**
     1.9   * The Java Swing component for a formula
    1.10   * represented by an <code>Ast</code>
    1.11 @@ -26,7 +25,7 @@
    1.12    
    1.13    var pressedMousePoint : Point = null
    1.14    var marker : Rectangle = new Rectangle()
    1.15 -  //WHY: can be several boxes be marked simultaneously ?..
    1.16 +  //list of boxes touched by mouse while drawing a rectangle; the outmost is relevant 
    1.17    var markedBoxes : List[DrawBox] = List.empty[DrawBox]
    1.18  
    1.19    var mousePositionFunction : (Graphics, Int, Int, String, Box) => Unit = null
    1.20 @@ -100,7 +99,7 @@
    1.21    }
    1.22    
    1.23    
    1.24 -  //TODWN /--- enforced by trait MouseListener --------------------------------------\
    1.25 +  // /--- enforced by trait MouseListener --------------------------------------\
    1.26  	def mouseEntered(e: MouseEvent) {
    1.27  		
    1.28  		
    1.29 @@ -183,7 +182,7 @@
    1.30  	  EventUtil.drawBoxAt(e.getPoint())
    1.31      repaint()
    1.32  	}
    1.33 -  //TODWN \--- enforced by trait MouseMotionListener --------------------------------/
    1.34 +  // \--- enforced by trait MouseMotionListener --------------------------------/
    1.35   
    1.36    
    1.37    
     2.1 --- a/isac-java/src/java/isac/gui/mawen/editor/AstInfoUtil.scala	Thu Jul 06 15:36:25 2017 +0200
     2.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/AstInfoUtil.scala	Thu Jul 06 16:10:34 2017 +0200
     2.3 @@ -19,19 +19,15 @@
     2.4      case Appl(List(Constant(str), a)) if str.startsWith("BOX")   => a
     2.5      case _ => throw new AstException("astOfBox, without Box: "  + Ast.raw_string_of(ast))
     2.6    }
     2.7 -  
     2.8    def isBox (ast: Ast) : Boolean = ast match {
     2.9 -    
    2.10      case Appl(List(Constant(str), ast)) if str.startsWith("BOX") => true
    2.11      case _                                                       => false
    2.12 -    
    2.13    }
    2.14    def astOfCursor(ast: Ast) : Ast = ast match {
    2.15      case Appl(List(Constant("CURSOR"), a))                       => a
    2.16      case Appl(List(a, Constant("CURSOR")))                       => a
    2.17      case _ => throw new AstException("astOfBox, without Box: "  + Ast.raw_string_of(ast))
    2.18    }
    2.19 -  
    2.20    def isCursor (ast: Ast) : Boolean = ast match {
    2.21      case Appl(List(Constant("CURSOR"), ast))                      => true
    2.22      case Appl(List(ast, Constant("CURSOR")))                      => true
    2.23 @@ -127,30 +123,22 @@
    2.24       }
    2.25       case ast                                                             => null
    2.26    }
    2.27 -  //TODOWN ?"pref"er...? unused
    2.28 -  def PrefAstOfCursor(ast: Ast) : Ast = ast match {
    2.29 -    case Appl(List(Constant("CURSOR"), a))           => a
    2.30 -    case _ => throw new AstException("astOfBox, without Box: "  + Ast.raw_string_of(ast))
    2.31 -  }
    2.32    //TODOWN ..: Option[Ast] = ...
    2.33    def AstOfCursor(ast: Ast) : Ast = ast match {
    2.34      case Appl(List(Constant("CURSOR"), a))           => a
    2.35      case Appl(List(a, Constant("CURSOR")))           => a
    2.36      case _ => null
    2.37    }
    2.38 -  
    2.39    def OperatorString(ast: Ast) : String = ast match {
    2.40      case Constant(str) => str
    2.41      case a if AstInfoUtil.isBox(a) => OperatorString(AstInfoUtil.astOfBox(a))
    2.42      case a if AstInfoUtil.isCursor(a) => OperatorString(AstInfoUtil.astOfCursor(a))
    2.43      case _ => throw new AstException("OperatorString, uncovered match: " + raw_string_of(ast))
    2.44    }
    2.45 -
    2.46    def VariableString(ast: Ast) : String = ast match {
    2.47      case Variable(str) => str
    2.48      case _ => throw new AstException("VariableString, uncovered match: " + raw_string_of(ast))
    2.49    }
    2.50 -  
    2.51    def priorOfAst(ast: Ast) : Int = ast match {
    2.52      case Constant("CURSOR") => 0
    2.53      case Constant("GAP") => 0