⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 distance.java

📁 JAVA版的蚂蚁算法(Ant Colony Optimization Algorithms)
💻 JAVA
字号:
package dk.itu.nulx30.util;

/**
 * This class extends <code>BinaryHeapElement</code> but is only a wrapperclass
 * which has exchanged the priority of the <code>BinaryHeapElement</code> with
 * a distance.
 *
 * @author  Mikkel Bundgaard
 * @author  Troels C. Damgaard
 * @author  Federico Decara
 * @author  Jacob W. Winther
 */
public class Distance extends BinaryHeapElement {

  /**
   * Class constructor specifying the distance (priority) and vertex (lookup index)
   * of this object.
   *
   * @param newDistance the distance (priority) of this object.
   * @param newVertex the vertex (lookup index) of this object.
   */
  public Distance( double newDistance, int newVertex ) {
    setPriority( newDistance );
    setIndex( newVertex );
  }
  
  /**
   * This method sets the distances (priority) of this element.
   *
   * @param newDistance the new distance of this object.
   */
  public void setDistance( double newDistance ) {
    setPriority( newDistance );
  }
  
  /**
   * This method returns the result of the getPriority method.
   *
   * @return the distance (priority) of this object.
   *
   * @see# BinaryHeapElement#getPriority()
   */
  public double getDistance() {
    return getPriority();
  }
  
  /**
   * Provides a string representation of this object consisting of 
   * the priority of the object.
   *
   * @return a string representation of the object.
   */
  public String toString() {
    return Double.toString( getPriority() );
  }
}


⌨️ 快捷键说明

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