ProjektGraph/graph/MarkedEdge.java

76 lines
1.5 KiB
Java
Raw Normal View History

2024-06-15 14:48:28 +00:00
package graph;
2024-07-03 17:41:46 +00:00
import java.awt.*;
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
2024-07-02 22:46:21 +00:00
private visualizationElements.Edge screenEdge;
2024-06-15 14:48:28 +00:00
// KONSTRUKTOREN
2024-06-15 14:48:28 +00:00
public MarkedEdge() {
super();
2024-07-02 22:46:21 +00:00
this.screenEdge = new visualizationElements.Edge(null, null);
2024-06-15 14:48:28 +00:00
}
public MarkedEdge(String s, Vertex n1, Vertex n2, U u) {
super(s, n1, n2);
this.marking = u;
2024-07-02 22:46:21 +00:00
this.screenEdge = new visualizationElements.Edge(n1.getScreenVertex(), n2.getScreenVertex(), u.toString());
2024-06-15 14:48:28 +00:00
}
2024-07-02 22:46:21 +00:00
// TODO ACHTUNG DEBUG!!!!
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-07-03 17:41:46 +00:00
this.screenEdge = new visualizationElements.Edge(n1.getScreenVertex(), n2.getScreenVertex(), "u.toString()", Color.BLACK);
}
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;
}
2024-07-02 22:46:21 +00:00
public visualizationElements.Edge getScreenEdge() {
return this.screenEdge;
}
// 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
}
}