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

A

algorithm - Variable in class Warehouse
The algorithm used by this Warehouse.
algorithm1() - Method in class Warehouse
Tries to satisfy and release one or more customers.
algorithm2() - Method in class Warehouse
Tries to satisfy and release one or more customers.
algorithm3() - Method in class Warehouse
Tries to satisfy and release one or more customers.
algorithm4() - Method in class Warehouse
Tries to satisfy and release one or more customers.
alloc - Variable in class Request
The amount allocated thus far.
amt - Variable in class Order
The actual mapping.
arg - Variable in class GetOpt
The flags argument currently in use.
argv - Variable in class GetOpt
The arguments to main (note that argv[0] is the first arg, not the class name.
await() - Method in class Request
Await fulfillment of this order.

B

Brewer - Class in <Unnamed>
A consumer of grain.
Brewer(int) - Constructor for class Brewer
Creates a new Brewer object.
brewerCount - Static variable in class P3
Number of Brewers.
brewers - Static variable in class P3
Brewers.
brewers() - Static method in class P3
Returns the number of Brewers in the system.
brewerThreads - Static variable in class P3
Brewer threads.

C

change(Grain, int) - Method in class Order
Changes the mount of "g" by "diff".
change(Order) - Method in class Order
Changes the amount of each grain g by incr.get(g).
complete() - Method in class Request
Signal completion.
completed - Variable in class Request
Flag to indicate this Request is satisfied.
consume(Order) - Method in class Brewer
Consumes the indicated amounts of resources.
consumed - Variable in class Brewer
Total consumed thus far.
copy() - Method in class Order
Returns a copy of this Order.

D

debug(Object) - Static method in class P3
If the debugging flag is on, prints a message, preceded by the name of the current thread.
debug(String, Object...) - Static method in class P3
If the debugging flag is on, prints a message, preceded by the name of the current thread.
deliver(Order) - Method in class Warehouse
Accepts more grain from the supplier.
delivered - Variable in class Supplier
Total delivered thus far.
delivered - Variable in class Warehouse
The total amount delivered to Customers.

E

enqueue(int, Order) - Method in class Warehouse
Creates a Request object and places it onto the waiters list.
expo(int) - Static method in class P3
Generates an exponentially distributed random number.

F

fulfilled - Variable in class Warehouse
Number of requests fulfilled.

G

get(Grain) - Method in class Order
Gets the amount of "g" in this order.
get(int, Order) - Method in class Warehouse
Accepts a request from a Brewer and blocks the Brewer until the request can be satisfied.
getAlloc() - Method in class Request
Gets the current allocation to this request.
getAmountOnHand() - Method in class Warehouse
Reports on the total amount of grain held by this Warehouse.
getConsumption() - Method in class Brewer
Reports on the total amount consumed thus far.
GetOpt - Class in <Unnamed>
Java version of GNU getopt.
GetOpt(String, String[], String, GetOpt.LongOption[], boolean) - Constructor for class GetOpt
Create a new option parser.
GetOpt(String, String[], String) - Constructor for class GetOpt
Create a new option parser.
GetOpt(String, String[], String, GetOpt.LongOption[]) - Constructor for class GetOpt
Create a new option parser.
GetOpt.LongOption - Class in <Unnamed>
A record used in a table of option descriptions passed to a constructor of GetOpt.
GetOpt.LongOption(String, int, char) - Constructor for class GetOpt.LongOption
Create a LongOption from its components.
getProduction() - Method in class Supplier
Indicates the amount of each grain delivered.
getWarehouse() - Static method in class P3
Returns the unique Warehouse instance.
give(Order, int) - Method in class Request
Allocate some grain to this Request from supply.
Grain - Enum in <Unnamed>
Names of grain types.
Grain() - Constructor for enum Grain
 

H

hasArg - Variable in class GetOpt.LongOption
A flag, one of GetOpt.NO_ARG, GetOpt.REQ_ARG, or GetOpt.OPT_ARG.

I

id - Variable in class Brewer
Id of this Brewer.
id - Variable in class Request
The requesting customer's id (for debugging output).
iterations - Variable in class Supplier
Number of times to iterate before terminating.

L

lessOrEqual(Order) - Method in class Request
Check whether the unfilled portion of this request is less than or equal to supply (in all grains).
longind - Variable in class GetOpt
Index in longopts of a long-named option found.
longonly - Variable in class GetOpt
Flag to indicate that only long options should be recognized.
longopts - Variable in class GetOpt
Table of long options.

M

main(String[]) - Static method in class GetOpt
Main program for testing.
main(String[]) - Static method in class P3
Main program for project 3.
maxRequest - Variable in class Brewer
Maximum amount of each grain to ask for on each request.
maxSupply - Variable in class Supplier
Maximum amount of each grain to supply on each iteration.
meanSleepTime - Variable in class Brewer
Mean sleep time (in milliseconds) between purchase requests.
meanSleepTime - Variable in class Supplier
Mean time to sleep between iterations (in milliseconds).

N

name - Variable in class GetOpt.LongOption
The option name (for example, "color").
nextchar - Variable in class GetOpt
The index in arg of the next option flag to be examined.
nextOpt() - Method in class GetOpt
Return the next option.
nextSeq - Static variable in class Request
Source of sequence numbers.
NO_ARG - Static variable in class GetOpt
A value for LongOption.has Arg meaning "option has no argument".
NUM_ALGORITHMS - Static variable in class Warehouse
The number of algorithms implemented.
numberOfRequests - Variable in class Brewer
Number of requests completed so far.

O

onHand - Variable in class Warehouse
The current stock on hand.
OPT_ARG - Static variable in class GetOpt
A value for LongOption.has Arg meaning "option has an optional argument".
optarg - Variable in class GetOpt
For communication from nextOpt() to the caller.
opterr - Variable in class GetOpt
If set to false, do not print messages to System.err for unrecognized options.
optind - Variable in class GetOpt
Index in argv of the next element to be scanned.
optopt - Variable in class GetOpt
Set to an option character which was unrecognized.
Order - Class in <Unnamed>
An order.
Order() - Constructor for class Order
Creates a new Order with all amounts zero.

P

P3 - Class in <Unnamed>
The Project 3 main class.
P3() - Constructor for class P3
 
pl(Object) - Static method in class GetOpt
Helper function to main: prints a message to System.err.
printErr(String, String, String) - Method in class GetOpt
A convenience routine to print an error to System.err if opterr is true.
progname - Variable in class GetOpt
The "program" (class) name (counterpart of argv[0] in Unix).

R

rand - Static variable in class P3
Random number generator.
randChoice() - Static method in enum Grain
 
randInt(int) - Static method in class P3
Utility to generate a random non-negative integer less than max.
randInt(int, int) - Static method in class P3
Utility to generate a random integer between min and max (inclusive).
recordFulfillment(Order) - Method in class Warehouse
Record the fact that an order was fulfilled.
remaining() - Method in class Request
Return the remaining amount requested.
REQ_ARG - Static variable in class GetOpt
A value for LongOption.has Arg meaning "option has a required argument".
Request - Class in <Unnamed>
A request from a Brewer to the warehouse.
Request(int, Order) - Constructor for class Request
Creates a new Request.
requested - Variable in class Request
The original amount requested.
requestsCompleted() - Method in class Brewer
Returns the number of requests to the Warehouse successfully completed by this Brewer.
run() - Method in class Brewer
Main loop.
run() - Method in class Supplier
Main loop.
run() - Method in class Warehouse
Main loop.

S

satisfied() - Method in class Request
Check whether this order is satified.
seq - Variable in class Request
The sequence number of this request in the order received.
set(Grain, int) - Method in class Order
Sets the amount of "g" to "n".
set(int) - Method in class Order
Sets the amounts of all grains to "n".
setVerbose(boolean) - Static method in class P3
Turns debugging output on or off.
shortopts - Variable in class GetOpt
Short option flags.
size() - Method in class Request
Return the total amount requested.
startTime - Static variable in class P3
Startup time (used to support the time() method.
supplied - Variable in class Warehouse
The total amount received from the Supplier.
supplier - Static variable in class P3
The unique supplier.
Supplier - Class in <Unnamed>
A supplier of grain.
Supplier(int) - Constructor for class Supplier
Creates a new supplier.

T

time() - Static method in class P3
Handy procedure for timing.
tokenize(String) - Static method in class GetOpt
Helper procedure for main.
toString() - Method in class GetOpt.LongOption
Convert this option into a printable string.
toString() - Method in class Order
Returns a readable version of this order.
toString() - Method in class Request
Turn a Request into a printable string.
total() - Method in class Order
Returns the total amount of grain in this order.
totalServiceTime - Variable in class Brewer
Sum of service times for all requests.

U

undo(Order) - Method in class Warehouse
Accepts back grain from an interrupted request.
usage() - Static method in class P3
Prints a usage message and terminates.

V

val - Variable in class GetOpt.LongOption
The equivalent short (one-char) option name (for example 'c').
valueOf(String) - Static method in enum Grain
Returns the enum constant of this type with the specified name.
values() - Static method in enum Grain
Returns an array containing the constants of this enum type, in the order they're declared.
verbose - Static variable in class P3
Flag to control debugging output.
VERSION - Static variable in class Brewer
Source version number.
VERSION - Static variable in class GetOpt.LongOption
Source code version.
VERSION - Static variable in class GetOpt
Source code version.
VERSION - Static variable in enum Grain
Source version number.
VERSION - Static variable in class Order
Source version number.
VERSION - Static variable in class P3
Source version number.
VERSION - Static variable in class Request
Source version number.
VERSION - Static variable in class Supplier
Source version number.
VERSION - Static variable in class Warehouse
Source version number.

W

waiters - Variable in class Warehouse
Queue of waiting requests.
waitingTime() - Method in class Brewer
Returns the time in milliseconds this Brewer has spent waiting.
warehouse - Static variable in class P3
The unique Warehouse.
Warehouse - Class in <Unnamed>
A centralized supplier of grain.
Warehouse(int) - Constructor for class Warehouse
Creates a new Warehouse.

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