public void unplugFromRack(SocketRack rack, ActionType actionType) { if (!mPluggedActions.contains(actionType)) { Logger.w("Trying to unplug action, this plug weren't being plugged for: " + actionType); return; } IActionSocket socket = rack.getSocket(actionType); if (null == socket) { return; } socket.unplug(this); mPluggedActions.remove(actionType); }
public void plugIntoRack(SocketRack rack, ActionType actionType) { if (mPluggedActions.contains(actionType)) { Logger.w("Trying to plug for the same action again: " + actionType); return; } IActionSocket socket = rack.getSocket(actionType); if (null == socket) { Logger.i( "Trying to plug into not existing socket: " + actionType.getAction() + ", assuming user Action"); UserActionsRelay relay = new UserActionsRelay(); rack.addActionSourceAndSocket(relay, relay, actionType); socket = rack.getSocket(actionType); } socket.acceptPlugging(this); mPluggedActions.add(actionType); }