154 Node_Timing(total, commands) |
154 Node_Timing(total, commands) |
155 } |
155 } |
156 } |
156 } |
157 |
157 |
158 sealed case class Node_Timing(total: Double, commands: Map[Command, Double]) |
158 sealed case class Node_Timing(total: Double, commands: Map[Command, Double]) |
|
159 |
|
160 |
|
161 /* nodes status */ |
|
162 |
|
163 object Overall_Node_Status extends Enumeration |
|
164 { |
|
165 val ok, failed, pending = Value |
|
166 } |
|
167 |
|
168 object Nodes_Status |
|
169 { |
|
170 val empty: Nodes_Status = new Nodes_Status(Map.empty) |
|
171 } |
|
172 |
|
173 final class Nodes_Status private(private val rep: Map[Document.Node.Name, Node_Status]) |
|
174 { |
|
175 def keys_iterator: Iterator[Document.Node.Name] = rep.keysIterator |
|
176 |
|
177 def defined(name: Document.Node.Name): Boolean = rep.isDefinedAt(name) |
|
178 def get(name: Document.Node.Name): Option[Node_Status] = rep.get(name) |
|
179 |
|
180 def overall_node_status(name: Document.Node.Name): Overall_Node_Status.Value = |
|
181 rep.get(name) match { |
|
182 case Some(st) if st.consolidated => |
|
183 if (st.ok) Overall_Node_Status.ok else Overall_Node_Status.failed |
|
184 case _ => Overall_Node_Status.pending |
|
185 } |
|
186 |
|
187 def + (entry: (Document.Node.Name, Node_Status)): Nodes_Status = |
|
188 new Nodes_Status(rep + entry) |
|
189 |
|
190 def - (name: Document.Node.Name): Nodes_Status = |
|
191 new Nodes_Status(rep - name) |
|
192 |
|
193 override def hashCode: Int = rep.hashCode |
|
194 override def equals(that: Any): Boolean = |
|
195 that match { |
|
196 case other: Nodes_Status => rep == other.rep |
|
197 case _ => false |
|
198 } |
|
199 override def toString: String = rep.iterator.mkString("Nodes_Status(", ", ", ")") |
|
200 } |
159 } |
201 } |