def verifySN(sn1:String, sn2: String, sn3: String) = {
exec(session => {
if (session.contains(sn1) && session.contains(sn2) && session.contains(sn3)) {
modifyFile(sn1.last.toString)
verify(
config,
Integer.parseInt(sn1.last.toString),
session(sn1).as[String].toLong,
session(sn2).as[String].toLong,
session(sn3).as[String].toLong,
System.out)
}
session
})
}
def verify(sn1: String, sn2: String, sn3: String) = {
exec(verifySN(sn1.concat("db1"), sn2.concat("db1"), sn3.concat("db1")))
}
def verifyArray(array: Array[String]) = {
if (array.length == 3) {
exec(verify(array(0), array(1), array(2)))
} else {
for (a <- 0 until array.length - 2;
b <- a + 1 until array.length - 1;
c <- b + 1 until array.length) {
exec(verify(array(a), array(b), array(c)))
}}
}
The exec in the for loop (verifyArray) function doesn’t compile. However this one does:
`
def verifyArray(array: Array[String]) = {
if (array.length == 3) {
exec(verify(array(0), array(1), array(2)))
} else {
exec(verify(array(0), array(1), array(2)))
.exec(verify(array(0), array(1), array(3)))
.exec(verify(array(0), array(1), array(4)))
.exec(verify(array(0), array(2), array(3)))
.exec(verify(array(0), array(2), array(4)))
.exec(verify(array(0), array(3), array(4)))
.exec(verify(array(1), array(2), array(3)))
.exec(verify(array(1), array(2), array(4)))
.exec(verify(array(1), array(3), array(4)))
.exec(verify(array(2), array(3), array(4)))
}
}
`