import java.util.*; public class Scanner { Disk in, out; Set64 board; Set64 longSeq; //Collection board; /** * @param filename the filename of the input text file containing the scanner array */ public Scanner(String filename){ in = new Disk(filename, "in"); } /** * @param s a String containing no blanks * @return its argument without modification */ protected String newWord(String s){ return s; } /** * @param s a String representing a line in a text file * @return the resulting String after newWord has been applied to each word in s */ protected String lineHandler(String s){ StringTokenizer toks = new StringTokenizer(s); String result = ""; while (toks.hasMoreTokens()){ result += newWord(toks.nextToken()) + " "; } return result; } /** * print copies the scanner array to an output text file, unmodified * @param filename the filename of the new text file to which the scanner array will be copied */ public void print(String filename){ out = new Disk(filename, "out"); String line = in.readLine(); while(line != null){ out.out.println(lineHandler(line)); line =in.readLine(); } out.out.close(); } public void maxHRun(String filename){ Set64 board = new Set64(); //Collection board = new ArrayList(); Set64 longSeq = new Set64(); String line = in.readLine(); while(line != null){ String[] rowArray = line.split(" "); Integer [] columns = new Integer[rowArray.length]; for(int i=0;i= currentLongestRun ) { currentLongestRun = j-i; i=j-i; } break; } } if (j == (rowArr.length)){ if ( (j - i) >= currentLongestRun ) { currentLongestRun = j-i; i = j-1; } } } } board.reset(); while(board.hasNext()){ Integer[] rowArr = (Integer[]) board.next(); for(int i=0;i