Simplify ComponentLocator

This commit is contained in:
2025-04-27 22:52:25 +02:00
parent ac854ed4f1
commit c38835fd7b
22 changed files with 57 additions and 71 deletions

View File

@ -9,27 +9,23 @@ public abstract class PICComponent {
IOPortInterface ioPorts;
TimerInterface timer;
InterruptInterface interrupts;
//TableInterface table;
//WindowManagement createWindow;
FrontendControllerInterface frontendController;
WatchdogTimerInterface watchdogTimer;
ProgramStackInterface programStack;
CommandInterface commands;
ToggleButtonInterface toggleButtonExt;
void initialize(PICComponents picComponents) {
toggleButtonExt = (ToggleButtonInterface) picComponents.getComponent(ToggleButtonInterface.class);
dataRegister = (DataRegisterInterface) picComponents.getComponent(DataRegisterInterface.class);
eeprom = (EEPROMInterface) picComponents.getComponent(EEPROMInterface.class);
ioPorts = (IOPortInterface) picComponents.getComponent(IOPortInterface.class);
preScaler = (PreScalerInterface) picComponents.getComponent(PreScalerInterface.class);
timer = (TimerInterface) picComponents.getComponent(TimerInterface.class);
interrupts = (InterruptInterface) picComponents.getComponent(InterruptInterface.class);
//table = (TableInterface) picComponents.getComponent(TableInterface.class);
//createWindow = (WindowManagement) picComponents.getComponent(WindowManagement.class);
frontendController = (FrontendControllerInterface) picComponents.getComponent(FrontendControllerInterface.class);
watchdogTimer = (WatchdogTimerInterface) picComponents.getComponent(WatchdogTimerInterface.class);
programStack = (ProgramStackInterface) picComponents.getComponent(ProgramStackInterface.class);
commands = (CommandInterface) picComponents.getComponent(CommandInterface.class);
void initialize(PICComponentLocator locator) {
toggleButtonExt = locator.getComponent(ToggleButtonInterface.class);
dataRegister = locator.getComponent(DataRegisterInterface.class);
eeprom = locator.getComponent(EEPROMInterface.class);
ioPorts = locator.getComponent(IOPortInterface.class);
preScaler = locator.getComponent(PreScalerInterface.class);
timer = locator.getComponent(TimerInterface.class);
interrupts = locator.getComponent(InterruptInterface.class);
frontendController = locator.getComponent(FrontendControllerInterface.class);
watchdogTimer = locator.getComponent(WatchdogTimerInterface.class);
programStack = locator.getComponent(ProgramStackInterface.class);
commands = locator.getComponent(CommandInterface.class);
}
}