|
DataFile 1.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.infomata.data.DataRow
Object representing collection of data items contained within one line of the data file
Constructor Summary | |
DataRow()
Creates a new DataRow instance. |
|
DataRow(java.text.NumberFormat format)
Creates a new DataRow instance. |
Method Summary | |
void |
add(double datum)
Adds a double datum to the next location. |
void |
add(int datum)
Adds an int datum to the next location. |
void |
add(long datum)
Adds a long datum to the next location. |
void |
add(java.lang.Object obj)
Adds an object with toString()
method defined to the next item. |
void |
add(java.lang.String datum)
Adds a String datum to the next location |
void |
addEmpty()
Adds an empty item (spacer) |
void |
clear()
Remove the content of DataRow. |
java.util.Date |
getDate(int location,
java.lang.String pattern)
Retrieves the date using the specified pattern to parse the date. |
java.util.Date |
getDate(java.lang.String label,
java.lang.String pattern)
Retrieves the date corresponding to the specified column label . |
double |
getDouble(int location)
Retrieves the double value of the datum contained in the specified location. |
double |
getDouble(int location,
java.text.DecimalFormat format,
double defaultVal)
Retrieves the double value at specified
location parsed using format . |
double |
getDouble(int location,
double defaultVal)
Retrieves the double value of the datum contained in the specified location. |
double |
getDouble(java.lang.String label)
Retrieve the double value contained
in data cell corresponding to the specified column
label |
double |
getDouble(java.lang.String label,
double defaultVal)
Retrieve the double value contained
in data cell corresponding to the specified column
label . |
int |
getInt(int location)
Retrieves the int value of the datum contained in the specified location. |
int |
getInt(int location,
java.text.DecimalFormat format,
int defaultVal)
Retrieves the int value at specified
location parsed using format . |
int |
getInt(int location,
int defaultVal)
Retrieves the int value of the datum contained in the specified location. |
int |
getInt(java.lang.String label)
Retrieves the int value of the datum contained under specified column label . |
int |
getInt(java.lang.String label,
int defaultVal)
Retrieves the int value under the specified
column label . |
java.sql.Date |
getSqlDate(int location,
java.lang.String pattern)
Retrieve the date value at the specified location in specified pattern
as an instance of java.sql.Date
instead of java.util.Date . |
java.lang.String |
getString(int location)
Retrieves the String value contained in the specified location. |
java.lang.String |
getString(int location,
java.lang.String defaultVal)
Retrieves the String value contained in the specified location or defaultVal if it
does not. |
java.lang.String |
getString(java.lang.String label)
Retrieves the String value located
under specified column label . |
java.lang.String |
getString(java.lang.String label,
java.lang.String defaultVal)
Retrieves the String value contained
under the specified column label . |
java.util.Iterator |
iterator()
Retrieves an iterator for items |
int |
size()
Retrieves the number of location in row. |
java.lang.String |
toString()
For debugging purpose. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public DataRow()
DataRow
instance.
Uses JVM's locale for formatting numbers.
public DataRow(java.text.NumberFormat format)
DataRow
instance.
Uses specified NumberFormat object to read
or write numbers.
format
- a NumberFormat
objectMethod Detail |
public void add(java.lang.String datum)
datum
- String datum itempublic void add(int datum)
datum
- int datum itempublic void add(long datum)
datum
- a long
valuepublic void add(double datum)
datum
- a double
valuepublic void add(java.lang.Object obj)
toString()
method defined to the next item.
obj
- an Object
with
toString()
defined.public void addEmpty()
public java.util.Iterator iterator()
Iterator
public java.util.Date getDate(int location, java.lang.String pattern)
java.text.SimpleDateFormat
documentation valid date format patterns.
location
- locationg of the itempattern
- date format pattern (i.e. "yyyy.MM.dd" for 2002.10.20")
public java.sql.Date getSqlDate(int location, java.lang.String pattern)
location
in specified pattern
as an instance of java.sql.Date
instead of java.util.Date
.
location
- location of date valuepattern
- format of the date value in the data file
java.sql.Date
instance representing
the date at location
.public java.util.Date getDate(java.lang.String label, java.lang.String pattern)
label
.
label
- column labelpattern
- see SimpleDateFormat
for
further description on pattern syntax.
Date
value under specified column label.public double getDouble(int location) throws java.lang.NumberFormatException
location
- location of the item
double
value
java.lang.NumberFormatException
- if the item cannot be parsed using normal
number parser.public double getDouble(java.lang.String label) throws java.lang.NumberFormatException
double
value contained
in data cell corresponding to the specified column
label
label
- column label
double
value
java.lang.NumberFormatException
- if the value cannot be parsed
correctly.public double getDouble(int location, double defaultVal)
location
- location of the item.defaultVal
- default value to use when value does not
exist or fails to parse correctly.
double
valuepublic double getDouble(int location, java.text.DecimalFormat format, double defaultVal)
double
value at specified
location
parsed using format
.
If the value does not exist or fails to parse into
double
, defaultVal
is returned.
location
- location of double
valueformat
- double value parser to be used in extracting
item.defaultVal
- default value to use in case of missing data or
parse error.
location
or defaultVal
public double getDouble(java.lang.String label, double defaultVal)
double
value contained
in data cell corresponding to the specified column
label
.
label
- column labeldefaultVal
- default value to use when value does not
exist or does not parse correctly.
double
value corresponding to the
specified column label
. If the
specified column label
does not
exist or the value cannot parsed into a
double
, defaultValu
.public int getInt(int location) throws java.lang.NumberFormatException
location
- location of the item.
int
at the specified location
.
java.lang.NumberFormatException
- if the value at specified location
cannot parsed into an int
public int getInt(java.lang.String label) throws java.lang.NumberFormatException
label
.
label
- column label
int
value
java.lang.NumberFormatException
- if specified column label
does not exist or the value cannot parsed into an
int
public int getInt(int location, int defaultVal)
location
- location of the item.defaultVal
- default value to use when value does not exist.
int
valuepublic int getInt(int location, java.text.DecimalFormat format, int defaultVal)
int
value at specified
location
parsed using format
.
If the value does not exist or fails to parse into
int
, defaultVal
is returned.
location
- location of int
valueformat
- int
value parser to be used in extracting
item.defaultVal
- default value to use in case of missing data or
parse error.
int
value at specified location
or the defaultVal
public int getInt(java.lang.String label, int defaultVal)
int
value under the specified
column label
.
label
- column label (header)defaultVal
- default value to use when value does not exist.
int
value corresponding to the
specified column label
.
If the specified column label
does not exist or cannot be convert into an
int
default value is returned.public java.lang.String getString(int location)
location
- an int
value
String
value or emty String
if specified location does not exist. (never
returns null)public java.lang.String getString(java.lang.String label)
String
value located
under specified column label
.
label
- column label
String
value corresponding
to specified column label
. If the column
does not exist, empty String
is returned.public java.lang.String getString(int location, java.lang.String defaultVal)
defaultVal
if it
does not.
location
- location of the item (starts at zero)defaultVal
- default value to use when the
does not contain a value.
String
value at specified
location
. If the value does not
exist, defaultVal
is returned.public java.lang.String getString(java.lang.String label, java.lang.String defaultVal)
String
value contained
under the specified column label
.
label
- column labeldefaultVal
- default value to return when value does not
exist or label
fails to match
any of the column names in header row.
String
value corresponding to specified
column label
. If no such column exists
or the value is empty, devaultVal
is
returned.public int size()
DataRow
public java.lang.String toString()
public void clear()
|
DataFile 1.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |