/*
* UserCancelException.java
*
* Created on September 12, 2002, 11:48 PM
*/
package IO;
/**
*
* @author mike
*/
public class UserCancelException extends java.lang.Exception {
private String methodCalled;
private String prompt; // prompt to question user Canceled from
private double min;
private double max;
private boolean range; // indicates whether question involved range
/**
* Creates a new instance of UserCancelException
without detail message.
*/
public UserCancelException() {
range = false;
}
/**
* Constructs an instance of UserCancelException
with the specified detail message.
* @param msg the detail message.
*/
public UserCancelException(String msg) {
super(msg);
range = false;
}
/**
* Constructs an instance of UserCancelException
with the specified detail message.
* @param msg the detail message.
*/
public UserCancelException(String msg, String called) {
super(msg);
methodCalled = called;
range = false;
}
/**
* Constructs an instance of UserCancelException
with the specified detail message.
* @param msg the detail message.
*/
public UserCancelException(String msg, String called, String promptQ) {
super(msg);
methodCalled = called;
prompt = promptQ;
range = false;
}
/**
* Constructs an instance of UserCancelException
with the specified detail message.
* @param msg the detail message.
*/
public UserCancelException(String msg, String called, String promptQ, double low, double high) {
super(msg);
methodCalled = called;
prompt = promptQ;
min = low;
max = high;
range = true;
}
/**
* To obtain the method that user canceled from
*/
public String getMethod () {
return methodCalled;
}
/**
* To obtain the prompt that user canceled from
*/
public String getPrompt () {
return prompt;
}
/**
* To obtain the low value on the range that user canceled from
*/
public double getMin () {
return min;
}
/**
* To obtain the high value on the range that user canceled from
*/
public double getMax () {
return max;
}
/**
* Show the exception
*/
public String toString() {
String res = "";
res = res + "Method: " + methodCalled;
res = res + " Prompt: " + prompt;
if (range) {
res = res + " Low: " + min;
res = res + " High: " + max;
}
return res;
}
}