java.lang.Object
org.bonej.utilities.SharedTable
Stores a
Table, which is ordered according to the following rules:
- Each row has a header label, which tells you which image was measured, e.g. "bat-cochlea-volume.tif"
- Each column has a header, which tells you the type of the measurement, e.g. "Volume"
- If there are no rows with the given label, then add a new row
- If there are rows with the given label, but there is not a column with the given heading, then append a column, and set its value on the last row with the label.
- If there are rows with the given label, and there's a column with the
given heading, then find the last empty cell (equals
EMPTY_CELL), and add the new value there. If there are no empty cells, then append a new row. - Labels and columns are kept in the order in which they were produced.
- Author:
- Richard Domander, Michael Doube
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DoubleSentinel value indicating an empty cell in the table. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdds new value as aDoubleto the shared tablestatic voidAdds new value as aDoubleto the shared table.static voidAdds new data to the shared table according to the shared table policy.getTable()Gets a copy of the singletonTable.static booleanhasData()Checks whether the table contains any non-null data values.static voidreset()Initializes the table into a new empty table
-
Field Details
-
EMPTY_CELL
Sentinel value indicating an empty cell in the table.
-
-
Method Details
-
add
Adds new value as aDoubleto the shared table.- Parameters:
label- the row label of the new data.header- the column heading of the new data.value- the value of the new data.- See Also:
-
add
Adds new value as aDoubleto the shared table- Parameters:
label- the row label of the new data.header- the column heading of the new data.value- the value of the new data.- See Also:
-
add
Adds new data to the shared table according to the shared table policy.- Parameters:
label- the row label of the new data.header- the column heading of the new data.value- the value of the new data.- Throws:
NullPointerException- if value == null
-
getTable
Gets a copy of the singletonTable.Returns the same copy instance on every call. However, the contents of the copy table are always cleared and copied from the actual table. That is, if you've modified the copy after the previous call, those modifications are lost.
- Returns:
- the persistent copy instance.
-
hasData
public static boolean hasData()Checks whether the table contains any non-null data values.- Returns:
trueif at least one cell contains a non-null value,falseotherwise
-
reset
public static void reset()Initializes the table into a new empty table
-