ProjektGraph/graph/MarkedEdge.java

63 lines
1.0 KiB
Java
Raw Normal View History

2024-06-15 14:48:28 +00:00
package graph;
2024-06-25 15:18:34 +00:00
public class MarkedEdge<U extends EdgeMarking> extends Edge{
2024-06-15 14:48:28 +00:00
// ATTRIBUTE
2024-06-15 14:48:28 +00:00
private U marking;
2024-06-25 15:18:34 +00:00
// Für Aufgabe 2
private int weighting;
2024-06-15 14:48:28 +00:00
// KONSTRUKTOREN
2024-06-15 14:48:28 +00:00
public MarkedEdge() {
super();
}
public MarkedEdge(String s, Vertex n1, Vertex n2, U u) {
super(s, n1, n2);
this.marking = u;
}
2024-06-25 15:18:34 +00:00
public MarkedEdge(String s, Vertex n1, Vertex n2, U u, int w) {
super(s, n1, n2);
this.marking = u;
this.weighting = w;
}
2024-06-25 15:18:34 +00:00
// GET-ER
2024-06-15 14:48:28 +00:00
public U getMarking() {
return this.marking;
}
2024-06-25 15:18:34 +00:00
// Für Aufgabe 2
public int getWeighting() {
return this.weighting;
}
// SET-ER
2024-06-15 14:48:28 +00:00
public void setMarking(U u) {
this.marking = u;
}
2024-06-25 15:18:34 +00:00
// Für Aufgabe 2
public void setWeighting(int w) {
this.weighting = w;
}
// Ausgabe
2024-06-15 14:48:28 +00:00
public String toString() {
return "MarkedEdge " + this.getName() + " from " + this.getSource().getName() + " to " + this.getDestination().getName();
2024-06-15 14:48:28 +00:00
}
}