KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > analyzer > listeners > DOCParser


1 /*
2  * DOCParser.java
3  *
4  * Created on April 24, 2005, 11:08 PM
5  */

6
7 package analyzer.listeners;
8
9 /**
10  *
11  * @author loicsegapelli
12  */

13 public abstract class DOCParser extends Parser {
14     
15     long totalTime;
16     double frequency;
17     
18     /** Creates a new instance of WMParser */
19     public DOCParser(String JavaDoc pathAndTS) {
20         super(pathAndTS+".DOC.log");
21     }
22     
23     protected void analyzeTokenInput() throws SyntaxException{
24         nextNUMBER();
25         caseProperty();
26     }
27     
28     private void caseProperty() throws SyntaxException{
29         caseFrequency();
30     }
31     
32     private void caseFrequency() throws SyntaxException{
33         nextWORD();
34         if(st.sval.charAt(0)=='f'){
35             frequency=Double.parseDouble(st.sval.substring(1,st.sval.length()));
36             caseTime();
37         }
38         else throw(new SyntaxException("f not found"));
39     }
40     
41     private void caseTime() throws SyntaxException{
42         nextWORD();
43         if(st.sval.charAt(0)=='t'){
44             totalTime=Long.parseLong(st.sval.substring(1,st.sval.length()));
45             analyzeValues(frequency, totalTime);
46         }
47         else throw(new SyntaxException("t not found"));
48     }
49     
50     abstract protected void eof();
51     
52     abstract protected void init();
53     
54     abstract protected void analyzeValues(double freq,long time);
55     
56 }
57
Popular Tags