ProjektGraph/graph/NameDoesNotExistException.java
2024-06-26 02:20:36 +02:00

68 lines
1.3 KiB
Java

package graph;
import java.util.Comparator;
// Exception, das User nach einem ungültigen Knoten sucht
public class NameDoesNotExistException extends Exception {
public NameDoesNotExistException() {
super();
}
public NameDoesNotExistException(String message) {
super(message);
}
public NameDoesNotExistException(String message, Throwable cause) {
super(message, cause);
}
public NameDoesNotExistException(Throwable cause) {
super(cause);
}
}
// 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;
}
// Ausgabe
public String toString() {
return "Wrapper with " + this.n1 + " with prio " + this.prio;
}
}
// 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());
}
}