ProjektGraph/graph/MarkedEdge.java
2024-07-03 19:41:46 +02:00

76 lines
1.5 KiB
Java

package graph;
import java.awt.*;
public class MarkedEdge<U extends EdgeMarking> extends Edge{
// ATTRIBUTE
private U marking;
// Für Aufgabe 2
private int weighting;
private visualizationElements.Edge screenEdge;
// KONSTRUKTOREN
public MarkedEdge() {
super();
this.screenEdge = new visualizationElements.Edge(null, null);
}
public MarkedEdge(String s, Vertex n1, Vertex n2, U u) {
super(s, n1, n2);
this.marking = u;
this.screenEdge = new visualizationElements.Edge(n1.getScreenVertex(), n2.getScreenVertex(), u.toString());
}
// TODO ACHTUNG DEBUG!!!!
public MarkedEdge(String s, Vertex n1, Vertex n2, U u, int w) {
super(s, n1, n2);
this.marking = u;
this.weighting = w;
this.screenEdge = new visualizationElements.Edge(n1.getScreenVertex(), n2.getScreenVertex(), "u.toString()", Color.BLACK);
}
// GET-ER
public U getMarking() {
return this.marking;
}
// Für Aufgabe 2
public int getWeighting() {
return this.weighting;
}
public visualizationElements.Edge getScreenEdge() {
return this.screenEdge;
}
// SET-ER
public void setMarking(U u) {
this.marking = u;
}
// Für Aufgabe 2
public void setWeighting(int w) {
this.weighting = w;
}
// Ausgabe
public String toString() {
return "MarkedEdge " + this.getName() + " from " + this.getSource().getName() + " to " + this.getDestination().getName();
}
}