eventupdatedijkstra.java

来自「JAVA版的蚂蚁算法(Ant Colony Optimization Algor」· Java 代码 · 共 38 行

JAVA
38
字号
package dk.itu.nulx30.eventSimulation;

import dk.itu.nulx30.networkModel.DijkstraRouting;

/**
 * This event calls the method <code>updateRoutingTable</code> on the
 * routing-algorithm if it is of the same instance as <code>DijkstraRouting</code>.
 *
 * @author Jacob Wahl Winther
 * @author Mikkel Bundgaard
 * @author Troels C. Damgaard
 * @author Federico Decara
 */
public class EventUpdateDijkstra extends Event {
  /** the simulation in which this event has occured*/
  private EventSimulation sim;

  /**
   * Class constructor for <code>EventUpdateDijkstra</code> which takes a time
   * and an <code>EventSimulation</code> as argument
   *
   * @param time the time when this event is about to occur
   * @param sim the simulation in which this event has occured
   */
  public EventUpdateDijkstra( double time, EventSimulation sim ) {
    super( time );
    this.sim = sim;
  }

  /**
   * Execute this event's method
   */
  public void doEvent() {
    if ( sim.getRoutingAlgorithm() instanceof DijkstraRouting ){
      ( ( DijkstraRouting ) sim.getRoutingAlgorithm() ).updateRoutingTable();
    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?