The TransitVertex class implements a vertex that represents a transit station.
import java.io.Serializable; import com.asterdata.ncluster.graph.data.Vertex; import com.asterdata.ncluster.graph.data.VertexKey; /** * Implements a vertex that represents a transit station. */ public class TransitVertex extends Vertex implements Serializable { // The city name. private String cityName = "notYetSet"; // The default is recognizably unrealistic. public static final double DEFAULT_DISTANCE_ = Double.POSITIVE_INFINITY; // This holds the shortest distance from the source vertex that we have // found so far. private double distanceFromSource = DEFAULT_DISTANCE_; // Needed for serialization of Vertex. private static final long serialVersionUID = 1L; /** * Initialize vertex. Provides the superclass with the vertex key and type. * * @param vtxKey is the unique identifier for this vertex. * @param name is the city name, e.g. 'San Francisco'. */ TransitVertex(VertexKey vtxKey, String name) { super(vtxKey); cityName = name; } // Returns the shortest distance from the source found so far. public double getDistanceFromSource() { return distanceFromSource; } // Set the shortest distance from the source found so far. public void setDistanceFromSource(double dist) { distanceFromSource = dist; } public String getCityName() { return cityName; } } // Class TransitVertex