listedges.java
来自「Dijkstra algorithm in Java.」· Java 代码 · 共 70 行
JAVA
70 行
/*
* ListEdges.java
*
* Created on May 29, 2007, 11:00 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package termproject_dijkstra;
public class ListEdges
{
ListEdgesElement head;
ListEdgesElement travPointer; // For traversing list
/** Creates a new instance of ListEdges */
public ListEdges()
{
head = null;
// tail = null;
travPointer = null;
}
public void PushByWeight(Node node, int iWeight)
{
// Our first time :)
if (head==null)
{
head = new ListEdgesElement(node,iWeight);
}
else
head.PushByWeight(node,iWeight);
}
public void InitTraversing()
{
travPointer = head;
}
public ListEdgesElement GetAndMove()
{
ListEdgesElement retVal;
if (travPointer != null)
{
retVal = travPointer;
travPointer = travPointer.next;
}
else
retVal = null;
return retVal;
}
public void ClearList()
{
head = null;
}
public boolean IsEmpty()
{
return (head == null);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?