A B C D E F G H I L M N P Q R S T W

A

addArrivals() - Method in class Simulation
Adds all of the arrivals to the schedule in a uniform fashion.
addEvent(Event, double) - Method in class Clock
Adds a specified event at a certain time to the simulation clock
addRunTime(double) - Method in class SimulationStats
Adds the total running time for a Simulation to this set of stats
addToQueue(Party) - Method in class Simulation
If a party is not able to find a table to be seated at, they will be inserted into some queue.
addToQueue(Party) - Method in class Simulation1
If a table is not available for the party, the party will be added to a queue.
addToQueue(Party) - Method in class Simulation2
If a table is not available for the party, the party will be added to this "queue".
addWaitTime(double, int) - Method in class SimulationStats
Adds a new waiting time for a specified party size to the statistics.
ArrivalEvent - class ArrivalEvent.
A class used to represent an arrival event in the lunch-seating simulation.
ArrivalEvent(Party) - Constructor for class ArrivalEvent
Creates a new ArrivalEvent.
arrivalTime - Variable in class Party
When the party arrives for lunch
arrivalTime() - Method in class Party
Returns the time this Party will arrive, represented as minutes since the start of lunch.
arrivalTime() - Method in class Simulation
Returns a arrival time.
arrivalTimer - Variable in class EventTimer
A random number generator to generate arrival times
average(double[], int) - Method in class SimulationStats
Computes and returns the average of all values in an array

B

back - Variable in class Queue
 

C

Clock - class Clock.
The clock used to run the lunch simulation.
Clock() - Constructor for class Clock
Creates a new Clock.
Clock(double) - Constructor for class Clock
Creates a new Clock, with a specified starting time
contains(Object) - Method in class Queue
Tests if the specified object is in the queue.
countNonZero(double[]) - Method in class SimulationStats
Counts and returns the number of non-zero elements in a specified array
counts - Variable in class SimulationStats
How many of each party size has finished eating.
currentTime - Variable in class Clock
The current time in the simulation: time passed since the start of lunch.

D

data - Variable in class ListNode
 
data - Variable in class PriorityQueue
Contains all of the data in this PriorityQueue
DepartureEvent - class DepartureEvent.
A class used to represent a departure event in the lunch-seating simulation.
DepartureEvent(Party, int) - Constructor for class DepartureEvent
Creates a new DepartureEvent.
dequeue() - Method in class Queue
Removes the object from the front of the queue and returns that object as the value of this method.
doubleArrays() - Method in class PriorityQueue
Doubles the size of arrays for priorities and data

E

eatingTime - Variable in class Party
How long the party will take to eat
eatingTime() - Method in class Party
Returns how many minutes it will take for this Party to finish eating
eatingTime() - Method in class Simulation
Returns an eating time.
eatingTimer - Variable in class EventTimer
A random number generator to generate eating times
enqueue(Object) - Method in class Queue
Adds a new item to the end of the Queue.
Event - class Event.
An abstract class used in a Simulation to indicate a significant event.
Event() - Constructor for class Event
 
EventTimer - class EventTimer.
A class used to assign random times to all of the events which take place in the lunch-seating simulation.
EventTimer() - Constructor for class EventTimer
Creates a new, non-seeded EventTimer
EventTimer(long, long) - Constructor for class EventTimer
Creates a new EventTimer.
expand(double[], int) - Method in class SimulationStats
Converts an array of values into an expanded array of values by duplicating each value in the array multiplier number of times.

F

findMinPriority(int, int) - Method in class PriorityQueue
Returns the index of the node with the lower priority
findTable(Party) - Method in class Simulation
A method to choose the table the party will sit at.
findTable(Party) - Method in class Simulation1
Attempts to find a table for the specified party.
findTable(Party) - Method in class Simulation2
Attempts to find a table for the specified party.
finished() - Method in class Clock
Checks if there are no more events in the simulation
formatter - Static variable in class SimulationStats
Used for pretty printing.
freeTable(int) - Method in class Simulation
Frees a table of the specified size.
freeTable(int) - Method in class Simulation1
Frees a table of a specific size.
freeTable(int) - Method in class Simulation2
Frees a table of a specific size.
front - Variable in class Queue
 

