org.opentrafficsim.draw.egtf.EgtfEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ots-draw Show documentation
Show all versions of ots-draw Show documentation
OTS drawing classes that can paint themselves using data objects
The newest version!
package org.opentrafficsim.draw.egtf;
import java.util.EventObject;
/**
* EGTF event with progress and the ability to interrupt calculations.
*
* Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License.
*
* @author Wouter Schakel
*/
public class EgtfEvent extends EventObject
{
/** */
private static final long serialVersionUID = 20181008L;
/** Progress, a value in the range [0 ... 1]. */
private final double progress;
/**
* Constructor.
* @param egtf EGTF; egtf
* @param progress double; progress, a value in the range [0 ... 1]
*/
EgtfEvent(final Egtf egtf, final double progress)
{
super(egtf);
this.progress = progress;
}
/**
* Returns the progress, a value in the range [0 ... 1].
* @return double; progress, a value in the range [0 ... 1]
*/
public final double getProgress()
{
return this.progress;
}
/**
* Interrupts the filter. If a {@code filter()} calculation is ongoing, it will stop and return {@code null}.
*/
public final void interrupt()
{
((Egtf) getSource()).interrupt();
}
/** {@inheritDoc} */
@Override
public String toString()
{
return "EgtfEvent [progress=" + this.progress + "]";
}
}