📄 loctester.java
字号:
package psp0_2;
import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.LinkedList;
/**
* LOCTester: test the counter
* @author QianYin
* @version Thur Sep 21 07:10:00 2006
*/
public class LOCTester
{
/**
* method
*
*/
public LOCTester() {
super();
// TODO Auto-generated constructor stub
}
/**
* method
*
*/
public void run()
{
System.out.println("please enter the filepath:"); //input the string
System.out.println("enter \"end\" to get the total result");
String str = null;
int i = 2;
while(true)
{
i++;
str = this.getString();
if(str.equalsIgnoreCase("end"))
{
System.out.println("result is in the LOC Report files");
return;
}else
{
try
{
LOCCounter lc = new LOCCounter(str);
lc.analyze();
lc.printResult("LOC Report"+i+".txt");
}catch(Exception e)
{
System.out.println("wrong file path");
continue;
}
}
}
}
/**
* method
* @return a String read from console
*/
private String getString()
{
String str = null;
try
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
str = in.readLine();
}catch(IOException e){};
return str;
}
/**
* method
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
LOCTester l = new LOCTester();
l.run();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -