/// <summary> /// Use the portal to spawn a new agent into the out flow. /// </summary> /// <returns>The agent that was added.</returns> public Agent Enter() { Agent a = null; if (Station != null) { // Spawn a new agent a = ((Port)Station).Enter(); // Add it to the node and sort ExternalIn.Add(a); ExternalIn.Sort(); } // Return it for the use by the graph return(a); }
/// <summary> /// Flushes the external inflow to the outflow and inflow to the external outflow, then sorts the both queues. /// </summary> public new void Flush() { Agent a; while (In.Count > 0) { a = In[0]; In.Remove(a); ExternalOut.Add(a); } ExternalOut.Sort(); while (ExternalIn.Count > 0) { a = ExternalIn[0]; ExternalIn.Remove(a); Out.Add(a); } Out.Sort(); }