|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Project3
The Project 3 main class.
Field Summary | |
private static Thread[] |
cthread
Array of Customer threads. |
private static Customer[] |
customer
Array of Customer instances. |
private static int |
customerCount
Number of customers (from the command line). |
private static long |
startTime
Startup time (used to support the time() method. |
private static Supplier |
supplier
The unique Supplier. |
private static Trader |
trader
The unique Trader. |
private static boolean |
verbose
Flag to control debugging output. |
Fields inherited from interface Enron |
cname, COAL, COMMODITIES, cunit, ELEC, GAS, OIL |
Constructor Summary | |
Project3()
|
Method Summary | |
static int |
customers()
Get the number of customers. |
static void |
debug(Object message)
Debug print. |
static int |
expo(Random rand,
int mean)
Generate an exponentially distributed random number. |
static void |
main(String[] args)
Main program for project 3. |
static String |
orderToString(int[] order)
Turn an order into a printable string. |
static void |
setVerbose(boolean onOff)
Turn debugging output on or off. |
static int |
time()
Handy procedure for timing. |
private static void |
usage()
Print a usage message and terminate. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static Customer[] customer
private static Thread[] cthread
private static Trader trader
private static Supplier supplier
private static long startTime
private static boolean verbose
private static int customerCount
Constructor Detail |
public Project3()
Method Detail |
public static int customers()
public static void setVerbose(boolean onOff)
onOff
- if true, turn debugging on; otherwise turn it off.public static void debug(Object message)
message
- the message to print.public static int time()
public static String orderToString(int[] order)
order
- an indication of the amount of each commodity desired.public static int expo(Random rand, int mean)
rand
- the source of random numbers.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 |