Package io.deephaven.engine.util
Class ToMapListener<K,V>
java.lang.Object
- Type Parameters:
K
- the key typeV
- the value type
- All Implemented Interfaces:
LogOutputAppendable
,LivenessManager
,LivenessNode
,LivenessReferent
,TableListener
,TableUpdateListener
,NotificationQueue.Dependency
,Serializable
,Map<K,
V>
Listens to a table, mapping keys to values.
When you call get, we return the value as of the start of this clock cycle.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.deephaven.engine.table.impl.InstrumentedTableUpdateListener
InstrumentedTableUpdateListener.Notification
Nested classes/interfaces inherited from class io.deephaven.engine.table.impl.InstrumentedTableListenerBase
InstrumentedTableListenerBase.ErrorNotification, InstrumentedTableListenerBase.NotificationBase
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K extends Object,
V extends Object> Nested classes/interfaces inherited from interface io.deephaven.engine.table.TableListener
TableListener.Entry
-
Field Summary
Fields inherited from class io.deephaven.engine.table.impl.InstrumentedTableUpdateListenerAdapter
source
Fields inherited from class io.deephaven.engine.table.impl.InstrumentedTableListenerBase
failed
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
<T> T
<T> T
get
(K key, ColumnSource<T> cs) <T> T
get
(K key, LongFunction<T> valueProducer, LongFunction<T> prevValueProducer) Get but instead of applying the default value producer, use a custom value producer.boolean
isEmpty()
keySet()
static <K1,
V1> ToMapListener<K1, V1> make
(Table source, ColumnSource<K1> keySource, ColumnSource<V1> valueSource) static ToMapListener
static ToMapListener
static <K1,
V1> ToMapListener<K1, V1> make
(Table source, LongFunction<K1> keyProducer, LongFunction<K1> prevKeyProducer, LongFunction<V1> valueProducer, LongFunction<V1> prevValueProducer) void
onUpdate
(TableUpdate upstream) Process notification of table changes.void
int
size()
@NotNull Collection<V>
values()
Methods inherited from class io.deephaven.engine.table.impl.InstrumentedTableUpdateListenerAdapter
canExecute, destroy, onFailureInternal
Methods inherited from class io.deephaven.engine.table.impl.InstrumentedTableUpdateListener
getNotification
Methods inherited from class io.deephaven.engine.table.impl.InstrumentedTableListenerBase
append, getEntry, getErrorNotification, getUpdateGraph, onFailure, onFailureInternalWithDependent, satisfied, setVerboseLogging, toString
Methods inherited from class io.deephaven.engine.liveness.LivenessArtifact
manageWithCurrentScope
Methods inherited from class io.deephaven.engine.liveness.ReferenceCountedLivenessNode
getWeakReference, initializeTransientFieldsForLiveness, onReferenceCountAtZero, tryManage, tryUnmanage, tryUnmanage
Methods inherited from class io.deephaven.engine.liveness.ReferenceCountedLivenessReferent
dropReference, tryRetainReference
Methods inherited from class io.deephaven.util.referencecounting.ReferenceCounted
decrementReferenceCount, forceReferenceCountToZero, getReferenceCountDebug, incrementReferenceCount, resetReferenceCount, tryDecrementReferenceCount, tryIncrementReferenceCount
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.deephaven.engine.liveness.LivenessManager
manage, tryManage
Methods inherited from interface io.deephaven.engine.liveness.LivenessNode
tryUnmanage, tryUnmanage, unmanage, unmanage
Methods inherited from interface io.deephaven.engine.liveness.LivenessReferent
dropReference, getReferentDescription, getWeakReference, retainReference, tryRetainReference
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
Methods inherited from interface io.deephaven.engine.updategraph.NotificationQueue.Dependency
getUpdateGraph
Methods inherited from interface io.deephaven.engine.table.TableListener
getErrorNotification, onFailure
-
Method Details
-
make
-
make
-
make
public static <K1,V1> ToMapListener<K1,V1> make(Table source, ColumnSource<K1> keySource, ColumnSource<V1> valueSource) -
make
public static <K1,V1> ToMapListener<K1,V1> make(Table source, LongFunction<K1> keyProducer, LongFunction<K1> prevKeyProducer, LongFunction<V1> valueProducer, LongFunction<V1> prevValueProducer) -
onUpdate
Description copied from interface:TableUpdateListener
Process notification of table changes.The TableUpdateListener onUpdate call executes within the
UpdateGraph
refresh loop. Any tables used within the listener's onUpdate call must have already been refreshed. Using the typical pattern of a Listener that is listening to a single table, withTable.addUpdateListener(TableUpdateListener)
, this is trivially true.When the listener must reference more than just one parent, the tables (or other objects) it references, must be made a
NotificationQueue.Dependency
of the listener. For listeners that reference multiple ticking tables, a common pattern is to use a MergedListener and collection of ListenerRecorders.- Specified by:
onUpdate
in interfaceTableUpdateListener
- Specified by:
onUpdate
in classInstrumentedTableUpdateListenerAdapter
- Parameters:
upstream
- The set of upstream table updates.
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V>
-
get
-
get
public <T> T get(K key, groovy.lang.Closure<T> valueProducer, groovy.lang.Closure<T> prevValueProducer) -
get
-
get
Get but instead of applying the default value producer, use a custom value producer. The intention is that you can wrap the map up with several different value producers, e.g. one for bid and another for ask.- Type Parameters:
T
- the type of the value we are retrieving- Parameters:
key
- the key to retrievevalueProducer
- retrieve the current value out of the tableprevValueProducer
- retrieve the previous value out of the table- Returns:
- the value associated with key
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-