KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > piaget > analyze > DOCAnalyzer


1 /*
2  * DOCAnalyzer.java
3  *
4  * Created on May 6, 2005, 5:03 PM
5  */

6
7 package org.netbeans.modules.piaget.analyze;
8
9 import java.io.File JavaDoc;
10 import org.netbeans.modules.piagetproject.property.Property;
11
12 /**
13  *
14  * @author loicsegapelli
15  */

16 public class DOCAnalyzer extends DOCParser{
17     
18     double freq;
19     long time;
20     int counter;
21     Analyzer analyzer;
22     /** Creates a new instance of DOCAnalyzer */
23     public DOCAnalyzer(File JavaDoc f) {
24         super(f);
25     }
26     
27     protected void eof(){
28         if(freq==-1)return;
29         freq /= counter;
30             Analyzer.writeComment("Average typing frequency:"+freq+" total time spent typing:"+prettyTime(time));
31             Analyzer.writeProperty(Property.TYPING_FREQ, Double.toString(freq));
32             Analyzer.writeProperty(Property.TYPING_TIME, Long.toString(time));
33     }
34     
35     protected void init(){
36         freq = time = -1;
37         counter = 0;
38     }
39     
40     protected void analyzeValues(double freq, long time){
41         counter++;
42         this.freq += freq;
43         this.time += time;
44     }
45 }
46
Popular Tags