/** * Checks if the panel belongs to a active instruction if so, score + 1, remove the instruction * from the active list and return true Author Kaj * * @param panel the pressed panel * @return true if the pressed panel was a active instruction */ public synchronized Instruction validateInstruction(Panel panel) { Instruction correctInstruction = null; for (Instruction instruction : activeInstructions) { if (instruction.getPanel().getId() == panel.getId()) { if (panel.getPanelType() == PanelTypeEnum.HorizontalSlider || panel.getPanelType() == PanelTypeEnum.VerticalSlider) { if (instruction.getPanel().getValue() != panel.getValue()) { return correctInstruction; } } score++; correctInstruction = instruction; // activeInstructions.remove(instruction); log.log( Level.INFO, "validating instruction ended, panel: {0} was correct", panel.getText()); return correctInstruction; } } log.log(Level.INFO, "validating instruction ended, panel: {0} was incorrect", panel.getText()); return correctInstruction; }