/* -------------------------------------------------------- * * Aaron Morris * * CS567 * * Object-Oriented Event-Driven Simulation * * * * Class representing Server List. Each index is a Server * * -------------------------------------------------------- */ //package datasend; import java.awt.*; import java.util.*; public class ServerQueue { protected int numServers; // Number of Servers in List protected Server [] serverList; // List of Servers protected int numIdle; // Number of Idle Servers protected RandNum rands; // Pointer to Random Num Generator protected int MaxFileSize; // Maximum File Size protected EventQueue eventList; // Pointer to Event List protected Stats stats; // Pointer to Stats Object // Constructor, create List of Servers and set all idle public ServerQueue(int NumServers, RandNum r, int Delay, int MaxFile, int PerBytes,EventQueue eq,Stats stats) { this.serverList = new Server[NumServers]; this.stats = stats; this.numServers = NumServers; this.eventList = eq; this.numIdle = NumServers; this.MaxFileSize = MaxFile; this.rands = r; // Populate server list with Server Objects for (int i=0; i < NumServers; i++) serverList[i] = new Server("Server " + i,i,Delay,PerBytes, eventList,MaxFileSize,rands,stats); } // General methods to return attributes public boolean isIdleServer() { return (getNumIdle() > 0); } public int getNumServers() { return this.numServers; } public Server getServer(int Num) { return this.serverList[Num]; } public int getNumIdle() { int NumIdle=0; for (int i = 0; i