Package org.eclipse.scanning.api.malcolm
Class MalcolmTable
java.lang.Object
org.eclipse.scanning.api.malcolm.MalcolmTable
Class representing a table in Malcolm Format (List of columns with data).
Instances of this class are NOT thread safe.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionMalcolmTable(LinkedHashMap<String, Class<?>> dataTypes) Creates a new empty table with columns of the given types.MalcolmTable(LinkedHashMap<String, List<?>> tableAsMap, LinkedHashMap<String, Class<?>> dataTypes) Create a new Malcolm table with the given columns data and data types. -
Method Summary
Modifier and TypeMethodDescription<T> voidbooleangetCellValue(String columnName, int rowIndex) <T> List<T> Class<?> getColumnClass(String columnName) intgetRow(int rowIndex) LinkedHashMap<String, Class<?>> inthashCode()booleanisEmpty()iterator()Returns an iterator over the rows of the table, where each row is represented as aMapfrom a column name (a String) to a value.voidsetHeadings(List<String> headings) voidsetNumRows(int numRows) voidsetTableData(LinkedHashMap<String, List<?>> tableData) voidsetTableDataTypes(LinkedHashMap<String, Class<?>> tableDataTypes) stream()Returns a stream of the rows of the table, where each row is represented as aMapfrom a column name (a String) to a value.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
MalcolmTable
public MalcolmTable() -
MalcolmTable
public MalcolmTable(LinkedHashMap<String, List<?>> tableAsMap, LinkedHashMap<String, Class<?>> dataTypes) Create a new Malcolm table with the given columns data and data types. The size of each column must be equal, and the keys of both maps must be the same, these are the column headings.The passed maps are required to be
LinkedHashMaps as the order of the columns must be maintained when the table is serialized- Parameters:
tableAsMap- a list of values for each column, of equal lengthsdataTypes- a map of the data types for each column, this map must have the same keys as the tableAsMap
-
MalcolmTable
Creates a new empty table with columns of the given types.- Parameters:
dataTypes- map from column name to data type for that column
-
-
Method Details
-
getColumn
-
getColumnClass
-
getRow
-
getCellValue
-
getHeadings
-
addRow
-
iterator
Returns an iterator over the rows of the table, where each row is represented as aMapfrom a column name (a String) to a value. -
stream
Returns a stream of the rows of the table, where each row is represented as aMapfrom a column name (a String) to a value.- Returns:
- stream of table rows
-
getTableData
-
setTableData
-
getTableDataTypes
-
setTableDataTypes
-
getNumRows
public int getNumRows() -
setNumRows
public void setNumRows(int numRows) -
isEmpty
public boolean isEmpty() -
setHeadings
-
hashCode
public int hashCode() -
equals
-
toString
-