edu.stanford.math.plex4.io
public class Table extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.ArrayList<java.lang.String> |
columnHeadings |
protected int |
numColumns |
protected int |
numRows |
protected java.util.ArrayList<java.util.ArrayList<java.lang.String>> |
rows |
protected java.lang.String |
title |
| Constructor and Description |
|---|
Table() |
| Modifier and Type | Method and Description |
|---|---|
void |
addColumn(java.lang.String columnHeading)
This function adds a new column to the table.
|
void |
addRow(java.util.Collection<java.lang.Object> row)
This function adds a data row to the table.
|
void |
addRow(java.util.List<java.lang.String> row)
This function adds a data row to the table.
|
void |
addRow(java.lang.String[] row,
boolean trimElements)
This function adds a data row to the table.
|
java.lang.String |
getColumnHeading(int column)
This function returns the heading of the specified column.
|
java.lang.String |
getEntry(int row,
int column)
This function returns the entry in the table located at (row, column).
|
java.lang.String |
getTitle()
This function returns the title of the table.
|
void |
setColumnHeading(int column,
java.lang.String columnHeading)
This function sets the heading of the specified column.
|
void |
setTitle(java.lang.String title)
This function sets the title of the table.
|
java.lang.String |
toCSVString(java.lang.String separator,
boolean includeTitle,
boolean includeHeadings)
This function creates a string holding the contents of the table in comma
separated format.
|
java.lang.String |
toPrettyString(java.lang.String separator)
This function returns a string holding the contents of the table.
|
java.lang.String |
toString()
This function returns the string representation of the table.
|
protected java.lang.String title
protected int numColumns
protected int numRows
protected java.util.ArrayList<java.lang.String> columnHeadings
protected java.util.ArrayList<java.util.ArrayList<java.lang.String>> rows
public void setTitle(java.lang.String title)
title - the title to set topublic java.lang.String getTitle()
public void addColumn(java.lang.String columnHeading)
columnHeading - the name of the column to addpublic void setColumnHeading(int column,
java.lang.String columnHeading)
column - the index of the columncolumnHeading - the new heading of the columnpublic java.lang.String getColumnHeading(int column)
column - the index of the columnpublic void addRow(java.util.Collection<java.lang.Object> row)
row - a collection containing the data to addpublic void addRow(java.util.List<java.lang.String> row)
row - a collection containing the data to addpublic void addRow(java.lang.String[] row,
boolean trimElements)
row - a collection containing the data to addpublic java.lang.String getEntry(int row,
int column)
row - the row of the entrycolumn - the column of the entrypublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toCSVString(java.lang.String separator,
boolean includeTitle,
boolean includeHeadings)
separator - the separator between each columnincludeTitle - if true, then the title is also printedincludeHeadings - if true, then the headings are printedpublic java.lang.String toPrettyString(java.lang.String separator)