ProjektGraph/graph/NameDoesNotExistException.java

68 lines
1.3 KiB
Java
Raw Normal View History

2024-06-15 14:48:28 +00:00
package graph;
2024-06-25 15:18:34 +00:00
import java.util.Comparator;
// Exception, das User nach einem ungültigen Knoten sucht
2024-06-26 00:20:36 +00:00
public class NameDoesNotExistException extends Exception {
2024-06-15 14:48:28 +00:00
public NameDoesNotExistException() {
super();
}
public NameDoesNotExistException(String message) {
super(message);
}
public NameDoesNotExistException(String message, Throwable cause) {
super(message, cause);
}
public NameDoesNotExistException(Throwable cause) {
super(cause);
}
}
2024-06-25 15:18:34 +00:00
// Element in der PriorityQueue
class WrapperElement<T extends VertexMarking> {
// ATTRIBUTE
private MarkedVertex<T> n1;
private int prio;
// KONSTRUKTOR
public WrapperElement(MarkedVertex<T> n1, int prio) {
this.n1 = n1;
this.prio = prio;
}
// GET-ER
public MarkedVertex<T> getElement() {
return this.n1;
}
public int getPrio() {
return this.prio;
}
2024-06-26 00:20:36 +00:00
// Ausgabe
public String toString() {
return "Wrapper with " + this.n1 + " with prio " + this.prio;
}
2024-06-25 15:18:34 +00:00
}
// 2 Elemente in der PriorityQueue Vergleichen
class WrapperComparator<T extends VertexMarking> implements Comparator<WrapperElement<T>> {
public int compare(WrapperElement<T> element1, WrapperElement<T> element2) {
return Integer.compare(element1.getPrio(), element2.getPrio());
}
}