ProjektGraph/graph/MarkedVertex.java
2024-07-03 00:46:21 +02:00

83 lines
1.6 KiB
Java

package graph;
import java.awt.*;
public class MarkedVertex<T extends VertexMarking> extends Vertex{
// ATTRIBUTE
private T marking;
private int xCord;
private int yCord;
private visualizationElements.Vertex screenVertex;
// KONSTRUKTOREN
public MarkedVertex() {
super();
this.screenVertex = new visualizationElements.Vertex(0, 0);
this.xCord = 0;
this.yCord = 0;
}
public MarkedVertex(String s, T t) {
super(s);
this.marking = t;
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;
}
// GET-ER
public T getMarking() {
return this.marking;
}
public visualizationElements.Vertex getScreenVertex() {
return this.screenVertex;
}
public int[] getCords() {
return new int[]{this.xCord, this.yCord};
}
// SET-ER
public void setMarking(T t) {
this.marking = t;
}
public void setCords(int[] cords) {
this.xCord = cords[0];
this.yCord = cords[1];
this.screenVertex.setXpos(cords[0]);
this.screenVertex.setYpos(cords[1]);
}
// Ausgabe
public String toString() {
return "MarkedVertex " + this.getName();
}
}