author | wenzelm |
Tue, 16 Sep 2025 15:56:28 +0200 | |
changeset 83176 | a2a49ba7a6d1 |
parent 83175 | 51e133b0a4ac |
child 83178 | 952c1ca9b842 |
permissions | -rw-r--r-- |
68758 | 1 |
/* Title: Pure/PIDE/document_status.scala |
2 |
Author: Makarius |
|
3 |
||
4 |
Document status based on markup information. |
|
5 |
*/ |
|
6 |
||
7 |
package isabelle |
|
8 |
||
9 |
||
75393 | 10 |
object Document_Status { |
83161 | 11 |
/* theory status: via 'theory' or 'end' commands */ |
12 |
||
13 |
object Theory_Status extends Enumeration { |
|
14 |
val NONE, INITIALIZED, FINALIZED, CONSOLIDATING, CONSOLIDATED = Value |
|
15 |
||
16 |
def initialized(t: Value): Boolean = t >= INITIALIZED |
|
17 |
def finalized(t: Value): Boolean = t >= FINALIZED |
|
18 |
def consolidating(t: Value): Boolean = t >= CONSOLIDATING |
|
19 |
def consolidated(t: Value): Boolean = t >= CONSOLIDATED |
|
20 |
||
21 |
def merge(t1: Value, t2: Value): Value = if (t1 >= t2) t1 else t2 |
|
22 |
} |
|
23 |
||
83165
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
24 |
trait Theory_Status { |
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
25 |
def theory_status: Theory_Status.Value |
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
26 |
def initialized: Boolean = Theory_Status.initialized(theory_status) |
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
27 |
def finalized: Boolean = Theory_Status.finalized(theory_status) |
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
28 |
def consolidating: Boolean = Theory_Status.consolidating(theory_status) |
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
29 |
def consolidated: Boolean = Theory_Status.consolidated(theory_status) |
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
30 |
} |
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
31 |
|
83161 | 32 |
|
68758 | 33 |
/* command status */ |
34 |
||
75393 | 35 |
object Command_Status { |
68758 | 36 |
val proper_elements: Markup.Elements = |
37 |
Markup.Elements(Markup.ACCEPTED, Markup.FORKED, Markup.JOINED, Markup.RUNNING, |
|
68871
f5c76072db55
more explicit status for "canceled" command within theory node;
wenzelm
parents:
68770
diff
changeset
|
38 |
Markup.FINISHED, Markup.FAILED, Markup.CANCELED) |
68758 | 39 |
|
40 |
val liberal_elements: Markup.Elements = |
|
41 |
proper_elements + Markup.WARNING + Markup.LEGACY + Markup.ERROR |
|
42 |
||
83157 | 43 |
def make( |
44 |
markups: Iterable[Markup], |
|
45 |
warned: Boolean = false, |
|
46 |
failed: Boolean = false |
|
47 |
): Command_Status = { |
|
83158
7e94f31b6d6c
clarified signature: more explicit type Theory_Status;
wenzelm
parents:
83157
diff
changeset
|
48 |
var theory_status = Theory_Status.NONE |
68758 | 49 |
var touched = false |
50 |
var accepted = false |
|
83157 | 51 |
var warned1 = warned |
52 |
var failed1 = failed |
|
68871
f5c76072db55
more explicit status for "canceled" command within theory node;
wenzelm
parents:
68770
diff
changeset
|
53 |
var canceled = false |
68758 | 54 |
var forks = 0 |
55 |
var runs = 0 |
|
83155 | 56 |
for (markup <- markups) { |
68758 | 57 |
markup.name match { |
83158
7e94f31b6d6c
clarified signature: more explicit type Theory_Status;
wenzelm
parents:
83157
diff
changeset
|
58 |
case Markup.INITIALIZED => |
7e94f31b6d6c
clarified signature: more explicit type Theory_Status;
wenzelm
parents:
83157
diff
changeset
|
59 |
theory_status = Theory_Status.merge(theory_status, Theory_Status.INITIALIZED) |
83160
bc86832bd2fd
clarified Theory_Status.FINALIZED: it belongs to this linear row, too;
wenzelm
parents:
83158
diff
changeset
|
60 |
case Markup.FINALIZED => |
bc86832bd2fd
clarified Theory_Status.FINALIZED: it belongs to this linear row, too;
wenzelm
parents:
83158
diff
changeset
|
61 |
theory_status = Theory_Status.merge(theory_status, Theory_Status.FINALIZED) |
83158
7e94f31b6d6c
clarified signature: more explicit type Theory_Status;
wenzelm
parents:
83157
diff
changeset
|
62 |
case Markup.CONSOLIDATING => |
7e94f31b6d6c
clarified signature: more explicit type Theory_Status;
wenzelm
parents:
83157
diff
changeset
|
63 |
theory_status = Theory_Status.merge(theory_status, Theory_Status.CONSOLIDATING) |
7e94f31b6d6c
clarified signature: more explicit type Theory_Status;
wenzelm
parents:
83157
diff
changeset
|
64 |
case Markup.CONSOLIDATED => |
7e94f31b6d6c
clarified signature: more explicit type Theory_Status;
wenzelm
parents:
83157
diff
changeset
|
65 |
theory_status = Theory_Status.merge(theory_status, Theory_Status.CONSOLIDATED) |
68758 | 66 |
case Markup.ACCEPTED => accepted = true |
67 |
case Markup.FORKED => touched = true; forks += 1 |
|
68 |
case Markup.JOINED => forks -= 1 |
|
69 |
case Markup.RUNNING => touched = true; runs += 1 |
|
70 |
case Markup.FINISHED => runs -= 1 |
|
83157 | 71 |
case Markup.WARNING | Markup.LEGACY => warned1 = true |
72 |
case Markup.FAILED | Markup.ERROR => failed1 = true |
|
68871
f5c76072db55
more explicit status for "canceled" command within theory node;
wenzelm
parents:
68770
diff
changeset
|
73 |
case Markup.CANCELED => canceled = true |
68758 | 74 |
case _ => |
75 |
} |
|
76 |
} |
|
83155 | 77 |
new Command_Status( |
83158
7e94f31b6d6c
clarified signature: more explicit type Theory_Status;
wenzelm
parents:
83157
diff
changeset
|
78 |
theory_status = theory_status, |
68887 | 79 |
touched = touched, |
80 |
accepted = accepted, |
|
83157 | 81 |
warned = warned1, |
82 |
failed = failed1, |
|
68887 | 83 |
canceled = canceled, |
84 |
forks = forks, |
|
85 |
runs = runs) |
|
68758 | 86 |
} |
87 |
||
83155 | 88 |
val empty: Command_Status = make(Nil) |
68758 | 89 |
|
83156
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
90 |
def merge(args: IterableOnce[Command_Status]): Command_Status = |
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
91 |
args.iterator.foldLeft(empty)(_ + _) |
68758 | 92 |
} |
93 |
||
83155 | 94 |
final class Command_Status private( |
83165
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
95 |
val theory_status: Theory_Status.Value, |
68758 | 96 |
private val touched: Boolean, |
97 |
private val accepted: Boolean, |
|
98 |
private val warned: Boolean, |
|
99 |
private val failed: Boolean, |
|
68871
f5c76072db55
more explicit status for "canceled" command within theory node;
wenzelm
parents:
68770
diff
changeset
|
100 |
private val canceled: Boolean, |
83155 | 101 |
val forks: Int, |
102 |
val runs: Int |
|
83165
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
103 |
) extends Theory_Status { |
83155 | 104 |
override def toString: String = |
83156
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
105 |
if (is_empty) "Command_Status.empty" |
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
106 |
else if (failed) "Command_Status(failed)" |
83155 | 107 |
else if (warned) "Command_Status(warned)" |
83156
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
108 |
else "Command_Status(...)" |
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
109 |
|
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
110 |
def is_empty: Boolean = |
83161 | 111 |
!Theory_Status.initialized(theory_status) && |
83160
bc86832bd2fd
clarified Theory_Status.FINALIZED: it belongs to this linear row, too;
wenzelm
parents:
83158
diff
changeset
|
112 |
!touched && !accepted && !warned && !failed && !canceled && |
83156
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
113 |
forks == 0 && runs == 0 |
83155 | 114 |
|
68758 | 115 |
def + (that: Command_Status): Command_Status = |
83156
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
116 |
if (is_empty) that |
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
117 |
else if (that.is_empty) this |
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
118 |
else { |
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
119 |
new Command_Status( |
83161 | 120 |
theory_status = Theory_Status.merge(theory_status, that.theory_status), |
83156
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
121 |
touched = touched || that.touched, |
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
122 |
accepted = accepted || that.accepted, |
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
123 |
warned = warned || that.warned, |
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
124 |
failed = failed || that.failed, |
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
125 |
canceled = canceled || that.canceled, |
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
126 |
forks = forks + that.forks, |
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
127 |
runs = runs + that.runs) |
6bc5835bc794
clarified signature, following e.g. Command.Markups;
wenzelm
parents:
83155
diff
changeset
|
128 |
} |
68758 | 129 |
|
83158
7e94f31b6d6c
clarified signature: more explicit type Theory_Status;
wenzelm
parents:
83157
diff
changeset
|
130 |
def maybe_consolidated: Boolean = touched && forks == 0 && runs == 0 |
7e94f31b6d6c
clarified signature: more explicit type Theory_Status;
wenzelm
parents:
83157
diff
changeset
|
131 |
|
68758 | 132 |
def is_unprocessed: Boolean = accepted && !failed && (!touched || (forks != 0 && runs == 0)) |
133 |
def is_running: Boolean = runs != 0 |
|
134 |
def is_warned: Boolean = warned |
|
135 |
def is_failed: Boolean = failed |
|
136 |
def is_finished: Boolean = !failed && touched && forks == 0 && runs == 0 |
|
68871
f5c76072db55
more explicit status for "canceled" command within theory node;
wenzelm
parents:
68770
diff
changeset
|
137 |
def is_canceled: Boolean = canceled |
68881 | 138 |
def is_terminated: Boolean = canceled || touched && forks == 0 && runs == 0 |
68758 | 139 |
} |
140 |
||
141 |
||
142 |
/* node status */ |
|
143 |
||
75393 | 144 |
object Node_Status { |
83167 | 145 |
val empty: Node_Status = Node_Status() |
76716
a7602257a825
clarified state document nodes for Theories_Status / Document_Dockable;
wenzelm
parents:
76714
diff
changeset
|
146 |
|
68758 | 147 |
def make( |
148 |
state: Document.State, |
|
149 |
version: Document.Version, |
|
76714 | 150 |
name: Document.Node.Name |
151 |
): Node_Status = { |
|
68758 | 152 |
val node = version.nodes(name) |
153 |
||
154 |
var unprocessed = 0 |
|
155 |
var running = 0 |
|
156 |
var warned = 0 |
|
157 |
var failed = 0 |
|
158 |
var finished = 0 |
|
68871
f5c76072db55
more explicit status for "canceled" command within theory node;
wenzelm
parents:
68770
diff
changeset
|
159 |
var canceled = false |
68892 | 160 |
var terminated = true |
83165
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
161 |
var theory_status = Document_Status.Theory_Status.NONE |
68758 | 162 |
for (command <- node.commands.iterator) { |
83164 | 163 |
val status = state.command_status(version, command) |
68758 | 164 |
|
165 |
if (status.is_running) running += 1 |
|
166 |
else if (status.is_failed) failed += 1 |
|
167 |
else if (status.is_warned) warned += 1 |
|
168 |
else if (status.is_finished) finished += 1 |
|
169 |
else unprocessed += 1 |
|
68871
f5c76072db55
more explicit status for "canceled" command within theory node;
wenzelm
parents:
68770
diff
changeset
|
170 |
|
f5c76072db55
more explicit status for "canceled" command within theory node;
wenzelm
parents:
68770
diff
changeset
|
171 |
if (status.is_canceled) canceled = true |
68892 | 172 |
if (!status.is_terminated) terminated = false |
83165
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
173 |
|
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
174 |
theory_status = Theory_Status.merge(theory_status, status.theory_status) |
68758 | 175 |
} |
176 |
||
68887 | 177 |
Node_Status( |
83163 | 178 |
suppressed = version.nodes.suppressed(name), |
68887 | 179 |
unprocessed = unprocessed, |
180 |
running = running, |
|
181 |
warned = warned, |
|
182 |
failed = failed, |
|
183 |
finished = finished, |
|
184 |
canceled = canceled, |
|
185 |
terminated = terminated, |
|
83165
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
186 |
theory_status = theory_status) |
68758 | 187 |
} |
188 |
} |
|
189 |
||
190 |
sealed case class Node_Status( |
|
83167 | 191 |
suppressed: Boolean = false, |
192 |
unprocessed: Int = 0, |
|
193 |
running: Int = 0, |
|
194 |
warned: Int = 0, |
|
195 |
failed: Int = 0, |
|
196 |
finished: Int = 0, |
|
197 |
canceled: Boolean = false, |
|
198 |
terminated: Boolean = false, |
|
199 |
theory_status: Theory_Status.Value = Theory_Status.NONE |
|
83165
9f3f723938fc
more uniform Command_Status.theory_status vs. Node_Status.theory_status: cover all command_states, without special cases;
wenzelm
parents:
83164
diff
changeset
|
200 |
) extends Theory_Status { |
76716
a7602257a825
clarified state document nodes for Theories_Status / Document_Dockable;
wenzelm
parents:
76714
diff
changeset
|
201 |
def is_empty: Boolean = this == Node_Status.empty |
a7602257a825
clarified state document nodes for Theories_Status / Document_Dockable;
wenzelm
parents:
76714
diff
changeset
|
202 |
|
68758 | 203 |
def ok: Boolean = failed == 0 |
204 |
def total: Int = unprocessed + running + warned + failed + finished |
|
205 |
||
83163 | 206 |
def quasi_consolidated: Boolean = !suppressed && !finalized && terminated |
68897 | 207 |
|
68898 | 208 |
def percentage: Int = |
209 |
if (consolidated) 100 |
|
210 |
else if (total == 0) 0 |
|
211 |
else (((total - unprocessed).toDouble / total) * 100).toInt min 99 |
|
212 |
||
68758 | 213 |
def json: JSON.Object.T = |
214 |
JSON.Object("ok" -> ok, "total" -> total, "unprocessed" -> unprocessed, |
|
215 |
"running" -> running, "warned" -> warned, "failed" -> failed, "finished" -> finished, |
|
68898 | 216 |
"canceled" -> canceled, "consolidated" -> consolidated, |
217 |
"percentage" -> percentage) |
|
68758 | 218 |
} |
219 |
||
220 |
||
69863 | 221 |
/* overall timing */ |
68758 | 222 |
|
75393 | 223 |
object Overall_Timing { |
83154 | 224 |
val empty: Overall_Timing = Overall_Timing() |
68758 | 225 |
|
226 |
def make( |
|
227 |
state: Document.State, |
|
228 |
version: Document.Version, |
|
69863 | 229 |
commands: Iterable[Command], |
83176 | 230 |
threshold: Time = Time.zero |
75393 | 231 |
): Overall_Timing = { |
68758 | 232 |
var total = 0.0 |
69863 | 233 |
var command_timings = Map.empty[Command, Double] |
83172
e69ebc4782a3
clarified signature: more thorough treatment of all command_states;
wenzelm
parents:
83171
diff
changeset
|
234 |
for (command <- commands.iterator) { |
83175 | 235 |
val timing = state.command_timing(version, command) |
236 |
val elapsed = timing.elapsed.seconds |
|
237 |
total += elapsed |
|
83176 | 238 |
if (timing.is_notable(threshold)) command_timings += (command -> elapsed) |
68758 | 239 |
} |
83154 | 240 |
Overall_Timing(total = total, command_timings = command_timings) |
68758 | 241 |
} |
242 |
} |
|
243 |
||
83154 | 244 |
sealed case class Overall_Timing( |
245 |
total: Double = 0.0, |
|
246 |
command_timings: Map[Command, Double] = Map.empty |
|
247 |
) { |
|
69864 | 248 |
def command_timing(command: Command): Double = |
249 |
command_timings.getOrElse(command, 0.0) |
|
250 |
} |
|
68759 | 251 |
|
252 |
||
253 |
/* nodes status */ |
|
254 |
||
83169 | 255 |
enum Overall_Status { case ok, failed, pending } |
68759 | 256 |
|
75393 | 257 |
object Nodes_Status { |
68903 | 258 |
val empty: Nodes_Status = new Nodes_Status(Map.empty, Document.Nodes.empty) |
68759 | 259 |
} |
260 |
||
68903 | 261 |
final class Nodes_Status private( |
262 |
private val rep: Map[Document.Node.Name, Node_Status], |
|
75393 | 263 |
nodes: Document.Nodes |
264 |
) { |
|
68770
add44e2b8cb0
optional notification of nodes_status (via progress);
wenzelm
parents:
68769
diff
changeset
|
265 |
def is_empty: Boolean = rep.isEmpty |
83170 | 266 |
def defined(name: Document.Node.Name): Boolean = rep.isDefinedAt(name) |
68770
add44e2b8cb0
optional notification of nodes_status (via progress);
wenzelm
parents:
68769
diff
changeset
|
267 |
def apply(name: Document.Node.Name): Node_Status = rep(name) |
68759 | 268 |
def get(name: Document.Node.Name): Option[Node_Status] = rep.get(name) |
269 |
||
76716
a7602257a825
clarified state document nodes for Theories_Status / Document_Dockable;
wenzelm
parents:
76714
diff
changeset
|
270 |
def present( |
a7602257a825
clarified state document nodes for Theories_Status / Document_Dockable;
wenzelm
parents:
76714
diff
changeset
|
271 |
domain: Option[List[Document.Node.Name]] = None |
a7602257a825
clarified state document nodes for Theories_Status / Document_Dockable;
wenzelm
parents:
76714
diff
changeset
|
272 |
): List[(Document.Node.Name, Node_Status)] = { |
a7602257a825
clarified state document nodes for Theories_Status / Document_Dockable;
wenzelm
parents:
76714
diff
changeset
|
273 |
for (name <- domain.getOrElse(nodes.topological_order)) |
a7602257a825
clarified state document nodes for Theories_Status / Document_Dockable;
wenzelm
parents:
76714
diff
changeset
|
274 |
yield name -> get(name).getOrElse(Node_Status.empty) |
a7602257a825
clarified state document nodes for Theories_Status / Document_Dockable;
wenzelm
parents:
76714
diff
changeset
|
275 |
} |
68903 | 276 |
|
68884
9b97d0b20d95
clarified quasi_consolidated state: ensure that exports are present for ok nodes;
wenzelm
parents:
68883
diff
changeset
|
277 |
def quasi_consolidated(name: Document.Node.Name): Boolean = |
83170 | 278 |
get(name) match { |
68897 | 279 |
case Some(st) => st.quasi_consolidated |
68883
3653b3ad729e
clarified Thy_Resources.Session.use_theories: "terminated" node status is sufficient;
wenzelm
parents:
68881
diff
changeset
|
280 |
case None => false |
3653b3ad729e
clarified Thy_Resources.Session.use_theories: "terminated" node status is sufficient;
wenzelm
parents:
68881
diff
changeset
|
281 |
} |
3653b3ad729e
clarified Thy_Resources.Session.use_theories: "terminated" node status is sufficient;
wenzelm
parents:
68881
diff
changeset
|
282 |
|
83169 | 283 |
def overall_status(name: Document.Node.Name): Overall_Status = |
83170 | 284 |
get(name) match { |
68759 | 285 |
case Some(st) if st.consolidated => |
83169 | 286 |
if (st.ok) Overall_Status.ok else Overall_Status.failed |
287 |
case _ => Overall_Status.pending |
|
68759 | 288 |
} |
289 |
||
68763 | 290 |
def update( |
69255
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
wenzelm
parents:
68904
diff
changeset
|
291 |
resources: Resources, |
68763 | 292 |
state: Document.State, |
293 |
version: Document.Version, |
|
68769 | 294 |
domain: Option[Set[Document.Node.Name]] = None, |
75393 | 295 |
trim: Boolean = false |
296 |
): (Boolean, Nodes_Status) = { |
|
68903 | 297 |
val nodes1 = version.nodes |
68763 | 298 |
val update_iterator = |
299 |
for { |
|
68903 | 300 |
name <- domain.getOrElse(nodes1.domain).iterator |
82918 | 301 |
if !Resources.hidden_node(name) && !resources.loaded_theory(name) |
68763 | 302 |
st = Document_Status.Node_Status.make(state, version, name) |
83170 | 303 |
if !defined(name) || apply(name) != st |
68763 | 304 |
} yield (name -> st) |
305 |
val rep1 = rep ++ update_iterator |
|
68903 | 306 |
val rep2 = if (trim) rep1 -- rep1.keysIterator.filterNot(nodes1.domain) else rep1 |
68764 | 307 |
|
68903 | 308 |
(rep != rep2, new Nodes_Status(rep2, nodes1)) |
68763 | 309 |
} |
68761 | 310 |
|
68759 | 311 |
override def hashCode: Int = rep.hashCode |
312 |
override def equals(that: Any): Boolean = |
|
313 |
that match { |
|
314 |
case other: Nodes_Status => rep == other.rep |
|
315 |
case _ => false |
|
316 |
} |
|
68765 | 317 |
|
75393 | 318 |
override def toString: String = { |
68765 | 319 |
var ok = 0 |
320 |
var failed = 0 |
|
321 |
var pending = 0 |
|
68873 | 322 |
var canceled = 0 |
68765 | 323 |
for (name <- rep.keysIterator) { |
83169 | 324 |
overall_status(name) match { |
325 |
case Overall_Status.ok => ok += 1 |
|
326 |
case Overall_Status.failed => failed += 1 |
|
327 |
case Overall_Status.pending => pending += 1 |
|
68765 | 328 |
} |
68873 | 329 |
if (apply(name).canceled) canceled += 1 |
68765 | 330 |
} |
68873 | 331 |
"Nodes_Status(ok = " + ok + ", failed = " + failed + ", pending = " + pending + |
332 |
", canceled = " + canceled + ")" |
|
68765 | 333 |
} |
68759 | 334 |
} |
68758 | 335 |
} |