Introduce ExecutionTimeSubject
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user