1 package org.opentrafficsim.core.egtf; 2 3 import java.util.EventObject; 4 5 /** 6 * EGTF event with progress and the ability to interrupt calculations. 7 * <p> 8 * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 9 * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>. 10 * <p> 11 * @version $Revision$, $LastChangedDate$, by $Author$, initial version 8 okt. 2018 <br> 12 * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a> 13 */ 14 public class EgtfEvent extends EventObject 15 { 16 17 /** */ 18 private static final long serialVersionUID = 20181008L; 19 20 /** Progress, a value in the range [0 ... 1]. */ 21 private final double progress; 22 23 /** 24 * Constructor. 25 * @param egtf EGTF; egtf 26 * @param progress double; progress, a value in the range [0 ... 1] 27 */ 28 EgtfEvent(final EGTF egtf, final double progress) 29 { 30 super(egtf); 31 this.progress = progress; 32 } 33 34 /** 35 * Returns the progress, a value in the range [0 ... 1]. 36 * @return double; progress, a value in the range [0 ... 1] 37 */ 38 public final double getProgress() 39 { 40 return this.progress; 41 } 42 43 /** 44 * Interrupts the filter. If a {@code filter()} calculation is ongoing, it will stop and return {@code null}. 45 */ 46 public final void interrupt() 47 { 48 ((EGTF) getSource()).interrupt(); 49 } 50 51 /** {@inheritDoc} */ 52 @Override 53 public String toString() 54 { 55 return "EgtfEvent [progress=" + this.progress + "]"; 56 } 57 58 }