Programmieren_Projekt/logging/GraphLogElement.java

53 lines
1.5 KiB
Java

package logging;
import graph.VertexMarking;
import visualizationElements.Edge;
import visualizationElements.Vertex;
import java.awt.Color;
import java.util.List;
import java.util.Map;
public class GraphLogElement extends LogElement {
private List<Vertex> visualVertices;
private List<Edge> visualEdges;
private Map<Vertex, Color> visualVertexColors;
public GraphLogElement(int step, String description, List<Vertex> vertices, List<Edge> edges, Map<Vertex, Color> vertexColors) {
super(step, description);
this.visualVertices = vertices;
this.visualEdges = edges;
this.visualVertexColors = vertexColors;
}
public List<Vertex> getVisualVertices() {
return visualVertices;
}
public List<Edge> getVisualEdges() {
return visualEdges;
}
public Map<Vertex, Color> getVisualVertexColors() {
return visualVertexColors;
}
// Optional: Darstellung des Graphen im LogElement
@Override
public String toString() {
return super.toString() + ", vertices=" + visualVertices + ", edges=" + visualEdges + ", vertexColors=" + visualVertexColors;
}
public static visualizationElements.Vertex transformToVisualVertex(graph.MarkedVertex<VertexMarking> markedVertex) {
return new visualizationElements.Vertex(
markedVertex.getX(),
markedVertex.getY(),
markedVertex.getName(),
markedVertex.getColor()
);
}
}