private class HistoryPanel.ColumnDatum extends java.lang.Object implements java.lang.Comparable<HistoryPanel.ColumnDatum>
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
m_text
Text value of this row/column cell.
|
private int |
m_type
Calculated data type.
|
private java.lang.Float |
m_value
Numeric value of this row/column cell.
|
private static int |
NUMERIC
Code for numeric data type.
|
private static int |
TEXT
Code for text data type.
|
private static int |
UNKNOWN
Code for unknown data type.
|
Constructor and Description |
---|
HistoryPanel.ColumnDatum(int index,
java.lang.String text)
Creates a new instance of this column data.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(HistoryPanel.ColumnDatum other)
Compares other row/column cell value with this one.
|
int |
getType()
Determines the data type of this row/column cell.
|
java.lang.String |
toString()
Returns the text value of this row/column cell.
|
private static final int UNKNOWN
private static final int TEXT
private static final int NUMERIC
private int m_type
private java.lang.String m_text
private java.lang.Float m_value
public HistoryPanel.ColumnDatum(int index, java.lang.String text)
index
- column data index. Column zero (time) is always
TEXT
. Determining this now prevents a later flurry of
NumberFormatException
for a known data type.text
- value of this column.public int getType()
UNKNOWN
, attempts to instantiate a
Float
from the text data. If this is successful, the
data type is assumed to be
NUMERIC
. If the
Float
constructor throws a
NumberFormatException
, the type is assumed to be
TEXT
. The type is stored so the type is not
UNKNOWN
for the next comparison.NUMERIC
or TEXT
.public int compareTo(HistoryPanel.ColumnDatum other)
compareTo
in interface java.lang.Comparable<HistoryPanel.ColumnDatum>
other
- column value to compare.public java.lang.String toString()
toString
in class java.lang.Object