Programmieren_Projekt/graph/MarkedVertex.java

71 lines
1.5 KiB
Java
Raw Normal View History

2024-07-10 05:51:16 +00:00
package graph;
import java.awt.*;
public class MarkedVertex<T extends VertexMarking> extends Vertex {
private T marking;
private int x;
private int y;
private Color color;
private visualizationElements.Vertex screenVertex;
public MarkedVertex() {
super();
this.screenVertex = new visualizationElements.Vertex(0,0);
this.x = 0;
this.y = 0;
}
public MarkedVertex(String s, T t, int x, int y, Color color) {
super(s);
this.marking = t;
this.screenVertex = new visualizationElements.Vertex(x,y, s, color);
this.x = x;
this.y = y;
this.color = color;
}
// Getter und Setter für x und y
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public visualizationElements.Vertex getScreenVertex() {return this.screenVertex;}
public int[] getCords() {return new int[] {this.x, this.y};}
public T getMarking() {
return marking;
}
public void setMarking(T t) {
this.marking = t;
}
@Override
public String toString() {
return "MarkedVertex{" + "name='" + getName() + '\'' + ", marking=" + marking + '}';
}
}