merged
authorWalther Neuper <wneuper@ist.tugraz.at>
Tue, 12 Sep 2017 10:37:46 +0200
changeset 5209515070991639
parent 5206 766b810ae181
parent 5208 e01b0dd1154d
child 5211 4003b793784b
merged
isac-java/src/java/isac/gui/mawen/editor/CalcUtil.scala
     1.1 --- a/isac-java/src/java/isac/gui/mawen/editor/CalcUtil.scala	Tue Sep 12 10:13:45 2017 +0200
     1.2 +++ b/isac-java/src/java/isac/gui/mawen/editor/CalcUtil.scala	Tue Sep 12 10:37:46 2017 +0200
     1.3 @@ -60,6 +60,7 @@
     1.4      case "Frac"  => calcFrac( emptyBox, f)
     1.5      case _       => calcDefault( operatorString, List(emptyBox.paramr, emptyBox.paraml), emptyBox.x0, emptyBox.y0, emptyBox.level, emptyBox.ast, f)
     1.6    }
     1.7 +  // TODOWN rename f
     1.8    def calcVariable( emptybox: EmptyLeafOpBox, f:(DrawBox) => Unit) = {
     1.9      val level = emptybox.level
    1.10      val x0 = emptybox.x0
    1.11 @@ -71,6 +72,7 @@
    1.12      f(b) // see mmahringer $4.3.1 p.53/54 and $4.3.2 p.56
    1.13      b
    1.14    }
    1.15 +  // TODOWN rename f
    1.16    def calcConstant( emptyBox: EmptyLeafOpBox, f:(DrawBox) => Unit) = {
    1.17      val level = emptyBox.level
    1.18      val x0 = emptyBox.x0
    1.19 @@ -84,6 +86,7 @@
    1.20      f(b) // see mmahringer $4.3.1 p.53/54 and $4.3.2 p.56
    1.21      b
    1.22    }
    1.23 +  // TODOWN rename f
    1.24    def calcGAP( emptyBox: EmptyLeafOpBox, f:(DrawBox) => Unit) = {
    1.25      val level = emptyBox.level
    1.26      val x0 = emptyBox.x0
    1.27 @@ -94,6 +97,7 @@
    1.28      f(b) // see mmahringer $4.3.1 p.53/54 and $4.3.2 p.56
    1.29      b
    1.30    }
    1.31 +  // TODOWN why no f ?
    1.32    def CalcBox( str: String, emptyBox: EmptyUniOpBox, f:(DrawBox) => Unit) = {
    1.33       val box = assembleBoxesRec( new EmptyBox(emptyBox.level, emptyBox.x0, emptyBox.y0, emptyBox.param), f)
    1.34       box.isBoxed = true
    1.35 @@ -106,6 +110,7 @@
    1.36       }
    1.37       box
    1.38    }
    1.39 +  // TODOWN rename f
    1.40    def calcCursor( emptyBox: EmptyUniOpBox, f:(DrawBox) => Unit) = {
    1.41      val x0 = emptyBox.x0
    1.42      val y0 = emptyBox.y0
    1.43 @@ -121,6 +126,7 @@
    1.44    /*
    1.45     * layout of horizontal type +, (binary)-, *, =
    1.46     */
    1.47 +  // TODOWN rename f
    1.48    def calcDefaultBinOp( emptyBox: EmptyBinOpBox, f:(DrawBox) => Unit) = {
    1.49      val operator = emptyBox.operator
    1.50      val paraml = emptyBox.paraml
    1.51 @@ -194,6 +200,7 @@
    1.52    /*
    1.53     * layout of vertical type ^
    1.54     */
    1.55 +  // TODOWN rename f
    1.56    def calcPow( emptyBox: EmptyBinOpBox, f:(DrawBox) => Unit) = {
    1.57      val operator = emptyBox.operator
    1.58      val paraml = emptyBox.paraml
    1.59 @@ -220,6 +227,7 @@
    1.60    /*
    1.61     * layout of vertical type with horizontal fraction bar
    1.62     */
    1.63 +  // TODOWN rename f
    1.64    def calcFrac( emptyBox: EmptyBinOpBox, f:(DrawBox) => Unit) = {
    1.65      val operator = emptyBox.operator
    1.66      val paramUpper = emptyBox.paraml
    1.67 @@ -262,6 +270,7 @@
    1.68      f(b) // see mmahringer $4.3.1 p.53/54 and $4.3.2 p.56
    1.69      b
    1.70    }
    1.71 +  // TODOWN rename f
    1.72    def calcDefault( str: String, param: List[Ast], x0: Int, y0: Int, level: Int, ast : Ast, f:(DrawBox) => Unit) = {
    1.73      val boxes = param.map(x => assembleBoxesRec( new EmptyBox(level, x0, y0, x),emptyFunc))
    1.74      
    1.75 @@ -295,6 +304,7 @@
    1.76     * calculate Boxes with the form Appl(Constant("HOL.eq"), Variable(str), Variable(str)) --> str = str
    1.77     * nearly similar to calcPlus() but with more Space between Variable and Constant (LARGESPACE instance of MEDIUMSPACE)
    1.78     */
    1.79 +  // TODOWN unify with calcDefaultBinOp , rename f
    1.80    def calcEqualation( emptyBox: EmptyBinOpBox, f:(DrawBox) => Unit) = {
    1.81      val operator = emptyBox.operator
    1.82      val paraml = emptyBox.paraml
     2.1 --- a/isac-java/src/java/isac/gui/mawen/syntax/isabelle/library.scala	Tue Sep 12 10:13:45 2017 +0200
     2.2 +++ b/isac-java/src/java/isac/gui/mawen/syntax/isabelle/library.scala	Tue Sep 12 10:37:46 2017 +0200
     2.3 @@ -8,7 +8,7 @@
     2.4  
     2.5  package isac.gui.mawen.syntax.isabelle
     2.6  
     2.7 -
     2.8 +import isac.gui.mawen.syntax.AstException
     2.9  import scala.annotation.tailrec
    2.10  import scala.collection.mutable
    2.11  import scala.util.matching.Regex
    2.12 @@ -244,7 +244,7 @@
    2.13    def string_of_int(i: Int): String = signed_string_of_int(i)
    2.14    def cut_long_ident(str: String): String = str.split('.').last
    2.15    def strs_to_str(strs: List[String]): String = strs match {
    2.16 -    //case Nil => ""   //Appl() contains at least 1 element
    2.17 +    case Nil => throw new AstException("Appl() must contain at least 1 element")
    2.18      case str :: Nil => str
    2.19      case str :: strs => str + " " + strs_to_str(strs)
    2.20    }