ProjektGraph/graph/Vertex.java
2024-07-07 23:07:56 +02:00

67 lines
1.2 KiB
Java

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