net.sf.clichart.data
Class AbstractDataParser

java.lang.Object
  extended by net.sf.clichart.data.AbstractDataParser
All Implemented Interfaces:
DataParser
Direct Known Subclasses:
TimeDataParser, ValueDataParser

public abstract class AbstractDataParser
extends java.lang.Object
implements DataParser

Abstract base class for data parsers. Subclasses are responsible for parsing the X value.

Note: In order to add a second axis, call addSecondAxis before parsing starts.

Author:
johnd

Constructor Summary
protected AbstractDataParser(LineParser lineParser, int xColumnIndex, int[] yColumnIndexes, boolean hasHeader, boolean ignoreMissingValues, boolean ignoreEmptyValues, DataSink sink)
           
 
Method Summary
 void addSecondAxis(int[] yColumnIndexes, DataSink sink)
          Configure parsing for values to be displayed on a second axis on the chart.
 void parse(java.io.Reader source)
          Parse the data from the reader, advising the sink of all data parsed
protected abstract  java.lang.Object parseXValueImpl(java.lang.String xValue, int lineNumber)
          Parse the provided X value, and return as an appropriate object, e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDataParser

protected AbstractDataParser(LineParser lineParser,
                             int xColumnIndex,
                             int[] yColumnIndexes,
                             boolean hasHeader,
                             boolean ignoreMissingValues,
                             boolean ignoreEmptyValues,
                             DataSink sink)
Method Detail

addSecondAxis

public void addSecondAxis(int[] yColumnIndexes,
                          DataSink sink)
Configure parsing for values to be displayed on a second axis on the chart.

Parameters:
yColumnIndexes - Column indexes to display on the second chart
sink - Data sink for the second axis.

parse

public void parse(java.io.Reader source)
           throws java.io.IOException,
                  InvalidDataException
Description copied from interface: DataParser
Parse the data from the reader, advising the sink of all data parsed

Specified by:
parse in interface DataParser
Throws:
java.io.IOException
InvalidDataException

parseXValueImpl

protected abstract java.lang.Object parseXValueImpl(java.lang.String xValue,
                                                    int lineNumber)
                                             throws InvalidDataException
Parse the provided X value, and return as an appropriate object, e.g. Date, Integer, Double

Throws:
InvalidDataException