/// <summary>Add new transport to list of open transports.</summary> /// <remarks> /// Add new transport to list of open transports. The new transport /// is always added immediately after the head of the linked list. /// </remarks> public virtual void add(object o) { org.acplt.oncrpc.server.OncRpcTcpServerTransport.TransportList.Node node = new org.acplt.oncrpc.server.OncRpcTcpServerTransport.TransportList.Node (this, o); node.next = this.head.next; this.head.next = node; node.prev = this.head; node.next.prev = node; ++this._size; }
/// <summary>Create a new instance of a list of open transports.</summary> /// <remarks>Create a new instance of a list of open transports.</remarks> public TransportList(OncRpcTcpServerTransport _enclosing) { this._enclosing = _enclosing; head = new org.acplt.oncrpc.server.OncRpcTcpServerTransport.TransportList.Node(this , null); // // Link header node with itself, so it is its own successor // and predecessor. Using a header node excuses us from checking // for the special cases of first and last node (or both at // the same time). // this.head.next = this.head; this.head.prev = this.head; }
/// <summary>Removes and returns the first open transport from list.</summary> /// <remarks>Removes and returns the first open transport from list.</remarks> public virtual object removeFirst() { // // Do not remove the header node. // if (this._size == 0) { throw (new System.ArgumentOutOfRangeException()); } org.acplt.oncrpc.server.OncRpcTcpServerTransport.TransportList.Node node = this.head .next; this.head.next = node.next; node.next.prev = this.head; --this._size; return(node.item); }
/// <summary>Remove given transport from list of open transports.</summary> /// <remarks>Remove given transport from list of open transports.</remarks> public virtual bool remove(object o) { org.acplt.oncrpc.server.OncRpcTcpServerTransport.TransportList.Node node = this.head .next; while (node != this.head) { if (node.item == o) { node.prev.next = node.next; node.next.prev = node.prev; --this._size; return(true); } node = node.next; } return(false); }