183 def timeout: Time = Time.seconds(options.real("timeout") * options.real("timeout_scale")) |
183 def timeout: Time = Time.seconds(options.real("timeout") * options.real("timeout_scale")) |
184 } |
184 } |
185 |
185 |
186 object Selection |
186 object Selection |
187 { |
187 { |
188 val all: Selection = Selection(all_sessions = true) |
188 val empty: Selection = Selection() |
189 } |
189 } |
190 |
190 |
191 sealed case class Selection( |
191 sealed case class Selection( |
192 requirements: Boolean = false, |
192 requirements: Boolean = false, |
193 all_sessions: Boolean = false, |
193 all_sessions: Boolean = false, |
194 exclude_session_groups: List[String] = Nil, |
194 exclude_session_groups: List[String] = Nil, |
195 exclude_sessions: List[String] = Nil, |
195 exclude_sessions: List[String] = Nil, |
196 session_groups: List[String] = Nil, |
196 session_groups: List[String] = Nil, |
197 sessions: List[String] = Nil) |
197 sessions: List[String] = Nil) |
198 { |
198 { |
|
199 def + (other: Selection): Selection = |
|
200 Selection( |
|
201 requirements = requirements || other.requirements, |
|
202 all_sessions = all_sessions || other.all_sessions, |
|
203 exclude_session_groups = exclude_session_groups ::: other.exclude_session_groups, |
|
204 exclude_sessions = exclude_sessions ::: other.exclude_sessions, |
|
205 session_groups = session_groups ::: other.session_groups, |
|
206 sessions = sessions ::: other.sessions) |
|
207 |
199 def apply(graph: Graph[String, Info]): (List[String], Graph[String, Info]) = |
208 def apply(graph: Graph[String, Info]): (List[String], Graph[String, Info]) = |
200 { |
209 { |
201 val bad_sessions = |
210 val bad_sessions = |
202 SortedSet((exclude_sessions ::: sessions).filterNot(graph.defined(_)): _*).toList |
211 SortedSet((exclude_sessions ::: sessions).filterNot(graph.defined(_)): _*).toList |
203 if (bad_sessions.nonEmpty) error("Undefined session(s): " + commas_quote(bad_sessions)) |
212 if (bad_sessions.nonEmpty) error("Undefined session(s): " + commas_quote(bad_sessions)) |