public class Message { public final static int INIT = 0; public final static int ERROR_MSG = 1; public final static int WARNING_MSG = 2; public final static int PLAIN_MSG = 3; public final static int EMPTY = 8; private final String[] msg = { "Loading . . . , please wait.", "Error: Lambda value is out of range! (0.50 - 5.00)", "Error: Distance value is out of range! (0.50 - 5.00)", "Error: Theta value is out of range! (5.00 - 50.00)", "Error: Input is not a valid number!", "changing lambda . . .", "changing distance . . .", "changing theta . . .", "", "changing values . . ." }; private int msg_code; private int msg_type; public Message(int code) { msg_code = code; setMsgType(); } public String toString() { return msg[msg_code]; } public void setCode(int code) { msg_code = code; setMsgType(); } public int getType() { return msg_type; } private void setMsgType() { switch(msg_code) { case 1: case 2: case 3: case 4: msg_type = ERROR_MSG; break; case 0: msg_type = INIT; break; case 5: case 6: case 7: case 9: msg_type = PLAIN_MSG; break; case 8: msg_type = EMPTY; break; default: System.out.println("Error: Message.setType --> unknown type"); msg_type = ERROR_MSG; } } }