package SimkitOpenDis7Examples; import simkit.random.RandomVariate; /** * Model a ship arrival process * @author abuss@nps.edu */ public class ShipArrivalProcess extends ArrivalProcess { /** * Generates the initial unloading times for the Ships */ private RandomVariate unloadTimeGenerator; /** * Zero-argument constructor */ public ShipArrivalProcess() { } /** * Instance constructor * @param interarrivalTimeGenerator Given generator for interarrival times * @param unloadTimeGenerator Given generator for total unloading times */ public ShipArrivalProcess( RandomVariate interarrivalTimeGenerator, RandomVariate unloadTimeGenerator) { this(); this.setInterarrivalTimeGenerator(interarrivalTimeGenerator); this.setUnloadTimeGenerator(unloadTimeGenerator); } /** * Instantiate a new Ship and Schedule Arrival(Ship) */ @Override public void doArrival() { super.doArrival(); Ship ship = new Ship(unloadTimeGenerator.generate()); waitDelay("Arrival", 0.0, ship); } /** * accessor method to get a state variable * @return the unloadTimeGenerator */ public RandomVariate getUnloadTimeGenerator() { return unloadTimeGenerator; } /** * accessor method to set a state variable * @param unloadTimeGenerator the unloadTimeGenerator to set */ public void setUnloadTimeGenerator(RandomVariate unloadTimeGenerator) { this.unloadTimeGenerator = unloadTimeGenerator; } }