26 lines
692 B
Java
26 lines
692 B
Java
public class Edge implements Comparable
|
|
{
|
|
private Node anfang;
|
|
private Node ende;
|
|
private int wert;
|
|
private boolean gerichtet;
|
|
|
|
public Edge(Node a, Node e, int w, boolean r){
|
|
this.anfang = a;
|
|
this.ende = e;
|
|
this.wert = w ;
|
|
this.gerichtet = r;
|
|
}
|
|
|
|
public Node getAnfang(){return this.anfang;}
|
|
public Node getEnde(){return this.ende;}
|
|
public int getWert(){return this.wert;}
|
|
public boolean istGerichtet(){return this.gerichtet;}
|
|
|
|
public int compareTo(Object o) {
|
|
Edge other = (Edge)o;
|
|
if(this.wert < other.wert)return -1;
|
|
if(this.wert > other.wert)return 1;
|
|
return 0;
|
|
}
|
|
} |