Class AssociativeDataSwappableTable<KEY,VALUE,VALUECOLUMN>
java.lang.Object
com.illumon.iris.db.plot.datasets.data.AssociativeData<KEY,VALUE>
com.illumon.iris.db.plot.datasets.data.LiveAssociativeData<KEY,VALUE,VALUECOLUMN>
com.illumon.iris.db.plot.datasets.data.AssociativeDataSwappableTable<KEY,VALUE,VALUECOLUMN>
- All Implemented Interfaces:
PlotExceptionCause
,SwappableTable.LocalTableUpdateListener
,Serializable
public class AssociativeDataSwappableTable<KEY,VALUE,VALUECOLUMN> extends LiveAssociativeData<KEY,VALUE,VALUECOLUMN> implements SwappableTable.LocalTableUpdateListener
An
AssociativeData
dataset backed by a SwappableTable
. Table columns hold the keys and
associated values.
Data types are specified in construction.- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description AssociativeDataSwappableTable(DataChangeListener dataChangeListener, SwappableTable swappableTable, String keyColumn, String valueColumn, Class<KEY> keyColumnType, Class<VALUECOLUMN> valueColumnType, PlotInfo plotInfo)
Creates an AssociativeDataSwappableTable instance. -
Method Summary
Modifier and Type Method Description VALUE
get(KEY key)
Gets the value associated with the keyboolean
isModifiable()
Whether the dataset is modifiable.void
onClose()
Tear down once a figure is removed.void
onLocalTableUpdate(Table localTable)
Updates this listener with the new table.void
put(KEY key, VALUE value)
Adds the key-value pair to the dataset.<K extends KEY, V extends VALUE>
voidputAll(Map<K,V> values)
Adds all key-value pairs in the map to the dataset.AssociativeData<KEY,VALUE>
snapshot()
Methods inherited from class com.illumon.iris.db.plot.datasets.data.LiveAssociativeData
constructSnapshot, convert
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.illumon.iris.db.plot.util.tables.SwappableTable.LocalTableUpdateListener
onInitialSnapshot
-
Constructor Details
-
AssociativeDataSwappableTable
public AssociativeDataSwappableTable(DataChangeListener dataChangeListener, SwappableTable swappableTable, String keyColumn, String valueColumn, Class<KEY> keyColumnType, Class<VALUECOLUMN> valueColumnType, PlotInfo plotInfo)Creates an AssociativeDataSwappableTable instance. TheswappableTable
must have had a lastBy applied! Keys are held in thekeyColumn
ofswappableTable
. Their associated values are held in thevalueColumn
. The data type of the keys is specified bykeyColumnType
. The data type of the values is specified byvalueColumnType
.- Parameters:
dataChangeListener
- listener for data changes in this seriesswappableTable
- table. Must have a lastBy applied.keyColumn
- column inswappableTable
which holds the key valuesvalueColumn
- column inswappableTable
which holds the values associated with the keyskeyColumnType
- data type of the keysvalueColumnType
- data type of the valuesplotInfo
- plot information- Throws:
com.fishlib.base.verify.RequirementFailure
-swappableTable
,keyColumn
, andvalueColumn
must not be nullIllegalArgumentException
-keyColumn
andvalueColumn
must be columns inswappableTable
RuntimeException
- the specified data types must match the data types of the corresponding columns
-
-
Method Details
-
onLocalTableUpdate
Description copied from interface:SwappableTable.LocalTableUpdateListener
Updates this listener with the new table.- Specified by:
onLocalTableUpdate
in interfaceSwappableTable.LocalTableUpdateListener
- Parameters:
localTable
- table
-
get
Description copied from class:AssociativeData
Gets the value associated with the key- Specified by:
get
in classAssociativeData<KEY,VALUE>
- Parameters:
key
- key- Returns:
- value associated with the key
-
isModifiable
public boolean isModifiable()Description copied from class:AssociativeData
Whether the dataset is modifiable.- Specified by:
isModifiable
in classAssociativeData<KEY,VALUE>
- Returns:
- true if the dataset is modifiable, false if not
-
put
Description copied from class:AssociativeData
Adds the key-value pair to the dataset.- Specified by:
put
in classAssociativeData<KEY,VALUE>
- Parameters:
key
- keyvalue
- value
-
putAll
Description copied from class:AssociativeData
Adds all key-value pairs in the map to the dataset.- Specified by:
putAll
in classAssociativeData<KEY,VALUE>
- Type Parameters:
K
- type of the keys invalues
V
- type of the values invalues
- Parameters:
values
- keypair map
-
onClose
public void onClose()Description copied from class:AssociativeData
Tear down once a figure is removed.- Overrides:
onClose
in classAssociativeData<KEY,VALUE>
-
snapshot
- Specified by:
snapshot
in classLiveAssociativeData<KEY,VALUE,VALUECOLUMN>
-