logger.debug("Running Switch ");
Memory mem = m.getContextStack().currentContext().getMemory();
CurrinRef switcher = mem.getElementAt(_selector);
if ( switcher == null ) {
throw new InterpreterException("Switcher nulo en Switch");
}
Iterator i = _cases.iterator();
SwitchCase sc;
while ( i.hasNext() ) {
sc = ((SwitchCase)i.next());
if (sc.getSwitcher().equals(switcher, mem)) {
logger.debug("Matched switch Option");
m.getContextStack().currentContext().runInstrBlock(sc.getInstrToRun());
return; /* Unreachable state */
}
}
logger.debug("In switch default case");
if ( _default == null )
throw new InterpreterException("Required default case in switch"
+ " but is not defined");
m.getContextStack().currentContext().runInstrBlock(_default.getInstrToRun());
logger.debug("Not found valid option in switch");
}