Source:Closing a frame in Java and opening another one, with the swt library from eclipse
def sendToOutPatient = { ... };
def sendToInPatient = { ... };
def patientRule = { PATIENT_TYPE ->
{'A': sendToOutPatient,
'B': sendToInPatient}.get(PATIENT_TYPE)
}
static main(){
(patientRule('A'))()
}