distvertex.java
来自「国外的数据结构与算法分析用书」· Java 代码 · 共 39 行
JAVA
39 行
/* DistVertex.java
* ---------------------------------------------
* Copyright (c) 2001 University of Saskatchewan
* All Rights Reserved
* --------------------------------------------- */
import dslib.graph.SearchVertexUos;
/** A searchable vertex with a distance field. */
public class DistVertex extends SearchVertexUos
{
/** The distance for the vertex. */
protected int dist;
/** Construct a new vertex, store n and id as the vertex's name and index. <br>
Analysis: Time = O(1)
@param n name of the new vertex
@param id index of the new vertex */
public DistVertex (String n, int id)
{
super(n, id);
}
/** The distance for the vertex. <br>
Analysis: Time = O(1) */
public int dist()
{
return dist;
}
/** Set the distance for this vertex. <br>
Analysis: Time = O(1) */
public void setDist(int newDist)
{
dist = newDist;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?