public class FwkSimpleASCIIColumnsReader extends FwkFileFilter implements FwkReadColumnsFromStreamInterface
Modifier and Type | Class and Description |
---|---|
class |
FwkSimpleASCIIColumnsReader.DataObserver
The data observer class.
|
protected class |
FwkSimpleASCIIColumnsReader.InvalidValue
A class to remember invalid values.
|
static class |
FwkSimpleASCIIColumnsReader.MessagePrinter
Message listener that dumps the messages to the standard out.
|
Modifier and Type | Field and Description |
---|---|
protected int |
colCounter |
protected java.lang.String[] |
colNames |
static java.lang.String |
COLUMNNAME |
protected static int |
COLUMNNAMES |
static int |
DATAINCREMENT |
static java.lang.String |
EXTENSION |
static int |
INCREMENT |
protected static double |
INVALID_AVL |
protected static double |
INVALID_VALUE |
protected double |
invalidValue |
protected java.util.HashMap |
messageListener |
protected FwkSimpleASCIIColumnsReader.DataObserver[] |
observers |
protected static int |
UNITNAMES |
protected java.lang.String[] |
units |
protected static int |
VALUES |
version
Constructor and Description |
---|
FwkSimpleASCIIColumnsReader()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.io.File f)
Whether the given file is accepted by this filter.
|
protected java.lang.String |
addColumnName(java.lang.String name)
Add a column name.
|
void |
addFwkMessageListener(FwkMessageListener fwkMessageListener)
Add a message listener.
|
protected java.lang.String |
addUnit(int colNo,
java.lang.String unit)
Add a unit name.
|
protected void |
addValue(int colno,
double value)
Add a value.
|
protected void |
fireMessage(int lineNo,
java.lang.String message)
Fire a message.
|
protected int |
getCount(int colno) |
java.lang.String |
getDescription()
The description of this filter.
|
FwkMessageListener[] |
getFwkMessageListeners()
Get all known message listeners.
|
int |
getSize()
Get the total number of columns.
|
protected boolean |
isInvalid(java.lang.String s)
Returns a boolean whether the given string a invalid value.
|
static void |
main(java.lang.String[] args)
The main testing routine.
|
FwkColumnAccessInterface[] |
read(java.lang.String ref,
java.io.InputStream is)
Read columns from stream.
|
void |
removeFwkMessageListener(FwkMessageListener fwkMessageListener)
Remove the message listener.
|
protected void |
resetColumnNames()
Reset the array of colum names.
|
void |
setAsInvalid(double val)
Use this method to set the value that sould be used for invalid value.
|
accept, addExtension, getExtension, getVersion, isExtensionListInDescription, setDescription, setExtensionListInDescription, setPattern
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accept
public static final java.lang.String EXTENSION
public static final java.lang.String COLUMNNAME
public static final int INCREMENT
public static final int DATAINCREMENT
protected static final int COLUMNNAMES
protected static final int UNITNAMES
protected static final int VALUES
protected static final double INVALID_AVL
protected static final double INVALID_VALUE
protected double invalidValue
protected java.util.HashMap messageListener
protected java.lang.String[] colNames
protected int colCounter
protected java.lang.String[] units
protected FwkSimpleASCIIColumnsReader.DataObserver[] observers
public FwkSimpleASCIIColumnsReader()
public void setAsInvalid(double val)
val
- public void addFwkMessageListener(FwkMessageListener fwkMessageListener)
fwkMessageListener
- the listenerpublic void removeFwkMessageListener(FwkMessageListener fwkMessageListener)
fwkMessageListener
- the listener.public FwkMessageListener[] getFwkMessageListeners()
protected void fireMessage(int lineNo, java.lang.String message)
message
- the message to be fired.protected void resetColumnNames()
protected java.lang.String addColumnName(java.lang.String name)
name
- the new column names.protected java.lang.String addUnit(int colNo, java.lang.String unit)
unit
- the name of the new unit.protected void addValue(int colno, double value)
colno
- The column number.val
- the new value.protected int getCount(int colno)
public int getSize()
public boolean accept(java.io.File f)
accept
in interface FwkFileFilterInterface
accept
in class FwkFileFilter
f
- The file to be checked.FwkFileFilter.getExtension(java.io.File)
,
FileFilter#accepts
public java.lang.String getDescription()
getDescription
in interface FwkFileFilterInterface
getDescription
in class FwkFileFilter
setDescription
,
setExtensionListInDescription
,
isExtensionListInDescription
,
FileFilter.getDescription()
public FwkColumnAccessInterface[] read(java.lang.String ref, java.io.InputStream is) throws FwkException
read
in interface FwkReadColumnsFromStreamInterface
ref
- The reference for input stream. This could be the file specification.is
- The input stream from that the column should be read.an
- exception when ever a problem occurs.FwkException
protected boolean isInvalid(java.lang.String s)
s
- a substring from parser.public static void main(java.lang.String[] args)