public abstract class ALcdTimeIndexedSimulatorModel extends ALcdSimulatorModel
Implementation of ILcdSimulatorModel whose time complexity for changing the date is generally related to the amount of changes that are required, not to the total amount of data. This offers high performance, even when working with large data sets.
It achieves this by indexing the begin and end times of all objects, so it does require some initial processing.
It keeps a given track model up to date by adding tracks to it, or by removing tracks
from it, such that every track is part of the model if the current date
lies within the interval
Subclasses are responsible to update the track state (e.g. location) when the date is
in that interval, by implementing the
Two methods are available to modify the data after the initial
processing step (
init(com.luciad.model.ILcdModel, java.util.Collection)). By using the method
addTracks(java.util.Set<?>, int), extra tracks can
be added to the simulator model. If necessary, when the current time is between the begin
and end time of a new track, these tracks will also be added to the
track model. By using the method
removeTracks(java.util.Set<?>, int), tracks can be removed from the
simulator model, and also from the track model if they are currently present there.
This implementation only supports one track model at a time. If multiple track models
must be updated, one can for example combine them using a
|Constructor and Description|
Creates a new
|Modifier and Type||Method and Description|
Adds the given set of tracks to the simulation model.
Retrieves the time the given track should start its simulation, for example the departure time of an airplane.
Retrieves the time the given track should end its simulation, for example the arrival time of an airplane.
Initializes this simulator model with the given tracks and track model.
Removes the given set of tracks from the simulation model.
Updates the given track for the given date.
Updates the track models of this
addPropertyChangeListener, firePropertyChangeEvent, getBeginDate, getDate, getEndDate, getTrackModels, removePropertyChangeListener, setBeginDate, setDate, setEndDate, setTrackModels
ALcdTimeIndexedSimulatorModel. One must call
initbefore this instance is useful.
protected void init(ILcdModel aEmptyTrackModel, java.util.Collection aTracks)
aEmptyTrackModel- The track model. It should not contain any elements as the objects in
aTracksare added to and removed from this model according to the current date of this simulator model.
aTracks- The track objects. Subclasses must implement the
updateTrackForDateSFCTmethods for these track objects.
updateTrackForDateSFCT(com.luciad.model.ILcdModel, Object, java.util.Date)
public void addTracks(java.util.Set<?> aTracks, int aFireEventMode)
aTracks- the tracks to add
aFireEventMode- the model fire event mode. This will be used when tracks are added to the actual track ILcdModel.
public void removeTracks(java.util.Set<?> aTracks, int aFireEventMode)
aTracks- the tracks to remove
aFireEventMode- the model fire event mode. This will be used when tracks are removed from the actual track ILcdModel.
protected abstract long getBeginTime(java.lang.Object aTrack)
aTrack- The track to retrieve the begin time for.
protected abstract long getEndTime(java.lang.Object aTrack)
aTrack- The track to retrieve the end time for.
protected abstract boolean updateTrackForDateSFCT(ILcdModel aTrackModel, java.lang.Object aTrackSFCT, java.util.Date aDate)
elementChangedon the model, it should simply return
truewhen the track is changed,
aTrackModel- The track model, passed as contextual information.
aTrackSFCT- The track to update.
aDate- The date to update the track to.
Trueif the track was adapted,
falseif the track was not adapted.
protected void updateTrackModels(java.util.Date aOldDate, java.util.Date aNewDate)
ALcdSimulatorModelto the given new
Date. This method is called by