com.jeffpalm.stats
Class DefaultTable2D
java.lang.Object
com.jeffpalm.stats.DefaultTable2D
- All Implemented Interfaces:
- Table2D
public class DefaultTable2D
- extends java.lang.Object
- implements Table2D
A default implementation of the Table2D interface.
Right now all of my tables are these.
- Author:
- Jeffrey Palm
Method Summary |
void |
addColumn(java.lang.String colName,
java.util.List values)
|
void |
addRow(java.util.List row)
|
java.lang.String |
commas()
|
java.lang.String |
format()
|
java.lang.String |
format(Formatter.Format f)
|
java.util.List |
getColumn(int col)
|
java.util.List |
getColumn(java.lang.String colName)
|
int |
getColumnCount()
|
java.util.List |
getColumnData(int col)
|
java.util.List |
getColumnData(java.lang.String col)
|
java.lang.String |
getColumnName(int row)
|
java.util.List |
getColumnNames()
|
java.util.List |
getRow(int row)
|
int |
getRowCount()
|
java.util.List |
getRows()
|
java.lang.Object |
getValueAt(int row,
int col)
|
java.lang.Object |
getValueAt(int row,
java.lang.String col)
|
java.lang.Object |
getValueFor(java.util.List row,
int col)
|
java.lang.Object |
getValueFor(java.util.List row,
java.lang.String col)
|
java.lang.String |
html()
|
boolean |
isEmpty()
|
void |
resizeRows()
|
void |
setCaseInsensitive(boolean isCaseInsensitive)
|
void |
setOnlyEqualLengthRows(boolean onlyEqualLengthRows)
|
void |
setTitle(java.lang.String title)
|
void |
setValueAt(java.lang.Object value,
int row,
int col)
|
void |
setValueAt(java.lang.Object value,
int row,
java.lang.String col)
|
void |
sort(int col)
|
void |
sort(int col,
boolean reverse)
|
void |
sort(java.lang.String sort)
Same as the two argument sort, but will strip off a
! from sort , and reverse the sort
if there was a ! |
void |
sort(java.lang.String sort,
boolean reverse)
Sorts the table by the column name sort , and
reverse the sort is reverse . |
java.util.Map |
split(java.lang.String colName,
Buckets.Getter getter)
|
java.util.Map |
split(java.lang.String colName,
java.lang.Class tableGetterClass,
double step)
|
java.util.Map |
split(java.lang.String colName,
double step)
|
java.util.List |
toLists()
|
java.util.List |
toLists(boolean withColumns)
|
java.lang.String |
toString()
|
double |
traverse(int col,
DefaultTable2D.Operation op)
|
double |
traverse(java.lang.String colName,
DefaultTable2D.Operation op)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
DefaultTable2D
public DefaultTable2D(java.util.Collection colNames)
DefaultTable2D
public DefaultTable2D(java.lang.String[] colNames)
DefaultTable2D
public DefaultTable2D()
setCaseInsensitive
public final void setCaseInsensitive(boolean isCaseInsensitive)
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in interface Table2D
getColumnName
public java.lang.String getColumnName(int row)
- Specified by:
getColumnName
in interface Table2D
getRowCount
public int getRowCount()
- Specified by:
getRowCount
in interface Table2D
getValueAt
public java.lang.Object getValueAt(int row,
int col)
- Specified by:
getValueAt
in interface Table2D
setValueAt
public void setValueAt(java.lang.Object value,
int row,
int col)
- Specified by:
setValueAt
in interface Table2D
getRow
public java.util.List getRow(int row)
- Specified by:
getRow
in interface Table2D
getColumn
public java.util.List getColumn(java.lang.String colName)
- Specified by:
getColumn
in interface Table2D
getColumn
public java.util.List getColumn(int col)
- Specified by:
getColumn
in interface Table2D
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface Table2D
traverse
public double traverse(java.lang.String colName,
DefaultTable2D.Operation op)
traverse
public double traverse(int col,
DefaultTable2D.Operation op)
setOnlyEqualLengthRows
public final void setOnlyEqualLengthRows(boolean onlyEqualLengthRows)
resizeRows
public final void resizeRows()
setTitle
public final void setTitle(java.lang.String title)
addColumn
public void addColumn(java.lang.String colName,
java.util.List values)
addRow
public void addRow(java.util.List row)
getRows
public java.util.List getRows()
getValueAt
public java.lang.Object getValueAt(int row,
java.lang.String col)
getValueFor
public java.lang.Object getValueFor(java.util.List row,
java.lang.String col)
setValueAt
public void setValueAt(java.lang.Object value,
int row,
java.lang.String col)
getValueFor
public java.lang.Object getValueFor(java.util.List row,
int col)
getColumnNames
public java.util.List getColumnNames()
getColumnData
public java.util.List getColumnData(java.lang.String col)
getColumnData
public java.util.List getColumnData(int col)
format
public java.lang.String format(Formatter.Format f)
format
public java.lang.String format()
split
public java.util.Map split(java.lang.String colName,
double step)
split
public java.util.Map split(java.lang.String colName,
java.lang.Class tableGetterClass,
double step)
throws java.lang.Exception
- Throws:
java.lang.Exception
split
public java.util.Map split(java.lang.String colName,
Buckets.Getter getter)
toLists
public java.util.List toLists()
toLists
public java.util.List toLists(boolean withColumns)
commas
public java.lang.String commas()
html
public java.lang.String html()
throws java.lang.Exception
- Throws:
java.lang.Exception
sort
public void sort(int col,
boolean reverse)
sort
public void sort(int col)
sort
public void sort(java.lang.String sort,
boolean reverse)
- Sorts the table by the column name
sort
, and
reverse the sort is reverse
.
- Parameters:
sort
- The column name with which to sort.reverse
- Whether to reverse the sort.
sort
public void sort(java.lang.String sort)
- Same as the two argument sort, but will strip off a
!
from sort
, and reverse the sort
if there was a !
- Parameters:
sort
- The sort used to sort. If it contains
a !
in the front we'll strip that
off, and the resulting sort will be reversed.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object