binaryheapelement.java
来自「JAVA版的蚂蚁算法(Ant Colony Optimization Algor」· Java 代码 · 共 58 行
JAVA
58 行
package dk.itu.nulx30.util;
/**
* This abstract class is the superclass for all elements in the binary heap.
* So all elements in the binary heap must extend this class.
*
* @author Mikkel Bundgaard
* @author Troels C. Damgaard
* @author Federico Decara
* @author Jacob W. Winther
*
* @see BinaryHeap
*/
public abstract class BinaryHeapElement {
/** The priority of this element */
private double priority;
/** The index of this element */
private int index;
/**
* This method is an accessor method for <code>priority</code>.
*
* @return the value of <code>priority</code>.
*/
public double getPriority() {
return priority;
}
/**
* <code>setPriority</code> is an mutator method for <code>priority</code>.
*
* @param newVal the new value for <code>priority</code>.
*/
public void setPriority( double newVal ) {
priority = newVal;
}
/**
* This method is an accessor method for <code>index</code>.
*
* @return the value of <code>index</code>.
*/
public int getIndex() {
return index;
}
/**
* <code>setIndex</code> is an mutator method for <code>index</code>.
*
* @param newVal the new value for <code>index</code>.
*/
public void setIndex( int newVal ) {
index = newVal;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?