Continuous systeem afgemaakt, rollen van verschillende listeners en gatherers gecontroleerd en nutteloze exceptions verwijderd. Het nieuwe actions systeem moet nog worden doorgevoerd in de devices.
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
package pm;
|
||||
|
||||
import pm.exception.MacroException;
|
||||
import pm.exception.device.DeviceExitException;
|
||||
import pm.exception.device.DeviceInitialiseException;
|
||||
import pm.macro.Event;
|
||||
import pm.macro.MacroListener;
|
||||
import pm.task.TaskProvider;
|
||||
import pm.macro.event.Hold;
|
||||
import pm.macro.event.Press;
|
||||
import pm.macro.event.Release;
|
||||
import pm.task.Continuous;
|
||||
import pm.task.Stopper;
|
||||
|
||||
public abstract class Device {
|
||||
protected MacroListener macroListener;
|
||||
@@ -14,22 +17,36 @@ public abstract class Device {
|
||||
macroListener = new MacroListener();
|
||||
}
|
||||
|
||||
public void add(Macro macro, Task task) {
|
||||
/* Register macro's */
|
||||
protected void add(Macro macro, Task task) {
|
||||
macroListener.add(macro, task);
|
||||
}
|
||||
|
||||
public void add(Event event, Task task) throws MacroException {
|
||||
macroListener.add(event, task);
|
||||
protected void add(Event event, Task task) {
|
||||
add(new Macro(event), task);
|
||||
}
|
||||
|
||||
public void add(Event event) {
|
||||
protected void add(Macro startMacro, Macro stopMacro, Continuous continuous) {
|
||||
add(startMacro, continuous);
|
||||
add(stopMacro, new Stopper(continuous));
|
||||
}
|
||||
|
||||
protected void add(Event startEvent, Event stopEvent, Continuous continuous) {
|
||||
add(startEvent, continuous);
|
||||
add(stopEvent, new Stopper(continuous));
|
||||
}
|
||||
|
||||
protected void add(Hold hold, Continuous continuous) {
|
||||
Button button = hold.getButton();
|
||||
add(new Press(button), new Release(button), continuous);
|
||||
}
|
||||
|
||||
/* Recognize events */
|
||||
protected void add(Event event) {
|
||||
macroListener.add(event);
|
||||
}
|
||||
|
||||
public void add(Task task) {
|
||||
TaskProvider.add(task);
|
||||
}
|
||||
|
||||
/* Device default methods */
|
||||
public void initialise() throws DeviceInitialiseException {}
|
||||
public void exit() throws DeviceExitException {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user