ProjektGraph/graph/MarkedVertex.java
2024-07-07 16:29:45 +02:00

82 lines
1.5 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);
this.xCord = 0;
this.yCord = 0;
}
public MarkedVertex(int xCord, int yCord, String name, T t, Color color) {
super(name);
this.marking = t;
this.screenVertex = new visualizationElements.Vertex(xCord, yCord, name, 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();
}
}