1 6 7 package org.netbeans.modules.piaget.analyze; 8 9 import java.io.File ; 10 import org.netbeans.modules.piagetproject.property.Property; 11 12 16 public class DOCAnalyzer extends DOCParser{ 17 18 double freq; 19 long time; 20 int counter; 21 Analyzer analyzer; 22 23 public DOCAnalyzer(File 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 |