-
Notifications
You must be signed in to change notification settings - Fork 1
/
Case4.scala
36 lines (32 loc) · 1.02 KB
/
Case4.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package edu.ksu.cis.santos.mdcf.dms.examplev2.requirement
import edu.ksu.cis.santos.mdcf.dms._
import edu.ksu.cis.santos.mdcf.dms.examplev2.schema.ICE_VMD
import edu.ksu.cis.santos.mdcf.dms.examplev2.schema.ICE_Channel
import edu.ksu.cis.santos.mdcf.dms.examplev2.clas.ICE_SpO2_Numeric
import edu.ksu.cis.santos.mdcf.dms.examplev2.schema.ICE_Periodic_Exchange
/*
* App requirement for an ICE_SpO2_Numeric with specifying range of valid value
* on the ICE_SpO2_Numeric. (e.g. min:70, max: 100)
*/
trait AppReq4 {
val spo2 : ICE_SpO2_Numeric
val spo2_ex : ICE_Periodic_Exchange
}
object AppReq4 {
@Inv
val req1 : Predicate[AppReq4] =
pred { ar : AppReq4 =>
ar.spo2 match {
case spo2 : ICE_SpO2_Numeric =>
spo2.exchanges.values.exists(
_ match {
case exch : ICE_Periodic_Exchange =>
ar.spo2_ex == exch
case _ => false
}
) && spo2.range.min <= 30 &&
spo2.range.max >= 100
case _ => false
}
}
}