import java.util.*; import java.io.*; /** * CS1322: Programming Assignment #6 - Fall 2002 * *
 * IDBox for: PacmanFileReader.java
 *
 * Revisions: 1.0 Nov. 23, 2002
 *              Created the PacmanFileReader class
 *
 * 
* * Collaboration statement: * "I worked on the homework assignment alone, using only * course materials." * * @author Roland Krystian Alberciak * @version Version 1.0, Nov. 23, 2002 */ // imports are listed above IDBox public class PacmanFileReader { /** Debug value for toggling System.out.* output */ public static boolean DEBUG = false; public static boolean DEBUG_CODE = false; public static boolean DEBUG_MAIN = false; /* // ======================================================================= // Constructors // ======================================================================= */ /** * Constructor 1. Specified default-overriding constructor for PacmanFileReader. * @param void No parameters. * @return PacmanFileReader instance/object. * public PacmanFileReader() { } //end of PacmanFileReader() */ /** * Constructor 2. Specified default-overloading constructor for PacmanFileReader. * @param file_name a String file name of a board file * @return PacmanFileReader instance/object. */ public PacmanFileReader(String file_name) { ghosts = new Ghost[4]; //0->1, 1->2, 2->3, 3->4 this.FILE_NAME=file_name; pieceArray=new GamePiece[15][15]; read_5_lines(); read_15_lines(); } //end of PacmanFileReader(String) /* // ======================================================================= // Methods which override class Object methods // ======================================================================= */ /** * Equal instance comparison. Compares if two instances are equal. * @param o object-type reference of (hopefully) an PacmanFileReader. * @return boolean whether objects are equal. * public boolean equals (Object o) { } //end of equals(Object) */ /** * toString instance printer. Prints properties of PacmanFileReader. * @return System.out.println(PacmanFileReader instance) instance print. */ public String toString() { String result=""; result= result+pacman.toString()+"\n"; //gets toString of Pacman. for (int i=0; i
* @param args a String array of command line arguments. */ public static void main(String[] args) { if ( (args.length==1) && (args[0].equals("-db") ) ) DEBUG_MAIN=true; //else leave false: ignore input. if (DEBUG_MAIN) { // NOTE: This {} encapsulates most of main and is leftmost margin as a flag. // redundant ifs left in, in case the main if(DEBUG) statement was ommitted, // this would then print out neat output, as an example of real running. PacmanFileReader pfr1 = new PacmanFileReader("board_1.txt"); PacmanFileReader pfr2 = new PacmanFileReader("board_2.txt"); System.out.println(pfr1); System.out.println(pfr2); if (DEBUG) System.out.println("end main(String[] args) call:"); } //end of DEBUG if } //end of main(String[] args) } //end of class PacmanFileReader