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 /** {@inheritDoc} */ 24 @Override 25 public Time getTime() 26 { 27 return Time.instantiateSI(Double.MAX_VALUE); 28 } 29 30 /** {@inheritDoc} */ 31 @Override 32 public void cancelEvent(final AbstractPlot abstractPlot) 33 { 34 // no action required 35 } 36 37 /** {@inheritDoc} */ 38 @Override 39 public void scheduleUpdate(final Time time, final AbstractPlot abstractPlot) 40 { 41 // no action required 42 } 43 }; 44 45 /** 46 * Returns the time. 47 * @return Time; time. 48 */ 49 Time getTime(); 50 51 /** 52 * Cancel event on plot. 53 * @param abstractPlot AbstractPlot; plot. 54 */ 55 void cancelEvent(AbstractPlot abstractPlot); 56 57 /** 58 * Schedule {@code update()} call on abstractPlot 59 * @param time Time; time. 60 * @param abstractPlot AbstractPlot; plot. 61 */ 62 void scheduleUpdate(Time time, AbstractPlot abstractPlot); 63 64 }