private void delete(UserKey userKey, int dashId, int deviceId, long widgetId, int additionalId, long deviceTilesId, long templateId, TimerTime time) { ConcurrentHashMap<TimerKey, BaseAction[]> secondExecutor = timerExecutors.get(time.time); if (secondExecutor != null) { secondExecutor.remove(new TimerKey(userKey, dashId, deviceId, widgetId, additionalId, deviceTilesId, templateId, time)); } }
private void add(UserKey userKey, int dashId, int deviceId, long widgetId, int additionalId, TimerTime time, BaseAction[] actions) { ArrayList<BaseAction> validActions = new ArrayList<>(actions.length); for (BaseAction action : actions) { if (action.isValid()) { validActions.add(action); } } if (!validActions.isEmpty()) { getExecutorOrCreate(time.time).put( new TimerKey(userKey, dashId, deviceId, widgetId, additionalId, -1L, -1L, time), validActions.toArray(new BaseAction[0])); } }
public void add(UserKey userKey, Timer timer, int dashId, long deviceTilesId, long templateId) { if (timer.isValid()) { if (timer.isValidStart()) { TimerTime timerTime = new TimerTime(timer.startTime); SetPinAction action = new SetPinAction(timer.pin, timer.pinType, timer.startValue); TimerKey timerKey = new TimerKey(userKey, dashId, timer.deviceId, timer.id, 0, deviceTilesId, templateId, timerTime); getExecutorOrCreate(timerTime.time).put(timerKey, new BaseAction[]{action}); } if (timer.isValidStop()) { TimerTime timerTime = new TimerTime(timer.stopTime); SetPinAction action = new SetPinAction(timer.pin, timer.pinType, timer.stopValue); TimerKey timerKey = new TimerKey(userKey, dashId, timer.deviceId, timer.id, 1, deviceTilesId, templateId, timerTime); getExecutorOrCreate(timerTime.time).put(timerKey, new BaseAction[]{action}); } } }