|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object P3
public class P3
The Project 3 main class.
CS 537, Spring 2007, Project 3.
Field Summary | |
---|---|
private static int |
brewerCount
Number of Brewers. |
private static Brewer[] |
brewers
Brewers. |
private static Thread[] |
brewerThreads
Brewer threads. |
private static Random |
rand
Random number generator. |
private static long |
startTime
Startup time (used to support the time() method. |
private static Supplier |
supplier
The unique supplier. |
private static boolean |
verbose
Flag to control debugging output. |
private static int |
VERSION
Source version number. |
private static Warehouse |
warehouse
The unique Warehouse. |
Constructor Summary | |
---|---|
P3()
|
Method Summary | |
---|---|
static int |
brewers()
Returns the number of Brewers in the system. |
static void |
debug(Object message)
If the debugging flag is on, prints a message, preceded by the name of the current thread. |
static void |
debug(String format,
Object... args)
If the debugging flag is on, prints a message, preceded by the name of the current thread. |
static int |
expo(int mean)
Generates an exponentially distributed random number. |
static Warehouse |
getWarehouse()
Returns the unique Warehouse instance. |
static void |
main(String[] args)
Main program for project 3. |
static int |
randInt(int max)
Utility to generate a random non-negative integer less than max. |
static int |
randInt(int min,
int max)
Utility to generate a random integer between min and max (inclusive). |
static void |
setVerbose(boolean on)
Turns debugging output on or off. |
static int |
time()
Handy procedure for timing. |
private static void |
usage()
Prints a usage message and terminates. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int VERSION
private static int brewerCount
private static Warehouse warehouse
private static Brewer[] brewers
private static Thread[] brewerThreads
private static Supplier supplier
private static long startTime
private static boolean verbose
private static Random rand
Constructor Detail |
---|
public P3()
Method Detail |
---|
public static void setVerbose(boolean on)
on
- if true, turn debugging on; otherwise turn it off.public static Warehouse getWarehouse()
public static void debug(Object message)
message
- the message to print.public static void debug(String format, Object... args)
format
- a printf-like format for the messageargs
- arguments to the printfpublic static int time()
public static int brewers()
public static int randInt(int max)
max
- integer one greater than the largest possible result.
public static int randInt(int min, int max)
min
- the smallest possible result.max
- the largest possible result.
public static int expo(int mean)
mean
- the mean of the distribution.
private static void usage()
public static void main(String[] args)
args
- the command-line arguments.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |