tuned for-comprehensions -- less structure mapping;
authorwenzelm
Tue Apr 01 23:04:22 2014 +0200 (2014-04-01)
changeset 56356c3dbaa155ece
parent 56355 1a9f569b5b7e
child 56357 8a58a8c5a1c0
tuned for-comprehensions -- less structure mapping;
src/Pure/GUI/wrap_panel.scala
src/Pure/PIDE/protocol.scala
src/Tools/jEdit/src/document_view.scala
     1.1 --- a/src/Pure/GUI/wrap_panel.scala	Tue Apr 01 22:25:01 2014 +0200
     1.2 +++ b/src/Pure/GUI/wrap_panel.scala	Tue Apr 01 23:04:22 2014 +0200
     1.3 @@ -62,7 +62,7 @@
     1.4          }
     1.5  
     1.6          for {
     1.7 -          i <- 0 until target.getComponentCount
     1.8 +          i <- (0 until target.getComponentCount).iterator
     1.9            m = target.getComponent(i)
    1.10            if m.isVisible
    1.11            d = if (preferred) m.getPreferredSize else m.getMinimumSize()
     2.1 --- a/src/Pure/PIDE/protocol.scala	Tue Apr 01 22:25:01 2014 +0200
     2.2 +++ b/src/Pure/PIDE/protocol.scala	Tue Apr 01 23:04:22 2014 +0200
     2.3 @@ -61,8 +61,8 @@
     2.4      var failed = false
     2.5      var forks = 0
     2.6      var runs = 0
     2.7 -    for { markup <- markups; name = markup.name }
     2.8 -      name match {
     2.9 +    for (markup <- markups) {
    2.10 +      markup.name match {
    2.11          case Markup.ACCEPTED => accepted = true
    2.12          case Markup.FORKED => touched = true; forks += 1
    2.13          case Markup.JOINED => forks -= 1
    2.14 @@ -71,6 +71,7 @@
    2.15          case Markup.FAILED => failed = true
    2.16          case _ =>
    2.17        }
    2.18 +    }
    2.19      Status(touched, accepted, failed, forks, runs)
    2.20    }
    2.21  
    2.22 @@ -114,8 +115,7 @@
    2.23      var finished = 0
    2.24      var warned = 0
    2.25      var failed = 0
    2.26 -    for { command <- node.commands }
    2.27 -    {
    2.28 +    for (command <- node.commands.iterator) {
    2.29        val states = state.command_states(version, command)
    2.30        val status = command_status(states.iterator.flatMap(st => st.status.iterator))
    2.31  
    2.32 @@ -148,12 +148,12 @@
    2.33      for {
    2.34        command <- node.commands.iterator
    2.35        st <- state.command_states(version, command)
    2.36 -      command_timing =
    2.37 +    } {
    2.38 +      val command_timing =
    2.39          (0.0 /: st.status)({
    2.40            case (timing, Markup.Timing(t)) => timing + t.elapsed.seconds
    2.41            case (timing, _) => timing
    2.42          })
    2.43 -    } {
    2.44        total += command_timing
    2.45        if (command_timing >= threshold) commands += (command -> command_timing)
    2.46      }
     3.1 --- a/src/Tools/jEdit/src/document_view.scala	Tue Apr 01 22:25:01 2014 +0200
     3.2 +++ b/src/Tools/jEdit/src/document_view.scala	Tue Apr 01 23:04:22 2014 +0200
     3.3 @@ -94,7 +94,7 @@
     3.4      val buffer_range = JEdit_Lib.buffer_range(model.buffer)
     3.5      val visible_lines =
     3.6        (for {
     3.7 -        i <- 0 until text_area.getVisibleLines
     3.8 +        i <- (0 until text_area.getVisibleLines).iterator
     3.9          start = text_area.getScreenLineStartOffset(i)
    3.10          stop = text_area.getScreenLineEndOffset(i)
    3.11          if start >= 0 && stop >= 0
    3.12 @@ -228,7 +228,7 @@
    3.13                        snapshot.node.command_range(snapshot.revert(visible_range)).map(_._1)
    3.14                      if (visible_cmds.exists(changed.commands)) {
    3.15                        for {
    3.16 -                        line <- 0 until visible_lines
    3.17 +                        line <- (0 until visible_lines).iterator
    3.18                          start = text_area.getScreenLineStartOffset(line) if start >= 0
    3.19                          end = text_area.getScreenLineEndOffset(line) if end >= 0
    3.20                          range = Text.Range(start, end)