//Disconnect socket from whatever it's plugged in to public void disconnect() { if (connectedSocket != null) { connectedSocket.connectedSocket = null; } connectedSocket = null; }
//Connect a socket to another object public void connect(CoreSocketComponent socket) { if (connectedSocket == null) { //If nothing's plugged in connect connectedSocket = socket; } else { //If something else is plugged in, disconnect the previous socket and connect the new one connectedSocket.connectedSocket = null; connectedSocket = socket; } }
//Initialisation of lists public CoreSocketComponent(CoreComponent adjoinedComponent) { this.adjoinedComponent = adjoinedComponent; connectedSocket = null; }