Created
August 8, 2020 18:24
-
-
Save EvgenJin/a532c0059552315a5f09f5df04e2deab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main = [:] | |
main.myList = [] | |
def addToList(list,name,con1,con2,con3,res) { | |
name = [:] | |
name.con1 = con1 | |
name.con2 = con2 | |
name.con3 = con3 | |
name.res = res | |
list.push(name) | |
} | |
addToList(main.myList,'first_case','succes','succes','error',false) | |
addToList(main.myList,'second_case','error','succes','succes',false) | |
addToList(main.myList,'third_case','succes','error','succes',false) | |
def getDecision(list,err1,err2,err3) { | |
def res = list.findAll{it.con1.equals(err1) && it.con2 == err2 && it.con3 == err3}[0]['res'] | |
if (!res) { | |
res = true | |
} | |
return res | |
} | |
println(getDecision(main.myList,'succes','succes','error')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment