public void AddGenerator(LLDNBase generator) { switch (generator.nodeType) { case LLDNBase.NodeType.GateList: { LLDNGateList convGateList = generator as LLDNGateList; if (gateList != null) { // Nope! There can only be one! if (this.gateList != null) { return; } this.gateList = convGateList; } } break; } this.generators.Add(generator); }
public bool RemoveNode(LLDNBase node, bool removeConnections = true) { if (this.generators.Remove(node) == false) { return(false); } if (this.gateList == node) { this.gateList = null; } if (removeConnections == true) { node.ClearAllConnections(); foreach (LLDNBase g in this.generators) { g.ClearKnowledgeOfConnection(node); } } return(true); }