Compare commits
8 Commits
06e9348016
...
advancedSE
| Author | SHA1 | Date | |
|---|---|---|---|
| 4f219ad5d5 | |||
| 0e70985ff3 | |||
| 735990b7cf | |||
| 48928f8587 | |||
| ef3b0fce5f | |||
| 3ae042e0bb | |||
| cf6bcd8498 | |||
| 85bc6e9eba |
2
combined.qmd
Normal file
2
combined.qmd
Normal file
@ -0,0 +1,2 @@
|
||||
{{< include paul.qmd >}}
|
||||
{{< include luca.qmd >}}
|
||||
133
paul.qmd
Normal file
133
paul.qmd
Normal file
@ -0,0 +1,133 @@
|
||||
---
|
||||
title: "Programmentwurf Advanced SoftwareEngineering"
|
||||
subtitle: Für einen [PIC16f84-Simulator](https://git.paulmartin.cloud/paul/PIC-Simu)
|
||||
author:
|
||||
- Luca Müller
|
||||
- Paul Martin
|
||||
date: 05/31/2025
|
||||
date-format: "DD.MM.YYYY"
|
||||
lang: de
|
||||
format:
|
||||
pdf:
|
||||
toc: true
|
||||
number-sections: true
|
||||
colorlinks: true
|
||||
crossref:
|
||||
custom:
|
||||
- kind: float
|
||||
reference-prefix: UML-Diagramm
|
||||
key: uml
|
||||
latex-env: uml
|
||||
latex-list-of-description: UML-Diagramme
|
||||
---
|
||||
|
||||
\newcommand*\listofumlsde{\listof{uml}{Verzeichnis der UML-Diagramme}}
|
||||
\listofumlsde
|
||||
|
||||
{{< pagebreak >}}
|
||||
|
||||
# Entwurfsmuster
|
||||
Zusätzlich zu den beiden im Folgenden dargestellten Entwursmustern benutzen wir einen [Service Locator](https://en.wikipedia.org/wiki/Service_locator_pattern), der zu den [Architectural Patterns](https://en.wikipedia.org/wiki/Architectural_pattern) zählt. Dieses Pattern nutzt ein `HashMap`, in der verschiedene Komponenten des Programms gespeichert werden, um das Komponenten-Management zu vereinfachen und explizite Abhängigkeiten der Komponenten untereinander zu vermeiden, die das Initialisieren der einzelnen Komponenten erschweren könnten.
|
||||
In unserem Projekt fungiert [`PICComponentLocator`] als dieser Locator. Er besitzt einen `componentCatalogue` als Member, der eine `Map<Class<? extends PICComponentInterface>, PICComponentInterface>` ist. Das bedeutet, dass alle Klassen, die durch den Locator gemanaget werden sollen, das `PICComponentInterface` implementieren müssen. Dieses ist wie folgt [definiert]:
|
||||
```java
|
||||
public interface PICComponentInterface {
|
||||
void initialize(PICComponentLocator picComponents);
|
||||
}
|
||||
```
|
||||
Um nicht bei allen Zugriffen die `PICComponentLocator.getComponent()` ausführen zu müssen, wurde zusätzlich die `abstract` Klasse `PICComponent` [eingeführt]. Sie besitzt als Member alle implementierten Komponenten, also sollten neue Komponenten ebenfalls das Interface implementieren und als Member in `PICComponent` angelegt werden. Alle Komponenten können diese Klasse `extend`en und dadurch auch alle weiteren Komponenten als Member haben. Durch die `initialize`-Funktion des `PICComponent` werden durch einen Aufruf der `PICComponentLocator.initAll()` alle Member vom Locator geholt.
|
||||
|
||||
## Marker-Entwurfsmuster
|
||||
[Marker-Patterns](https://en.wikipedia.org/wiki/Marker_interface_pattern) werden allgemein genutzt, um Klassen Metadaten zuzuordnen. In unserem Projekt stellen die `FrontendSpecific`-Interfaces Marker dar, die genutzt werden um zu kommunizieren, dass Klassen andere Klassen benötigen, die Frontend-spezifisch sind und somit besonders beachtet werden müssen. So können alle [`Interface`s](LINK ZU ORDNER) definiert werden ohne direkt von fremdem Code abhängig zu sein. Bei möglichen anderen Frontend-Implementierungen müssten entsprechend nur die passenden Klassen die jeweiligen Interfaces implementieren und nichts an den Interfaces ändern.
|
||||
Eingeführt wurden die `FrontendSpecific`s in [Commit 06e9348016](https://git.paulmartin.cloud/paul/PIC-Simu/commit/06e934801645e32dea5415ccb4f38368a1667df6) ([hier](https://git.paulmartin.cloud/paul/PIC-Simu/commit/ef3b0fce5f9b6cce06494ff6ce59f5534064e7d2) verfollständigt). Es wurde zunächst ein `FrontendSpecificObject`-Interface angelegt, das alle Frontend-spezifischen Klassen beschreibt, die von Methoden anderer Klassen genutzt werden (sprich, die in den [`Interface`s](LINK ZU ORDNER) vorkommen). Es ist - entsprechend des Marker-Patterns - komplett leer [definiert](src/main/java/fabrik/simulator/pic16f84/frontendspecifics/FrontendSpecificObject.java):
|
||||
```java
|
||||
public interface FrontendSpecificObject {
|
||||
}
|
||||
```
|
||||
Zusätzlich gibt es für spezifische Frontend-Klassen auch `FrontendSpecific`-Interfaces, sodass nach wie vor nur bestimmte Klassen über- bzw. zurückgegeben werden können. Diese spezifischen Interfaces sind ebenfalls leer, nur nutzen sie `extends FrontendSpecificObject` um zu verdeutlichen, dass sie zu den allgemeinen `FrontendSpecificObject`s gehören. Hier beispielsweise [`FrontendSpecificCircle`](src/main/java/fabrik/simulator/pic16f84/frontendspecifics/FrontendSpecificCircle.java):
|
||||
```java
|
||||
public interface FrontendSpecificCircle extends FrontendSpecificObject {
|
||||
}
|
||||
```
|
||||
Tatsächlich genutzt werden die `FrontendSpecific`-Interfaces von [Circle], [ToggleButtonGroup] und [Vbox]. Sie `extenden` ihr jeweiliges `JavaFX`-Pendant und `implementen` ihr jeweiliges `FrontendSpecific`-Interface. Darüber hinaus implementieren sie nur die nötigen (also im Code tatsächlich genutzten) Konstruktoren, die wiederum nur `super()` aufrufen, hier bspw. [`ToggleButtonGroup`]:
|
||||
```java
|
||||
public class ToggleButtonGroup extends
|
||||
com.gluonhq.charm.glisten.control.ToggleButtonGroup
|
||||
implements FrontendSpecificToggleButtonGroup {
|
||||
public ToggleButtonGroup(){
|
||||
super();
|
||||
}
|
||||
|
||||
public ToggleButtonGroup(ToggleButton... toggles) {
|
||||
super(toggles);
|
||||
}
|
||||
}
|
||||
```
|
||||
Alle für das Marker-Pattern eingeführten Klassen sind in @uml-marker erkennbar:
|
||||
|
||||
::: {#uml-marker}
|
||||
|
||||
```{mermaid}
|
||||
%%| fig-width: 6.5
|
||||
classDiagram
|
||||
direction TB
|
||||
class FrontendSpecificObject {
|
||||
<<interface>>
|
||||
}
|
||||
class FrontendSpecificToggleButtonGroup {
|
||||
<<interface>>
|
||||
}
|
||||
class ToggleButtonGroup {
|
||||
public ToggleButtonGroup()
|
||||
public ToggleButtonGroup(ToggleButton... toggles)
|
||||
}
|
||||
|
||||
class `com.gluonhq.charm.glisten.control.ToggleButtonGroup` {
|
||||
...
|
||||
....()
|
||||
}
|
||||
|
||||
FrontendSpecificObject <|-- FrontendSpecificToggleButtonGroup : << extends >>
|
||||
FrontendSpecificToggleButtonGroup <|-- ToggleButtonGroup : << implements >>
|
||||
`com.gluonhq.charm.glisten.control.ToggleButtonGroup` <|-- ToggleButtonGroup : << extends >>
|
||||
|
||||
class FrontendSpecificVBox{
|
||||
<<interface>>
|
||||
}
|
||||
class VBox {
|
||||
public VBox()
|
||||
}
|
||||
|
||||
class `javafx.scene.layout.VBox` {
|
||||
...
|
||||
....()
|
||||
}
|
||||
|
||||
FrontendSpecificObject <|-- FrontendSpecificVBox : << extends >>
|
||||
FrontendSpecificVBox <|-- VBox : << implements >>
|
||||
`javafx.scene.layout.VBox` <|-- VBox : << extends >>
|
||||
|
||||
class FrontendSpecificCircle {
|
||||
<<interface>>
|
||||
}
|
||||
class Circle {
|
||||
public Circle()
|
||||
}
|
||||
|
||||
class `javafx.scene.shape.Circle` {
|
||||
...
|
||||
....()
|
||||
}
|
||||
|
||||
|
||||
FrontendSpecificObject <|-- FrontendSpecificCircle : << extends >>
|
||||
FrontendSpecificCircle <|-- Circle : << implements >>
|
||||
`javafx.scene.shape.Circle` <|-- Circle : << extends >>
|
||||
|
||||
|
||||
```
|
||||
|
||||
Das genutzte Marker-Pattern und alle seine Verwendungen
|
||||
:::
|
||||
## Beobachter- (/Observer-) Entwurfsmuster
|
||||
[Beobachter-Entwurfsmuster](https://en.wikipedia.org/wiki/Observer_pattern) werden genutzt, damit ein Subjekt mehrere Beobachter über eine Zustandsänderung informieren kann. In unserem Projekt passiert das bei einer Änderung der `totalExecutionTime`. Das Subjekt `ExecutionTimeSubject` führt hierbei ein `Set` an Beobachtern, die bei uns durch das Interface `ExecutionTimeObserver` repräsentiert werden, welches durch die `registerObserver`- und `unregisterObserver`-Funktionen verwaltet werden kann. Bei einer Zustandsänderung muss die `notifyObservers`-Funktion aufgerufen werden, welche für alle Observer die im Interface spezifizierte `executionTimeChanged`-Funktion aufruft.
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
import fabrik.simulator.pic16f84.interfaces.*;
|
||||
|
||||
public class Commands extends PICComponent implements CommandInterface {
|
||||
public class Commands extends ExecutionTimeSubject implements CommandInterface {
|
||||
private int wRegister;
|
||||
private long totalExecutionTime;
|
||||
private double executionTimeMultiplier = 1;
|
||||
@ -18,16 +19,17 @@ public class Commands extends PICComponent implements CommandInterface {
|
||||
|
||||
public void addExecutionTime(int i) {
|
||||
totalExecutionTime += i;
|
||||
timer.cycles(i);
|
||||
eeprom.registerTime(false);
|
||||
super.notifyObservers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTotalExecutionTime() {
|
||||
return (totalExecutionTime * getExecutionTimeMultiplier());
|
||||
}
|
||||
|
||||
public void resetTotalExecutionTime() {
|
||||
totalExecutionTime = 0;
|
||||
super.notifyObservers();
|
||||
}
|
||||
|
||||
|
||||
@ -556,10 +558,12 @@ public class Commands extends PICComponent implements CommandInterface {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getExecutionTimeMultiplier(){
|
||||
return executionTimeMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExecutionTimeMultiplier(String option){
|
||||
switch (option) {
|
||||
case "8 MHZ":
|
||||
@ -584,11 +588,6 @@ public class Commands extends PICComponent implements CommandInterface {
|
||||
executionTimeMultiplier = 125;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(PICComponentLocator locator) {
|
||||
super.initialize(locator);
|
||||
super.notifyObservers();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
|
||||
import fabrik.simulator.pic16f84.frontendspecifics.Circle;
|
||||
import fabrik.simulator.pic16f84.frontendspecifics.FrontendSpecificToggleButtonGroup;
|
||||
import fabrik.simulator.pic16f84.frontendspecifics.ToggleButtonGroup;
|
||||
|
||||
@ -14,7 +15,6 @@ import javafx.fxml.FXML;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.shape.Circle;
|
||||
import javafx.stage.FileChooser;
|
||||
|
||||
import java.io.File;
|
||||
@ -38,7 +38,7 @@ import java.util.Set;
|
||||
|
||||
import static java.lang.Math.max;
|
||||
|
||||
public class Controller_Frontend extends PICComponent implements FrontendControllerInterface {
|
||||
public class Controller_Frontend extends PICComponent implements FrontendControllerInterface, ExecutionTimeObserver {
|
||||
|
||||
private int [] prog;
|
||||
private int [][] read;
|
||||
@ -165,7 +165,7 @@ public class Controller_Frontend extends PICComponent implements FrontendControl
|
||||
|
||||
private void updateExecutionTimeMultiplier() {
|
||||
String selectedOption = executionTimeComboBox.getValue();
|
||||
commands.setExecutionTimeMultiplier(selectedOption);
|
||||
executionTime.setExecutionTimeMultiplier(selectedOption);
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -226,10 +226,9 @@ public class Controller_Frontend extends PICComponent implements FrontendControl
|
||||
ioPorts.refreshUI(getTRISbuttons(), getPORTbuttons());
|
||||
updateStack();
|
||||
updateWatchdog();
|
||||
double totalExecutionTime = commands.getTotalExecutionTime();
|
||||
totalExecutionTimeLabel.setText("Total Execution Time: " + totalExecutionTime + "µs");
|
||||
}
|
||||
|
||||
|
||||
private void markSelectedRow(int currentIndex, String selectedRowStyle) {
|
||||
lstContentListView.setCellFactory(column -> new ListCell<String>() {
|
||||
@Override
|
||||
@ -284,7 +283,7 @@ public class Controller_Frontend extends PICComponent implements FrontendControl
|
||||
ExecutionState.wakeUp();
|
||||
breakpoints.clear();
|
||||
ioPorts.refreshUI(getTRISbuttons(), getPORTbuttons());
|
||||
commands.resetTotalExecutionTime();
|
||||
executionTime.resetTotalExecutionTime();
|
||||
watchdogTimer.reset();
|
||||
wdtCheck.setSelected(false);
|
||||
table.refresh();
|
||||
@ -567,8 +566,14 @@ public class Controller_Frontend extends PICComponent implements FrontendControl
|
||||
@Override
|
||||
public void initialize(PICComponentLocator locator) {
|
||||
super.initialize(locator);
|
||||
executionTime.registerObserver(this);
|
||||
this.picComponents = locator;
|
||||
System.out.println("Frontend");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executionTimeChanged() {
|
||||
totalExecutionTimeLabel.setText("Total Execution Time: " + executionTime.getTotalExecutionTime() + "µs");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ import java.nio.file.Paths;
|
||||
|
||||
import fabrik.simulator.pic16f84.interfaces.*;
|
||||
|
||||
public class EEPROM extends PICComponent implements EEPROMInterface {
|
||||
public class EEPROM extends PICComponent implements EEPROMInterface, ExecutionTimeObserver {
|
||||
private final int EEDATA = 0x08;
|
||||
private final int EEADR = 0x09;
|
||||
private final int EECON1 = 0x88;
|
||||
@ -83,13 +83,13 @@ public class EEPROM extends PICComponent implements EEPROMInterface {
|
||||
dataRegister.setDirectBit(EECON1, WRERR, 1);
|
||||
return;
|
||||
}
|
||||
registerTime(true);
|
||||
registerTime(executionTime.getTotalExecutionTime(), true);
|
||||
}
|
||||
|
||||
public void registerTime(boolean reset) {
|
||||
public void registerTime(double executionTime, boolean reset) {
|
||||
if (reset)
|
||||
startTime = commands.getTotalExecutionTime();
|
||||
else if ((commands.getTotalExecutionTime() >= (startTime + 1000)) && writeControl) {
|
||||
startTime = executionTime;
|
||||
else if ((executionTime >= (startTime + 1000)) && writeControl) {
|
||||
eecon2stages = new boolean[]{false, false};
|
||||
dataRegister.setDirectBit(EECON1, EEIF, 1);
|
||||
dataRegister.setDirectBit(EECON1, WR, 0);
|
||||
@ -174,5 +174,11 @@ public class EEPROM extends PICComponent implements EEPROMInterface {
|
||||
@Override
|
||||
public void initialize(PICComponentLocator locator) {
|
||||
super.initialize(locator);
|
||||
executionTime.registerObserver(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executionTimeChanged() {
|
||||
registerTime(executionTime.getTotalExecutionTime(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import fabrik.simulator.pic16f84.interfaces.ExecutionTimeObserver;
|
||||
import fabrik.simulator.pic16f84.interfaces.PICComponentInterface;
|
||||
|
||||
public abstract class ExecutionTimeSubject extends PICComponent implements PICComponentInterface{
|
||||
private Set<ExecutionTimeObserver> observers;
|
||||
|
||||
public ExecutionTimeSubject(){
|
||||
super();
|
||||
this.observers = new HashSet<>();
|
||||
}
|
||||
|
||||
|
||||
public void registerObserver(ExecutionTimeObserver observer){
|
||||
observers.add(observer);
|
||||
}
|
||||
|
||||
public void unregisterObserver(ExecutionTimeObserver observer){
|
||||
observers.remove(observer);
|
||||
}
|
||||
|
||||
protected void notifyObservers(){
|
||||
observers.forEach(o -> o.executionTimeChanged());
|
||||
}
|
||||
|
||||
public double getTotalExecutionTime(){
|
||||
throw new UnsupportedOperationException("No class implements ExecutionTimeSubject correctly!");
|
||||
}
|
||||
|
||||
public void addExecutionTime(int i){
|
||||
throw new UnsupportedOperationException("No class implements ExecutionTimeSubject correctly!");
|
||||
}
|
||||
|
||||
public double getExecutionTimeMultiplier(){
|
||||
throw new UnsupportedOperationException("No class implements ExecutionTimeSubject correctly!");
|
||||
}
|
||||
|
||||
public void setExecutionTimeMultiplier(String option){
|
||||
throw new UnsupportedOperationException("No class implements ExecutionTimeSubject correctly!");
|
||||
}
|
||||
|
||||
public void resetTotalExecutionTime(){
|
||||
throw new UnsupportedOperationException("No class implements ExecutionTimeSubject correctly!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(PICComponentLocator locator) {
|
||||
super.initialize(locator);
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
import fabrik.simulator.pic16f84.frontendspecifics.Circle;
|
||||
import fabrik.simulator.pic16f84.frontendspecifics.FrontendSpecificCircle;
|
||||
import fabrik.simulator.pic16f84.frontendspecifics.FrontendSpecificToggleButtonGroup;
|
||||
import fabrik.simulator.pic16f84.frontendspecifics.ToggleButtonGroup;
|
||||
import fabrik.simulator.pic16f84.interfaces.*;
|
||||
@ -8,7 +10,6 @@ import javafx.scene.control.ToggleButton;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.paint.RadialGradient;
|
||||
import javafx.scene.paint.Stop;
|
||||
import javafx.scene.shape.Circle;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -187,9 +188,9 @@ public class IOPorts extends PICComponent implements IOPortInterface {
|
||||
}
|
||||
}
|
||||
|
||||
public void setLEDs (Circle[] a, Circle[] b){
|
||||
allLEDsA = a;
|
||||
allLEDsB = b;
|
||||
public void setLEDs (FrontendSpecificCircle[] a, FrontendSpecificCircle[] b){
|
||||
allLEDsA = (Circle []) a;
|
||||
allLEDsB = (Circle []) b;
|
||||
}
|
||||
|
||||
public void refreshTable(ToggleButtonGroup parent) {
|
||||
|
||||
@ -6,7 +6,9 @@ public class Main {
|
||||
private static final PICComponentLocator picComponents = new PICComponentLocator(); // Subjekt
|
||||
|
||||
public static void main(String[] args) {
|
||||
picComponents.registerComponent(CommandInterface.class, new Commands());
|
||||
Commands commands = new Commands();
|
||||
picComponents.registerComponent(CommandInterface.class, commands);
|
||||
picComponents.registerComponent(ExecutionTimeSubject.class, commands);
|
||||
picComponents.registerComponent(DataRegisterInterface.class, new DataRegister());
|
||||
picComponents.registerComponent(EEPROMInterface.class, new EEPROM());
|
||||
picComponents.registerComponent(InterruptInterface.class, new Interrupts());
|
||||
|
||||
@ -14,6 +14,7 @@ public abstract class PICComponent {
|
||||
WatchdogTimerInterface watchdogTimer;
|
||||
ProgramStackInterface programStack;
|
||||
CommandInterface commands;
|
||||
ExecutionTimeSubject executionTime;
|
||||
ToggleButtonInterface toggleButtonExt;
|
||||
|
||||
public void initialize(PICComponentLocator locator) {
|
||||
@ -29,5 +30,6 @@ public abstract class PICComponent {
|
||||
programStack = locator.getComponent(ProgramStackInterface.class);
|
||||
commands = locator.getComponent(CommandInterface.class);
|
||||
table = locator.getComponent(TableInterface.class);
|
||||
executionTime = locator.getComponent(ExecutionTimeSubject.class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
package fabrik.simulator.pic16f84;
|
||||
|
||||
import fabrik.simulator.pic16f84.interfaces.ExecutionTimeObserver;
|
||||
import fabrik.simulator.pic16f84.interfaces.TimerInterface;
|
||||
|
||||
public class Timer extends PICComponent implements TimerInterface {
|
||||
public class Timer extends PICComponent implements TimerInterface, ExecutionTimeObserver {
|
||||
private final int TIMERREG = 0x1;
|
||||
private final int T0SE = 0x4;
|
||||
private final int T0CS = 0x5;
|
||||
@ -66,5 +67,11 @@ public class Timer extends PICComponent implements TimerInterface {
|
||||
@Override
|
||||
public void initialize(PICComponentLocator locator) {
|
||||
super.initialize(locator);
|
||||
executionTime.registerObserver(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executionTimeChanged() {
|
||||
cycles((int) executionTime.getTotalExecutionTime());
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,18 +21,18 @@ public class WatchdogTimer extends PICComponent implements WatchdogTimerInterfac
|
||||
if (enabled) {
|
||||
if (realtimer >= (watchdogTime + lastReset - 1)) {
|
||||
dataRegister.clearBit(3, 4);
|
||||
lastReset = commands.getTotalExecutionTime();
|
||||
lastReset = executionTime.getTotalExecutionTime();
|
||||
frontendController.stopRunFromBackend("Watchdog Timer");
|
||||
}
|
||||
else {
|
||||
rawtimer++;
|
||||
realtimer = (long) (rawtimer * commands.getExecutionTimeMultiplier());
|
||||
realtimer = (long) (rawtimer * executionTime.getExecutionTimeMultiplier());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void reset (){
|
||||
lastReset = commands.getTotalExecutionTime();
|
||||
lastReset = executionTime.getTotalExecutionTime();
|
||||
rawtimer = 0;
|
||||
realtimer = 0;
|
||||
preScaler.reset();
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
package fabrik.simulator.pic16f84.frontendspecifics;
|
||||
|
||||
|
||||
public class Circle extends javafx.scene.shape.Circle implements FrontendSpecificCircle {
|
||||
public Circle () {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package fabrik.simulator.pic16f84.frontendspecifics;
|
||||
|
||||
public interface FrontendSpecificCircle extends FrontendSpecificObject {
|
||||
}
|
||||
@ -3,17 +3,7 @@ package fabrik.simulator.pic16f84.interfaces;
|
||||
public interface CommandInterface extends PICComponentInterface {
|
||||
void CALL(int isr);
|
||||
|
||||
double getTotalExecutionTime();
|
||||
|
||||
int get_wRegister();
|
||||
|
||||
void decode(int i);
|
||||
|
||||
void resetTotalExecutionTime();
|
||||
|
||||
void addExecutionTime(int i);
|
||||
|
||||
double getExecutionTimeMultiplier();
|
||||
|
||||
void setExecutionTimeMultiplier(String option);
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package fabrik.simulator.pic16f84.interfaces;
|
||||
|
||||
public interface EEPROMInterface extends PICComponentInterface {
|
||||
void registerTime(boolean b);
|
||||
void registerTime(double executionTime, boolean b);
|
||||
|
||||
void parse(int i, int content, int i1);
|
||||
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
package fabrik.simulator.pic16f84.interfaces;
|
||||
|
||||
public interface ExecutionTimeObserver {
|
||||
void executionTimeChanged();
|
||||
}
|
||||
@ -1,9 +1,8 @@
|
||||
package fabrik.simulator.pic16f84.interfaces;
|
||||
|
||||
import javafx.scene.shape.Circle;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import fabrik.simulator.pic16f84.frontendspecifics.FrontendSpecificCircle;
|
||||
import fabrik.simulator.pic16f84.frontendspecifics.FrontendSpecificObject;
|
||||
import fabrik.simulator.pic16f84.frontendspecifics.FrontendSpecificToggleButtonGroup;
|
||||
|
||||
@ -24,7 +23,7 @@ public interface IOPortInterface extends PICComponentInterface, FrontendSpecific
|
||||
|
||||
void reset();
|
||||
|
||||
void setLEDs(Circle[] allLEDsA, Circle[] allLEDsB);
|
||||
void setLEDs(FrontendSpecificCircle[] allLEDsA, FrontendSpecificCircle[] allLEDsB);
|
||||
|
||||
void setLEDs(boolean[] booleans);
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package fabrik.simulator.pic16f84.interfaces;
|
||||
|
||||
import fabrik.simulator.pic16f84.frontendspecifics.FrontendSpecificVBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
|
||||
public interface TableInterface extends PICComponentInterface {
|
||||
void refresh();
|
||||
|
||||
@ -27,7 +27,7 @@ class CommandsTests {
|
||||
EEPROMInterface eepromMock = mock(EEPROMInterface.class);
|
||||
picComponents.registerComponent(EEPROMInterface.class, eepromMock);
|
||||
|
||||
CommandInterface commands = new Commands();
|
||||
Commands commands = new Commands();
|
||||
picComponents.registerComponent(CommandInterface.class, commands);
|
||||
picComponents.initAll();
|
||||
|
||||
@ -47,7 +47,7 @@ class CommandsTests {
|
||||
EEPROMInterface eepromMock = mock(EEPROMInterface.class);
|
||||
picComponents.registerComponent(EEPROMInterface.class, eepromMock);
|
||||
|
||||
CommandInterface commands = new Commands();
|
||||
Commands commands = new Commands();
|
||||
picComponents.registerComponent(CommandInterface.class, commands);
|
||||
picComponents.initAll();
|
||||
|
||||
@ -68,7 +68,7 @@ class CommandsTests {
|
||||
EEPROMInterface eepromMock = mock(EEPROMInterface.class);
|
||||
picComponents.registerComponent(EEPROMInterface.class, eepromMock);
|
||||
|
||||
CommandInterface commands = new Commands();
|
||||
Commands commands = new Commands();
|
||||
picComponents.registerComponent(CommandInterface.class, commands);
|
||||
picComponents.initAll();
|
||||
|
||||
|
||||
@ -69,8 +69,8 @@ class EEPROMTests {
|
||||
DataRegisterInterface mockDataRegister = Mockito.mock(DataRegisterInterface.class);
|
||||
picComponents.registerComponent(DataRegisterInterface.class, mockDataRegister);
|
||||
|
||||
CommandInterface mockCommands = mock(CommandInterface.class);
|
||||
picComponents.registerComponent(CommandInterface.class, mockCommands);
|
||||
ExecutionTimeSubject mockExecutionTime = mock(ExecutionTimeSubject.class);
|
||||
picComponents.registerComponent(ExecutionTimeSubject.class, mockExecutionTime);
|
||||
|
||||
EEPROMInterface eeprom = new EEPROM();
|
||||
picComponents.registerComponent(EEPROMInterface.class, eeprom);
|
||||
|
||||
@ -29,13 +29,13 @@ class WatchDogTimerTests {
|
||||
picComponents.registerComponent(PreScalerInterface.class, mockPreScaler);
|
||||
|
||||
|
||||
CommandInterface mockCommands = mock(CommandInterface.class);
|
||||
ExecutionTimeSubject mockExecutionTime = mock(ExecutionTimeSubject.class);
|
||||
when(
|
||||
mockCommands.getExecutionTimeMultiplier()
|
||||
mockExecutionTime.getExecutionTimeMultiplier()
|
||||
).thenReturn(
|
||||
1.0
|
||||
);
|
||||
picComponents.registerComponent(CommandInterface.class, mockCommands);
|
||||
picComponents.registerComponent(ExecutionTimeSubject.class, mockExecutionTime);
|
||||
|
||||
WatchdogTimerInterface watchDogTimer = new WatchdogTimer();
|
||||
picComponents.registerComponent(WatchdogTimerInterface.class, watchDogTimer);
|
||||
|
||||
Reference in New Issue
Block a user