ProjektGraph/graph/MarkedVertex.java

83 lines
1.6 KiB
Java
Raw Normal View History

2024-06-15 14:48:28 +00:00
package graph;
2024-07-02 22:46:21 +00:00
import java.awt.*;
public class MarkedVertex<T extends VertexMarking> extends Vertex{
// ATTRIBUTE
2024-06-15 14:48:28 +00:00
private T marking;
2024-07-02 22:46:21 +00:00
private int xCord;
private int yCord;
private visualizationElements.Vertex screenVertex;
2024-06-15 14:48:28 +00:00
// KONSTRUKTOREN
2024-06-15 14:48:28 +00:00
public MarkedVertex() {
super();
2024-07-02 22:46:21 +00:00
this.screenVertex = new visualizationElements.Vertex(0, 0);
this.xCord = 0;
this.yCord = 0;
2024-06-15 14:48:28 +00:00
}
public MarkedVertex(String s, T t) {
super(s);
this.marking = t;
2024-07-02 22:46:21 +00:00
this.screenVertex = new visualizationElements.Vertex(0, 0, t.toString());
this.xCord = 0;
this.yCord = 0;
}
// TODO ACHTUNG DEBUG!!!!
public MarkedVertex(int xCord, int yCord, String s, T t, Color color) {
super(s);
this.marking = t;
this.screenVertex = new visualizationElements.Vertex(xCord, yCord, "t.toString()", color);
this.xCord = xCord;
this.yCord = yCord;
2024-06-15 14:48:28 +00:00
}
// GET-ER
2024-06-15 14:48:28 +00:00
public T getMarking() {
return this.marking;
}
2024-07-02 22:46:21 +00:00
public visualizationElements.Vertex getScreenVertex() {
return this.screenVertex;
}
public int[] getCords() {
return new int[]{this.xCord, this.yCord};
}
// SET-ER
2024-06-15 14:48:28 +00:00
public void setMarking(T t) {
this.marking = t;
}
2024-07-02 22:46:21 +00:00
public void setCords(int[] cords) {
this.xCord = cords[0];
this.yCord = cords[1];
this.screenVertex.setXpos(cords[0]);
this.screenVertex.setYpos(cords[1]);
}
// Ausgabe
2024-06-15 14:48:28 +00:00
public String toString() {
return "MarkedVertex " + this.getName();
2024-06-15 14:48:28 +00:00
}
}