User:Flcelloguy/Tool/1.0

From Wikipedia, the free encyclopedia

/*Author: Flcelloguy
*Program: Flcelloguy's Tool (Stats.java)
*Version 1.0; released December 04 2005
*Capabilities: Count edits only
*Please leave this block in. 
*Code from http://en.wikipedia.org/wiki/User:Flcelloguy/Tool
* [[User:Flcelloguy/Tool]]
* Permission is granted to distribute freely, provided attribution is granted.
*/

import javax.swing.JOptionPane;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.StringTokenizer;
import java.io.*;
import java.util.*;
//import java.util.FileReader;

public class Stats
{
        public static void main (String args[]) throws IOException
        {
                JOptionPane.showMessageDialog(null, 
                        "Flcelloguy's Tool \n Designed by Flcelloguy \n Statistics for editcounters", "Welcome!", 
                        JOptionPane.INFORMATION_MESSAGE);
                JOptionPane.showMessageDialog(null, 
                        "Current status: \n Editcount only \n Coming soon: \n Breakdown by namespace" + 
                                "\n User friendly version \n Edit summary usage \n Minor edits usage \n First edit date", "Information", 
                                JOptionPane.INFORMATION_MESSAGE);
                JOptionPane.showMessageDialog(null, 
                        "Number of edits: " + editcount(), "Results",
                                JOptionPane.INFORMATION_MESSAGE);
                        
        }
        
        public static int editcount() throws IOException
        {
                int numEdits = 0;
                FileReader reader = new FileReader("Input.txt");
                BufferedReader in = new BufferedReader(reader);
                
                while (in.readLine() != null)
                {
                        numEdits++;
                }
                return numEdits;
        }
}