/* Author: Jeff Dalton * Updated: Mon Dec 3 22:19:25 2001 by Jeff Dalton * Copyright: (c) 2001, AIAI, University of Edinburgh */ package ix.ideel; import ix.util.*; import ix.icore.IssueHandler; import ix.icore.Issue; import ix.icore.process.StatusValues; /** * One of the ways an issue might be handled. */ public class IssueOption implements IssueHandler, StatusValues { /** * Briefly describes how this option would handle an issue. */ String shortDescription; /** * Constructor for use by subclasses. */ IssueOption() {} /** * Handle the issue in the manner appropriate to this issue-option. * This method merely changes the issue's status to COMPLETE and * is overridden in subclasses that handle the issue in more * interesting ways. */ public void handleIssue(Issue i) { Debug.noteln("Option " + shortDescription + " handling issue " + i); i.setStatus(STATUS_COMPLETE); } /** * Returns a brief description of how this option would handle * an issue. */ public String getActionDescription() { return shortDescription; } /** * Handles an issue by doing nothing. Used when it's * convenient to select an option without actually handling * the issue, so that all other options remain available * and can be selected later on. */ static class NoActionOption extends IssueOption { public NoActionOption() { shortDescription = "No Action"; } public void handleIssue(Issue i) { // N.B. no status change. Debug.noteln("No action for", i); } } /** * Indicates that the issue has been handled by the user. * Note that an issue may have more than one Manual option, * with different descriptions that act as reminders of * different ways the user might act. */ static class ManualOption extends IssueOption { public ManualOption() { shortDescription = "Done"; } public ManualOption(String methodDescription) { shortDescription = "Done using " + methodDescription; } } /** * Used to indicate the the issue does not apply in the current * situation. */ static class NotApplicableOption extends ManualOption { public NotApplicableOption() { shortDescription = "N/A"; } } }