1 6 7 package org.netbeans.modules.piaget.analyze; 8 9 import java.io.File ; 10 11 15 public abstract class DOCParser extends Parser { 16 17 long time; 18 double freq; 19 20 21 public DOCParser(File f) { 22 super(f); 23 } 24 25 protected void analyzeTokenInput() throws SyntaxException{ 26 nextLONG(); 27 caseProperty(); 28 } 29 30 private void caseProperty() throws SyntaxException{ 31 caseFrequency(); 32 } 33 34 private void caseFrequency() throws SyntaxException{ 35 nextWORD(); 36 if(scanner.sval.charAt(0)=='f'){ 37 freq=Double.parseDouble(scanner.sval.substring(1,scanner.sval.length())); 38 caseTime(); 39 } 40 else throw(new SyntaxException("f not found")); 41 } 42 43 private void caseTime() throws SyntaxException{ 44 nextWORD(); 45 if(scanner.sval.charAt(0)=='t'){ 46 time=Long.parseLong(scanner.sval.substring(1,scanner.sval.length())); 47 analyzeValues(freq, time); 48 } 49 else throw(new SyntaxException("t not found")); 50 } 51 52 abstract protected void eof(); 53 54 abstract protected void init(); 55 56 abstract protected void analyzeValues(double freq,long time); 57 58 } 59 | Popular Tags |