G

getCurrentTime() - Method in class Clock
Returns the current time
getData() - Method in class ListNode
Returns this ListNode's data
getHeader() - Method in class SimulationStats
Returns a header which shows the meaning of all output values
getNext() - Method in class ListNode
Returns the next ListNode in the chain.
getParty() - Method in class ArrivalEvent
Returns the party waiting to be seated.
getParty() - Method in class DepartureEvent
Returns the party which is departing
getRunTime() - Method in class SimulationStats
Returns the run times for this set of statistics
getTable() - Method in class DepartureEvent
Returns the size of table the party was seated at

H

hasLeftChild(int) - Method in class PriorityQueue
Returns true iff the specified node has a left child
hasRightChild(int) - Method in class PriorityQueue
Returns true iff the specified node has a right child
heapifyDown(int) - Method in class PriorityQueue
Restores the heap ordering property at the specified index by pushing it downwards to its correct location
heapifyUp() - Method in class PriorityQueue
Moves the item at the current index up until it gets to the correct location in the heap

I

index - Variable in class PriorityQueue
The index of the most recently inserted item
insert(double, double[], int) - Method in class SimulationStats
Inserts a value into an array of values, such that the array remains in sorted order.
insert(Object, double) - Method in class PriorityQueue
Adds a new item to this PriorityQueue.
isArrival() - Method in class ArrivalEvent
Indicates that this is an arrival event
isArrival() - Method in class DepartureEvent
Indicates that this is not an arrival event
isArrival() - Method in class Event
Indicates whether or not this Event is an arrival event.
isEmpty() - Method in class PriorityQueue
Tests if this PriorityQueue contains any items
isEmpty() - Method in class Queue
Tests if this Queue is empty
isFree(int) - Method in class Simulation
Checks is there is a table of the specified size available for immediate seating.

L

leftChild(int) - Method in class PriorityQueue
Returns the index of the left child of the specified node
ListNode - class ListNode.
This is the a node for a singly-linked list, which is capable of holding an type of Object.
ListNode() - Constructor for class ListNode
Creates a completely blank ListNode
ListNode(Object) - Constructor for class ListNode
Creates a new ListNode containing the specified data type.
ListNode(Object, ListNode) - Constructor for class ListNode
Creates a new ListNode object containing specified data and next references.
LUNCH_TIME - Static variable in class EventTimer
The number of minutes that lunch is served on the cruise ship

M

main(String[]) - Static method in class Tester
This is the method which tests and displays the results for both types of simulations.
MAX_EATING_TIME - Static variable in class EventTimer
The maximum amount of time a party can take to eat their lunch
MAX_PARTY_SIZE - Static variable in class Simulation
The maximum possible size of a party
median(double[], int) - Method in class SimulationStats
Computes and returns the median value in a sorted array of values
merge(double[], int, double[], int) - Method in class SimulationStats
Merges two arrays, already assumed to be in sorted order, into a larger array in sorted order.
MIN_EATING_TIME - Static variable in class EventTimer
The minimum amount of time a party can take to eat their lunch
MIN_PARTY_SIZE - Static variable in class Simulation
The minimum possible size of a party

N

next - Variable in class ListNode
 
nextArrivalTime() - Method in class EventTimer
Returns a pseudo-random number in the range [0, LUNCH_TIME]
nextEatingTime() - Method in class EventTimer
Returns a pseudo-random number in the range [MIN_EATING_TIME, MAX_EATING_TIME]
nextEvent() - Method in class Clock
Returns the next event from the simulation

P

