1 18 package org.apache.batik.parser; 19 20 import java.io.IOException ; 21 22 28 public class NumberListParser extends NumberParser { 29 32 protected NumberListHandler numberListHandler; 33 34 35 36 public NumberListParser() { 37 numberListHandler = DefaultNumberListHandler.INSTANCE; 38 } 39 40 51 public void setNumberListHandler(NumberListHandler handler) { 52 numberListHandler = handler; 53 } 54 55 58 public NumberListHandler getNumberListHandler() { 59 return (NumberListHandler)numberListHandler; 60 } 61 62 65 protected void doParse() throws ParseException, IOException { 66 numberListHandler.startNumberList(); 67 68 current = reader.read(); 69 skipSpaces(); 70 71 try { 72 for (;;) { 73 numberListHandler.startNumber(); 74 float f = parseFloat(); 75 numberListHandler.numberValue(f); 76 numberListHandler.endNumber(); 77 skipCommaSpaces(); 78 if (current == -1) { 79 break; 80 } 81 } 82 } catch (NumberFormatException e) { 83 reportError("character.unexpected", 84 new Object [] { new Integer (current) }); 85 } 86 numberListHandler.endNumberList(); 87 } 88 } 89 | Popular Tags |