1 package org.opentrafficsim.draw.graphs;
2
3 import org.djunits.value.vdouble.scalar.Time;
4
5 /**
6 * Interface between plots (subclasses of {@code AbstractPlot}) and some source that knows about time in the context, e.g. a
7 * simulator, or a data loader which knows all time has past. For offline purposes, {@code PlotScheduler.OFFLINE} can be used.
8 * <p>
9 * Copyright (c) 2023-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
10 * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
11 * </p>
12 * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
13 */
14 public interface PlotScheduler
15 {
16
17 /**
18 * Default offline scheduler. This will only provide an infinite time, causing {@code increaseTime()} to be invoked on all
19 * plots once.
20 */
21 PlotScheduler OFFLINE = new PlotScheduler()
22 {
23 @Override
24 public Time getTime()
25 {
26 return Time.instantiateSI(Double.MAX_VALUE);
27 }
28
29 @Override
30 public void cancelEvent(final AbstractPlot abstractPlot)
31 {
32 // no action required
33 }
34
35 @Override
36 public void scheduleUpdate(final Time time, final AbstractPlot abstractPlot)
37 {
38 // no action required
39 }
40 };
41
42 /**
43 * Returns the time.
44 * @return time.
45 */
46 Time getTime();
47
48 /**
49 * Cancel event on plot.
50 * @param abstractPlot plot.
51 */
52 void cancelEvent(AbstractPlot abstractPlot);
53
54 /**
55 * Schedule {@code update()} call on abstractPlot
56 * @param time time.
57 * @param abstractPlot plot.
58 */
59 void scheduleUpdate(Time time, AbstractPlot abstractPlot);
60
61 }