Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/codeMetrics
In directory sc8-pr-cvs1:/tmp/cvs-serv31228/tests/codeMetrics
Modified Files:
LineCounter.java
Log Message:
Change tabs to spaces in all source files.
Index: LineCounter.java
===================================================================
RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/codeMetrics/LineCounter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** LineCounter.java 24 Aug 2003 21:59:43 -0000 1.4
--- LineCounter.java 3 Sep 2003 23:36:20 -0000 1.5
***************
*** 36,100 ****
public class LineCounter {
!
! public int count(File file) {
! System.out.println("Handling "+file.getName());
! int count = 0;
! // Get all files in current directory
! if (file.isDirectory()) {
! // Get the listing in this directory
! count = recurseDirectory(file, count);
! } else {
! // It is a file
! count = countLinesIn(file);
! }
! return count;
! }
! /**
! * Counts code excluding comments and blank lines in the given file
! * @param file
! * @return int
! */
! public int countLinesIn(File file) {
! int count = 0;
! System.out.println("Counting "+file.getName());
! try {
! BufferedReader reader = new BufferedReader(new FileReader(file.getAbsolutePath()));
! String line = null;
! do {
! line = reader.readLine();
! if (line!=null &&
! line.indexOf("*")==-1 &&
! line.indexOf("//")==-1 &&
! line.length()>0
! ) count++;
! }
! while (line!=null);
! }
! catch (Exception e) {
! e.printStackTrace();
! }
! return count;
! }
! public int recurseDirectory(File file, int count) {
! File [] files = file.listFiles(new FileFilter() {
! public boolean accept(File file) {
! if (file.getName().indexOf(".java")!=-1 || file.isDirectory()) {
! return true;
! } else {
! return false;
! }
! }
! });
! for (int i=0;i<files.length;i++) {
! count += count(files[i]);
! }
! return count;
! }
!
! public static void main(String [] args) {
! LineCounter lc = new LineCounter();
! System.out.println("Line Count = "+lc.count(new File(args[0])));
! }
}
--- 36,100 ----
public class LineCounter {
!
! public int count(File file) {
! System.out.println("Handling "+file.getName());
! int count = 0;
! // Get all files in current directory
! if (file.isDirectory()) {
! // Get the listing in this directory
! count = recurseDirectory(file, count);
! } else {
! // It is a file
! count = countLinesIn(file);
! }
! return count;
! }
! /**
! * Counts code excluding comments and blank lines in the given file
! * @param file
! * @return int
! */
! public int countLinesIn(File file) {
! int count = 0;
! System.out.println("Counting "+file.getName());
! try {
! BufferedReader reader = new BufferedReader(new FileReader(file.getAbsolutePath()));
! String line = null;
! do {
! line = reader.readLine();
! if (line!=null &&
! line.indexOf("*")==-1 &&
! line.indexOf("//")==-1 &&
! line.length()>0
! ) count++;
! }
! while (line!=null);
! }
! catch (Exception e) {
! e.printStackTrace();
! }
! return count;
! }
! public int recurseDirectory(File file, int count) {
! File [] files = file.listFiles(new FileFilter() {
! public boolean accept(File file) {
! if (file.getName().indexOf(".java")!=-1 || file.isDirectory()) {
! return true;
! } else {
! return false;
! }
! }
! });
! for (int i=0;i<files.length;i++) {
! count += count(files[i]);
! }
! return count;
! }
!
! public static void main(String [] args) {
! LineCounter lc = new LineCounter();
! System.out.println("Line Count = "+lc.count(new File(args[0])));
! }
}
|