ProjektGraph/graph/Vertex.java

67 lines
1.2 KiB
Java
Raw Normal View History

2024-06-15 14:48:28 +00:00
package graph;
2024-07-07 21:07:56 +00:00
/**
* Represents a vertex in a graph.
* This class serves as a base abstraction for vertices in various types of graphs.
*/
2024-06-15 14:48:28 +00:00
public abstract class Vertex {
// ATTRIBUTE
2024-06-15 14:48:28 +00:00
private String name;
// KONSTRUKTOREN
2024-07-07 21:07:56 +00:00
/**
* Constructs a vertex with an empty name.
*/
2024-06-15 14:48:28 +00:00
public Vertex() {
this.name = "";
}
2024-07-07 21:07:56 +00:00
/**
* Constructs a vertex with a specified name.
*
* @param s The name of the vertex.
*/
2024-06-15 14:48:28 +00:00
public Vertex(String s) {
this.name = s;
}
// GET-ER
2024-07-07 21:07:56 +00:00
/**
* Retrieves the name of the vertex.
*
* @return The name of the vertex.
*/
2024-06-15 14:48:28 +00:00
public String getName() {
return this.name;
}
2024-07-07 21:07:56 +00:00
/**
* Abstract method to retrieve the visualization representation of the vertex.
* Concrete subclasses will provide specific implementations.
*
* @return The visualization representation of the vertex.
*/
2024-07-02 22:46:21 +00:00
public abstract visualizationElements.Vertex getScreenVertex();
2024-06-25 15:18:34 +00:00
// SET-ER
2024-07-07 21:07:56 +00:00
/**
* Sets the name of the vertex.
*
* @param s The new name for the vertex.
*/
2024-06-15 14:48:28 +00:00
public void setName(String s) {
this.name = s;
}
2024-06-25 15:18:34 +00:00
2024-06-15 14:48:28 +00:00
}