E - the type of events.public class IndexedEventModel<E extends IndexedEvent<?>> extends AbstractIndexedEventModel<E,AbstractIndexedEventModel.Entry<E>>
IndexedEvent class and
 arranges incoming events into a list ordered by
 their source id
 and index. Note, that TimeSeriesEvent extends IndexedEvent in
 such a way, that this ordering also orders time-series event by time. However,
 there is a time-series aware class TimeSeriesEventModel that provides a more convenient way to
 subscribe to time-series.
 The model must be configured with symbol to subscribe for and
 attached to a DXFeed instance to start operation.
 
The view of the current list of events is available via getEventsList method.
 Model change notifications are provided via addListener
 method of this list. It accepts an instance of ObservableListModelListener class.
 
Users of this model only see the list of events in a consistent state. This model delays incoming events which
 are part of incomplete snapshot or ongoing transaction until snapshot is complete or transaction has ended.
 These pending events cannot be seen neither via list nor via listener calls, and so
 eventFlags of events in the model are set to zero.
 The eventFlags are only used and must be taken into account when processing indexed events directly via low-level
 DXFeedSubscription class.
 
Note, that it is not of much use to arrange Order events by their index,
 so there is a dedicated OrderBookModel that arranges buy and sell orders separately by their price.
 
dxFeed API comes with a set of samples. DXFeedTimeAndSales sample is a very simple UI application
 that shows how to use this model with TimeAndSale event, for example, concentrating your
 effort on data representation logic, while delegating all the data-handling logic to this model.
 It also showcases some of the advanced methods of this model like setSizeLimit.
 
 The convenient way to detach model from the feed is to call its close method. Closed model
 becomes permanently detached from all feeds, removes all its listeners and is guaranteed to be reclaimable by
 the garbage collector as soon as all external references to it are cleared.
 
attach, detach and close.
  You must query the state of attached model only from
 inside of the notification invocations or from within the thread that performs
 those notifications.
 
 Installed ObservableListModelListener instances are invoked from a separate thread via the executor.
 Default executor for all models is configured with DXEndpoint.executor
 method. Each model can individually override its executor with setExecutor
 method. The corresponding
 modelChanged
 notification is guaranteed to never be concurrent, even though it may happen from different
 threads if executor is multi-threaded.
 
In practice, it means that is UI applications you must
 install UI-thread-bound execution to your DXEndpoint via
 DXEndpoint.executor method, so that you
 can freely use all methods of this model from UI thread.
 
Custom executor can be used by backend applications that do not need to immediately update this model on
 arrival of new events, but want to update the model at a later time, for example, from inside of a servlet request.
 This approach is explained with code samples in
 Threads and locks
 section of DXFeedSubscription class documentation.
AbstractIndexedEventModel.Entry<V>| Constructor and Description | 
|---|
IndexedEventModel(Class<? extends E> eventType)
Creates new model. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
close()
Closes this model and makes it permanently detached. 
 | 
protected AbstractIndexedEventModel.Entry<E> | 
createEntry()
Creates new concrete entry to represent an event in this model. 
 | 
ObservableListModel<E> | 
getEventsList()
Returns the view of the current list of events in this model. 
 | 
protected void | 
modelChanged(List<AbstractIndexedEventModel.Entry<E>> changedEntries)
Invoked on the change of this model. 
 | 
attach, clear, detach, entryListIterator, get, getExecutor, getSizeLimit, getSymbol, isClosed, isSnapshotEnd, listIterator, listIterator, setExecutor, setSizeLimit, setSymbol, sizepublic IndexedEventModel(Class<? extends E> eventType)
AbstractIndexedEventModel.setSymbol(java.lang.Object) to specify subscription symbol and
 AbstractIndexedEventModel.attach(com.dxfeed.api.DXFeed) method to specify feed to start receiving events.eventType - the event type.NullPointerException - if event type is null.public void close()
This method ensures that model can be safely garbage-collected when all outside references to it are lost.
close in interface AutoCloseableclose in class AbstractIndexedEventModel<E extends IndexedEvent<?>,AbstractIndexedEventModel.Entry<E extends IndexedEvent<?>>>public ObservableListModel<E> getEventsList()
protected AbstractIndexedEventModel.Entry<E> createEntry()
This implementation creates an new instance of AbstractIndexedEventModel.Entry.
createEntry in class AbstractIndexedEventModel<E extends IndexedEvent<?>,AbstractIndexedEventModel.Entry<E extends IndexedEvent<?>>>protected void modelChanged(List<AbstractIndexedEventModel.Entry<E>> changedEntries)
changedEntries list
 have changed flag set to true and the new values of
 incoming events are available via Entry.getNewValue method.
 The changed flags is cleared
 after return from this method by Entry.commitChange method, which can also
 be invoked during this method, if needed.
 This implementation commits all changes and invokes
 ObservableListModelListener.modelChanged
 on all installed listeners.
modelChanged in class AbstractIndexedEventModel<E extends IndexedEvent<?>,AbstractIndexedEventModel.Entry<E extends IndexedEvent<?>>>changedEntries - the list of changed entries.Copyright © 2002–2023 Devexperts LLC. All rights reserved.