src/Pure/PIDE/document_status.scala
changeset 83186 887f1eac24d1
parent 83185 47edc6384e7a
child 83187 2b9457f5ffef
equal deleted inserted replaced
83185:47edc6384e7a 83186:887f1eac24d1
    51       var warned1 = warned
    51       var warned1 = warned
    52       var failed1 = failed
    52       var failed1 = failed
    53       var canceled = false
    53       var canceled = false
    54       var forks = 0
    54       var forks = 0
    55       var runs = 0
    55       var runs = 0
       
    56       var timing = Timing.zero
    56       for (markup <- markups) {
    57       for (markup <- markups) {
    57         markup.name match {
    58         markup.name match {
    58           case Markup.INITIALIZED =>
    59           case Markup.INITIALIZED =>
    59             theory_status = Theory_Status.merge(theory_status, Theory_Status.INITIALIZED)
    60             theory_status = Theory_Status.merge(theory_status, Theory_Status.INITIALIZED)
    60           case Markup.FINALIZED =>
    61           case Markup.FINALIZED =>
    71           case Markup.WARNING | Markup.LEGACY => warned1 = true
    72           case Markup.WARNING | Markup.LEGACY => warned1 = true
    72           case Markup.FAILED | Markup.ERROR => failed1 = true
    73           case Markup.FAILED | Markup.ERROR => failed1 = true
    73           case Markup.CANCELED => canceled = true
    74           case Markup.CANCELED => canceled = true
    74           case _ =>
    75           case _ =>
    75         }
    76         }
       
    77         markup match {
       
    78           case Markup.Timing(t) => timing += t
       
    79           case _ =>
       
    80         }
    76       }
    81       }
    77       new Command_Status(
    82       new Command_Status(
    78         theory_status = theory_status,
    83         theory_status = theory_status,
    79         touched = touched,
    84         touched = touched,
    80         accepted = accepted,
    85         accepted = accepted,
    81         warned = warned1,
    86         warned = warned1,
    82         failed = failed1,
    87         failed = failed1,
    83         canceled = canceled,
    88         canceled = canceled,
    84         forks = forks,
    89         forks = forks,
    85         runs = runs)
    90         runs = runs,
       
    91         timing = timing)
    86     }
    92     }
    87 
    93 
    88     val empty: Command_Status = make()
    94     val empty: Command_Status = make()
    89 
    95 
    90     def merge(args: IterableOnce[Command_Status]): Command_Status =
    96     def merge(args: IterableOnce[Command_Status]): Command_Status =
    97     private val accepted: Boolean,
   103     private val accepted: Boolean,
    98     private val warned: Boolean,
   104     private val warned: Boolean,
    99     private val failed: Boolean,
   105     private val failed: Boolean,
   100     private val canceled: Boolean,
   106     private val canceled: Boolean,
   101     val forks: Int,
   107     val forks: Int,
   102     val runs: Int
   108     val runs: Int,
       
   109     val timing: Timing
   103   ) extends Theory_Status {
   110   ) extends Theory_Status {
   104     override def toString: String =
   111     override def toString: String =
   105       if (is_empty) "Command_Status.empty"
   112       if (is_empty) "Command_Status.empty"
   106       else if (failed) "Command_Status(failed)"
   113       else if (failed) "Command_Status(failed)"
   107       else if (warned) "Command_Status(warned)"
   114       else if (warned) "Command_Status(warned)"
   108       else "Command_Status(...)"
   115       else "Command_Status(...)"
   109 
   116 
   110     def is_empty: Boolean =
   117     def is_empty: Boolean =
   111       !Theory_Status.initialized(theory_status) &&
   118       !Theory_Status.initialized(theory_status) &&
   112       !touched && !accepted && !warned && !failed && !canceled &&
   119       !touched && !accepted && !warned && !failed && !canceled &&
   113       forks == 0 && runs == 0
   120       forks == 0 && runs == 0 && timing.is_zero
   114 
   121 
   115     def + (that: Command_Status): Command_Status =
   122     def + (that: Command_Status): Command_Status =
   116       if (is_empty) that
   123       if (is_empty) that
   117       else if (that.is_empty) this
   124       else if (that.is_empty) this
   118       else {
   125       else {
   122           accepted = accepted || that.accepted,
   129           accepted = accepted || that.accepted,
   123           warned = warned || that.warned,
   130           warned = warned || that.warned,
   124           failed = failed || that.failed,
   131           failed = failed || that.failed,
   125           canceled = canceled || that.canceled,
   132           canceled = canceled || that.canceled,
   126           forks = forks + that.forks,
   133           forks = forks + that.forks,
   127           runs = runs + that.runs)
   134           runs = runs + that.runs,
       
   135           timing = timing + that.timing)
   128       }
   136       }
   129 
   137 
   130     def update(
   138     def update(
   131       markups: List[Markup] = Nil,
   139       markups: List[Markup] = Nil,
   132       warned: Boolean = false,
   140       warned: Boolean = false,
   143             accepted = accepted,
   151             accepted = accepted,
   144             warned = warned1,
   152             warned = warned1,
   145             failed = failed1,
   153             failed = failed1,
   146             canceled = canceled,
   154             canceled = canceled,
   147             forks = forks,
   155             forks = forks,
   148             runs = runs)
   156             runs = runs,
       
   157             timing = timing)
   149         }
   158         }
   150       }
   159       }
   151       else this + Command_Status.make(markups = markups, warned = warned, failed = failed)
   160       else this + Command_Status.make(markups = markups, warned = warned, failed = failed)
   152     }
   161     }
   153 
   162