parent(int) - Method in class PriorityQueue
Returns the index of the parent of the specified node
party - Variable in class Event
The party involved in this event
Party - class Party.
A class to represent a party in the lunch simulation.
PARTY_SIZES - Static variable in class Simulation
An array of all of the various party sizes.
Party(int, double, double) - Constructor for class Party
Creates a new instance of a Party, with specified characteristics
partySize - Variable in class Party
The size of the party
partySize() - Method in class Party
Returns the size of this party
peek() - Method in class PriorityQueue
Returns the item with the smallest priority in this PriorityQueue.
peek() - Method in class Queue
Return the object at the front of this queue.
peekPriority() - Method in class PriorityQueue
Returns the priority of the smallest priority item in this PriorityQueue
priorities - Variable in class PriorityQueue
The priorities associated with each element in the array of data
PriorityQueue - class PriorityQueue.
Builds a MinHeap of Objects.
PriorityQueue() - Constructor for class PriorityQueue
Constructs a new, initially empty, PriorityQueue
PriorityQueue(int) - Constructor for class PriorityQueue
Constructs a new, initially empty PriorityQueue with a specified depth
processArrival(ArrivalEvent) - Method in class Simulation
A method to process an arrival event.
processDeparture(DepartureEvent) - Method in class Simulation
A method to process a departure event.
processEvent(Event) - Method in class Simulation
This method forwards an event to either processArrival or processDeparture, depending upon the type of the event.

Q

Queue - class Queue.
A Queue represents a first-in-first-out (FIFO) data structure: the item deleted is always the item which has been in the queue the longest.
Queue() - Constructor for class Queue
Creates an empty Queue.

R

remove() - Method in class PriorityQueue
Removes and returns the item with the smallest priority from this PriorityQueue
rightChild(int) - Method in class PriorityQueue
Returns the index of the right child of the specified node
ROOT - Static variable in class PriorityQueue
The index of the root node
runCount - Variable in class SimulationStats
The number of Simulations this SimulationStats is keeping track of
runSimulation() - Method in class Simulation
Processes events until there are no more events to process, returning a summary of the simulation statistics
runTime - Variable in class SimulationStats
The total run time for all Simulations this SimulationStats is keeping track of

S

schedule - Variable in class Simulation
The schedule to which all events will be added and extracted
seatAtTable(Party, int) - Method in class Simulation
Seats a party at a certain table size.
setData(Object) - Method in class ListNode
Sets this ListNode's data to be the specified object
setNext(ListNode) - Method in class ListNode
Sets this ListNode's next reference to be the specified ListNode
Simulation - class Simulation.
A class to run the lunch simulation problem.
Simulation(long, long) - Constructor for class Simulation
Creates a new lunch Simulation: initializing tablesTaken, and adding all arrival events to the schedule.
Simulation1 - class Simulation1.
A class which defines a specific lunch simulation seating scheme.
Simulation1(long, long) - Constructor for class Simulation1
Creates a new instance of the simulation.
Simulation2 - class Simulation2.
 
Simulation2(long, long) - Constructor for class Simulation2
Creates a new instance of the simulation.
SimulationStats - class SimulationStats.
A class which hold all of the statistics for a Simulation or set of simulations.
SimulationStats(int[]) - Constructor for class SimulationStats
Initializes all stat keepers based upon expected party sizes
SimulationStats(SimulationStats, SimulationStats) - Constructor for class SimulationStats
Creates a new set of SimulationStats by combining two sets of stats.
size() - Method in class PriorityQueue
The number of items in this PriorityQueue
stats - Variable in class Simulation
Keeps track of all of the statistics for this Simulation
swap(int, int) - Method in class PriorityQueue
Swaps all of the values for two node indices

T

TABLE_COUNTS - Static variable in class Simulation
An array containing the the number of tables for the index's size.
tableSize - Variable in class DepartureEvent
The size of table the party was eating at
tablesTaken - Variable in class Simulation
An array of size MAX_PARTY_SIZE + 1 which keeps track of how many tables have been taken for the index's size.
Tester - class Tester.
This is the file which runs both of the Simulations, and prints all results to the screen.
Tester() - Constructor for class Tester
 
timer - Variable in class Clock
The structure used to store events.
timer - Static variable in class Simulation
The object used to get the times for all of the events
toString() - Method in class Queue
Returns a String representation of the queue.
toString() - Method in class SimulationStats
Returns a summary of all statistics in this set of stats

W

waiting - Variable in class Simulation1
An array of queues to hold all of the parties that are waiting to be seated.
waiting - Variable in class Simulation2
Holds all waiting parties.
waitTimes - Variable in class SimulationStats
The waiting times for the various parties.

A B C D E F G H I L M N P Q R S T W