Edge.java

[sourcecode language=”java” wraplines=”false” collapse=”false”]
/* Author: Jourdan Bul-lalayao
* Class: Edge.java
* Purpose: Sub-data structure used for Adjacency List
*/

public class Edge {

private String city;
private int neighbor;
private int cost;
private Edge next;

public Edge(String city, int neighbor, int cost, Edge next) {
this.city = city;
this.neighbor = neighbor;
this.cost = cost;
this.next = next;
}

public void setCity(String city) {
this.city = city;
}

public void setNeighbor(int neighbor) {
this.neighbor = neighbor;
}

public void setCost(int cost) {
this.cost = cost;
}

public void setNext(Edge next) {
this.next = next;
}

public String getCity() {
return city;
}

public int getNeighbor() {
return neighbor;
}

public int getCost() {
return cost;
}

public Edge getNext() {
return next;
}
}
[/sourcecode]

Leave a Reply

Your email address will not be published. Required fields are marked *