mirror of
https://codeberg.org/qg-info-unterricht/zpg-graphentester.git
synced 2026-03-25 04:58:24 +01:00
Fetch Upstream v7.4 - 01/2025
This commit is contained in:
parent
09967a1c1b
commit
667bc4638b
68 changed files with 2772 additions and 2770 deletions
|
|
@ -14,7 +14,7 @@ import javafx.application.Platform;
|
|||
* Abstrakte Oberklasse für alle zu simulierende Algorithmen
|
||||
* Diese müssen die Methode getBezeichnung(): String und fuehreAlgorithmusAus() überschreiben.
|
||||
*
|
||||
* @version 6.7 (Dez. 2020)
|
||||
* @version 7.1 12.02.2025
|
||||
* @author Thomas Schaller
|
||||
*/
|
||||
|
||||
|
|
@ -78,10 +78,9 @@ public abstract class GraphAlgo extends Thread {
|
|||
/**
|
||||
* Muss vom Algorithmus aufgerufen werden, um einen Haltepunkt zu setzen
|
||||
*/
|
||||
public void step() {
|
||||
public void step() throws InterruptedException {
|
||||
if(gp == null) return;
|
||||
try{
|
||||
//System.out.println("Step");
|
||||
gp.updateImage();
|
||||
aktuellerZustand = g.getStatus();
|
||||
waitforclick = true;
|
||||
|
|
@ -95,9 +94,13 @@ public abstract class GraphAlgo extends Thread {
|
|||
if (hilfe != null) hilfe.setReviewAllowed(false);
|
||||
g.setStatus(aktuellerZustand);
|
||||
aktuellerZustand = null;
|
||||
if(Thread.interrupted()){
|
||||
throw new InterruptedException();
|
||||
}
|
||||
}catch(Exception e) {
|
||||
// Erneutes Stop, damit nicht stop während des Sleeps hier abgefangen wird.
|
||||
stop();
|
||||
//System.out.println("Step wurde unterbrochen");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -146,17 +149,13 @@ public abstract class GraphAlgo extends Thread {
|
|||
if (hilfe != null) hilfe.setReviewAllowed(false);
|
||||
fuehreAlgorithmusAus();
|
||||
gp.updateImage();
|
||||
// System.out.println("Algorithmus beendet");
|
||||
} catch( ThreadDeath e){
|
||||
// System.out.println("Algorithmus vorzeitig beendet."+e);
|
||||
//System.out.println("Algorithmus beendet");
|
||||
} catch( InterruptedException e){
|
||||
//System.out.println("Algorithmus vorzeitig beendet."+e);
|
||||
} finally {
|
||||
if (hilfe != null) hilfe.setReviewAllowed(true);
|
||||
inArbeit = false;
|
||||
}
|
||||
if (hilfe != null) hilfe.setReviewAllowed(true);
|
||||
inArbeit = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Ende Methoden
|
||||
|
|
@ -184,7 +183,7 @@ public abstract class GraphAlgo extends Thread {
|
|||
/**
|
||||
* Methode für den eigentlichen Algorithmus
|
||||
*/
|
||||
public abstract void fuehreAlgorithmusAus();
|
||||
public abstract void fuehreAlgorithmusAus() throws InterruptedException;
|
||||
|
||||
/**
|
||||
* Name des Algorithmus für die Dropdown-Auswahl
|
||||
|
|
@ -257,3 +256,4 @@ public abstract class GraphAlgo extends Thread {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue