public Component TryToConnect(Component target) { ConnectionInterfacePool belongsPool = belongs.GetModel().ConnectionInterfacePool; ConnectionInterfacePool targetPool = target.GetModel().ConnectionInterfacePool; List <ConnectionInterface> commonInterfaces = belongsPool.FindSameInterfaces(targetPool); foreach (var commonInterface in commonInterfaces) { Component connected = TryToConnect(target, commonInterface); if (connected != null) { return(connected); } } return(null); }
protected ComponentModel(string name, List <ConnectionInterface> connectionInterfaces, float mass) { this.name = name; this.mass = mass; connectionInterfacePool = new ConnectionInterfacePool(connectionInterfaces); }