?? wordsearch.java
字號:
import java.io.*;
/**
* This is the main class of the WordSearch program. <p>
* This program reads words form the dictionary file,then
* search the word in the matrix. It chooses a letter, search
* the upside, downside,leftside and rightside of this letter. <p>
* If finds the right letter, it goes on,otherwise tries a new start until finds
* the word in the matrix or the matrix has been searched all over without the word.
* See class SearchSolve for the main algorithm of this program. <p>
*
* @author Ting Chen 0122070
* @version 1.0 2003/5/30
* @see java.util.StringTokenizer
*/
public class WordSearch
{
/**
* The main method of the class.
* It counts the whole time used and call the help method to finish
* the search job.
*
* @param args The arguments for the method.
*/
public static void main(String[] args) throws IOException
{
BufferedReader br;
String filename;
SearchSolve solve;
java.util.Date mydate;
long beginTime,endTime;
if(args.length!=2)
{
System.out.println("Error:please input filename.");
return;
}
filename=args[0];
try
{
System.out.println("\n================ your solution begins ================\n");
// get the begin time
mydate=new java.util.Date();
beginTime=mydate.getTime();
br=new BufferedReader(new FileReader(filename));
solve=new SearchSolve();
// pass output file name
solve.outPutFile = args[1];
solve.readText(br);
// get the end time
mydate=new java.util.Date();
endTime=mydate.getTime();
System.out.println("\n================ your solution ends =================\n");
System.out.println("Time consumed: "+(endTime-beginTime)+" millisecondes.");
}
catch (IOException e)
{
System.out.println("Error:io error.");
}
}
}//end of class
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -