// --------------------------------------- // Restricted Focus Viewer (RFV) Program // Version 2.1 // Language: Java 2 // November, 2000 // Copyright (C) 2000 Anthony R. Jansen // --------------------------------------- // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------- // RFV_Error.java // // Class for specifying all errors in the // RFV and Replayer programs, with all // error functions static. // --------------------------------------- public class RFV_Error { // List of warning messages // ------------------------ private static final String w_message[] = {"", // 1-3 "TIME_LIMIT_EXPIRED label in FEEDBACK will not be used", "NO_BUTTONS label in FEEDBACK will not be used", "No button label matching FEEDBACK label" }; // List of error messages // ---------------------- private static final String e_message[] = {"", // 1-10 "Expecting DEFAULTS as first parameter in the input file", "Expecting COMPONENT as next parameter in the input file", "No COMPONENTS defined in the input file", "Duplication of COMPONENT label:", "Could not access component label", "Unexpected argument in COMPONENT:", "Could not access stimuli", "Could not create time limit thread", "Could not access buttons", "Could not access feedback block", // 11-20 "Could not create motion blur thread", "Unexpected argument in BLOCK:", "Unexpected argument in FEEDBACK:", "TIME_LIMIT defined more than once", "Unexpected argument in TIME_LIMIT", "BACKGROUND defined more than once", "DISPLAY defined more than once", "Unexpected argument in DISPLAY COLUMN:", "Unexpected argument in DISPLAY ROW:", "TEXT_FONT defined more than once in TEXT_LINE", // 21-30 "FOREGROUND defined more than once in TEXT_LINE", "Unexpected argument in TEXT_LINE:", "RESPONSE_TIME can only be defined in a feedback block", "TEXT_FONT defined more than once in RESPONSE_TIME", "FOREGROUND defined more than once in RESPONSE_TIME", "Unexpected argument in RESPONSE_TIME:", "Cannot define a BUTTON in a feedback block", "BUTTON_FONT defined more than once in BUTTON", "FOREGROUND defined more than once in BUTTON", "BACKGROUND defined more than once in BUTTON", // 31-40 "Unexpected argument in BUTTON:", "Cannot define a STIMULUS in a feedback block", "FOCUS_WINDOW defined more than once in STIMULUS", "MOTION_BLUR_SPEED defined more than once in STIMULUS", "Unexpected argument in STIMULUS:", "Cannot define FEEDBACK in a feedback block", "Duplication of FEEDBACK label:", "Could not access feedback label", "Frame cannot fit all the display elements", "Could not destroy stimuli", // 41-50 "Unexpected argument in DEFAULTS:", "DEFAULTS missing argument(s):", "FRAME_SIZE defined more than once in DEFAULTS", "FOCUS_WINDOW defined more than once in DEFAULTS", "MOTION_BLUR_SPEED defined more than once in DEFAULTS", "TEXT_FONT defined more than once in DEFAULTS", "BUTTON_FONT defined more than once in DEFAULTS", "BACKGROUND defined more than once in DEFAULTS", "Could not access display element", "System does not support custom cursors", // 51-60 "Could not create cursor", "Could not draw stimuli in focus", "Unexpected argument in FOCUS_WINDOW:", "Invalid focus window region sizes", "Error loading image", "Image loading interrupted", "Could not find file", "Could not obtain file pointer information", "Could not set file pointer information", "I/O error reading from input file", // 61-70 "Could not read in next token", "Could not parse input file", "Expecting an integer", "Missing `)'", "Missing `('", "Missing `)': end-of-file reached with unpaired `('", "Invalid color value (Not in range 0 - 255)", "Could not create output data file", "Could not check subject ID", "Incorrect number of stimulus filenames", // 71-80 "Inconsistent STIMULUS image dimensions:", "Interrupted while waiting for time limit to elapse", "Could not deduce block number", "Could not parse block number", "Could not match requested component", "Invalid stimuli number in data file", "Could not create replayer thread", "Could not set replayer stimulus guide", "File is not a valid data file", "Invalid data file header format", // 81-90 "I/O error reading from data file", "Invalid format in data file:", "Could not reposition file pointer", "Expecting an integer in data file:", "Could not access block label", "TEXT_FOREGROUND defined more than once in DEFAULTS", "BUTTON_FOREGROUND defined more than once in DEFAULTS", "BUTTON_BACKGROUND defined more than once in DEFAULTS", "Expecting a label within double quotes", "No closing double quotes for label", // 91 "Invalid FEEDBACK label:" }; // Exit program with specified error message // ----------------------------------------- public static void die(int num) { try { System.err.println("Error " + num + ":"); System.err.println(" " + e_message[num]); System.exit(1); } catch(ArrayIndexOutOfBoundsException e) { System.err.println(" Unknown Error!?"); System.exit(1); } } // Exit program with specified error message // about a particular input file line number // ----------------------------------------- public static void die(int num, int line) { try { System.err.println("Error " + num + ":"); System.err.println(" Line " + line + " of the input file"); System.err.println(" " + e_message[num]); System.exit(1); } catch(ArrayIndexOutOfBoundsException e) { System.err.println(" Unknown Error!?"); System.exit(1); } } // Exit program with specified error message // ----------------------------------------- public static void die(int num, String str) { try { System.err.println("Error " + num + ":"); System.err.println(" " + e_message[num] + " `" + str + "'"); System.exit(1); } catch(ArrayIndexOutOfBoundsException e) { System.err.println(" Unknown Error!?"); System.exit(1); } } // Exit program with specified error message // about a particular input file line number // ----------------------------------------- public static void die(int num, int line, String str) { try { System.err.println("Error " + num + ":"); System.err.println(" Line " + line + " of the input file"); System.err.println(" " + e_message[num] + " `" + str + "'"); System.exit(1); } catch(ArrayIndexOutOfBoundsException e) { System.err.println(" Unknown Error!?"); System.exit(1); } } // Warn user with a specific warning message // about a particular input file line number // ----------------------------------------- public static void warn(int num, int line) { try { System.err.println("Warning " + num + ":"); System.err.println(" Line " + line + " of the input file"); System.err.println(" " + w_message[num]); } catch(ArrayIndexOutOfBoundsException e) { System.err.println(" Unknown Warning!?"); } } // Warn user with a specific warning message // about a particular input file line number // ----------------------------------------- public static void warn(int num, int line, String str) { try { System.err.println("Warning " + num + ":"); System.err.println(" Line " + line + " of the input file"); System.err.println(" " + w_message[num] + " `" + str + "'"); } catch(ArrayIndexOutOfBoundsException e) { System.err.println(" Unknown Warning!?"); } } }