/** * Executes the command by creating the medical test * * @return the details of the created medical test * @throws CannotDoException the command was already executed */ @Override public String execute() throws CannotDoException { if (done) { throw new CannotDoException("Cannot undo command, not done yet."); } if (made.isResultEntered()) { throw new CannotDoException("Results already entered, cannot undo."); } String out = appC.execute(); toAdd.addMedicalTest(made); done = true; return out + "\n" + made.advancedString(); }
/** * @return the details of the medical test and the patient it was made for * @see java.lang.Object#toString() */ @Override public String toString() { return made.toString() + "\nPatient: " + toAdd.toString(); }