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

A

about() - Method in class jutil.AppModel
Override in subcclasses
about() - Method in class jutil.Console
Prints information about the console. This method may be overriden in subclasses to provide application-specific information, where super.about can be called.
actionPerformed(ActionEvent) - Method in class jutil.AppWindow
Dispatches menu selections to item handlers.
add(WorkerThread) - Method in class jutil.ThreadManager
Add a worker thread to the pool.
AppError - Exception in jutil
Base class for all application-specific errors.
AppError(String) - Constructor for exception jutil.AppError
 
AppError() - Constructor for exception jutil.AppError
 
AppModel - Class in jutil
base class for GUI framework models
AppModel() - Constructor for class jutil.AppModel
 
AppWindow - Class in jutil
Base class for the main application window for the GUI framework.
AppWindow(AppModel) - Constructor for class jutil.AppWindow
 
AppWindow() - Constructor for class jutil.AppWindow
 

B

BinaryHeap - Class in jutil
A binary heap is a complete binary tree except possibly for the bottom level.
BinaryHeap(int) - Constructor for class jutil.BinaryHeap
Initializes capacity to 2^exp.
BinaryHeap() - Constructor for class jutil.BinaryHeap
Initializes capacity to 2^8 = 512.

C

capacity - Variable in class jutil.BinaryHeap
The capacity of the heap is a power of 2.
clear() - Method in class jutil.BinaryHeap
Sets elems[i] to null for each i.
clear() - Method in interface jutil.PriorityQueue
Removes all elements from the queue.
clear() - Method in class jutil.ThreadManager
clear workers list.
clock - Variable in class jutil.Simulator
The simulated time.
close() - Method in class jutil.Correspondent
Closes sock without throwing an exception.
Command - Interface in jutil
Command implementations should be declared as inner classes of the CommandConsole extension.
CommandConsole - Class in jutil
Extends Console by adding a map for storing command objects.
CommandConsole(Serializable) - Constructor for class jutil.CommandConsole
Initializes model reference in Command class.
CommandConsole() - Constructor for class jutil.CommandConsole
Initializes model to null.
commands - Variable in class jutil.CommandConsole
Stores command objects indexed by name.
compareTo(Object) - Method in class jutil.Event
this is less than other if this.fireTime is before other.fireTime.
Console - Class in jutil
Console is the base class for console user interfaces (CUIs). It provides a simple user interface, a simplified Model-View architecture, an interface to secondary memory, an extensible help facility, and an extensible error handling strategy.
Console(Serializable) - Constructor for class jutil.Console
 
Console() - Constructor for class jutil.Console
 
controlLoop() - Method in class jutil.Console
Perpetually: Prompts user for a command Reads command Executes application-independent commands Passes application-dependent commands to execute displays result
controlLoop() - Method in class jutil.SimpleClient
Driver for console user interface.
Correspondent - Class in jutil
Base class for all objects that want to communicate using a socket.
Correspondent() - Constructor for class jutil.Correspondent
This constructor does not initialize any fields.
Correspondent(Socket) - Constructor for class jutil.Correspondent
Initializes all fields.
currentDirectory - Variable in class jutil.AppWindow
Saves model to this file

D

debug - Variable in class jutil.Simulator
Set to true to see the clock and event queue after each event is fired.
DEBUG - Variable in class jutil.WorkerThread
Set to true to see diagnostics
deleteMin() - Method in class jutil.BinaryHeap
Removes and returns the smallest element.
deleteMin() - Method in interface jutil.PriorityQueue
Removes and returns the highest priority element.

E

elems - Variable in class jutil.BinaryHeap
The children of elems[i] are stored in elems[2i] and elems[2i + 1], the root (= min) is in elems[1].
EmptyQueueException - Exception in jutil
 
EmptyQueueException() - Constructor for exception jutil.EmptyQueueException
 
error(String) - Method in class jutil.AppWindow
Displays an error message dialog.
error(String) - Static method in class jutil.IOUtils
Prints an error message to stderr.
Event - Class in jutil
Used by the Sim framework to represent events in a simulation.
Event(int) - Constructor for class jutil.Event
Initializes fireTime.
Event() - Constructor for class jutil.Event
Sets fire time to 0.
events - Variable in class jutil.Simulator
Scheduled events are placed in this queue in order of their firing times.
execute(String) - Method in interface jutil.Command
 
execute(String) - Method in class jutil.Console
This method executes application-specific commands and must be implemented by subclasses.

F

fileMenu - Variable in class jutil.AppWindow
 
fileName - Variable in class jutil.AppModel
Store model in this file
fire() - Method in class jutil.Event
Override this method in subclasses.
fireTime - Variable in class jutil.Event
The time when this event will occur.
fname - Variable in class jutil.Console
Name of file where the model will be saved.

G

getCommand(String) - Method in class jutil.CommandConsole
A utility for fetching commands.
getFileName() - Method in class jutil.AppModel
 
getFireTime() - Method in class jutil.Event
 
getFname() - Method in class jutil.Console
A helper function that prompts the user for a file name.
getUnsavedChanges() - Method in class jutil.AppModel
 
getValue() - Method in class jutil.Semaphore
 

H

halt() - Method in class jutil.WorkerThread
Safely halt this thread.
haltAll() - Method in class jutil.ThreadManager
Safely halts all workers
handle(AppError) - Method in class jutil.Console
Handles all application-specific exceptions by printing an error message to stderr. This method may be overriden in subclasses to provide application-specific error handling strategies.
handle(Exception) - Method in class jutil.Simulator
Handles errors by terminating the simulation.
handleAbout() - Method in class jutil.AppWindow
Help/About handler.
handleExit() - Method in class jutil.AppWindow
File/Exit handler
handleHelp() - Method in class jutil.AppWindow
Help/Help handler.
handleNew() - Method in class jutil.AppWindow
File/New handler.
handleOpen() - Method in class jutil.AppWindow
File/Open handler.
handlerType - Variable in class jutil.Server
Subclass of RequestHandler to be used for incoming requests.
handleSave() - Method in class jutil.AppWindow
File/Save handler.
handleSaveAs() - Method in class jutil.AppWindow
File/Save_As handler.
help() - Method in class jutil.AppModel
Override in subcclasses
help() - Method in class jutil.Console
Displays help for application-independent commands. This method may be overriden in subclasses to provide application-specific help, where super.help can be called.
helpMenu - Variable in class jutil.AppWindow
 

I

id - Variable in class jutil.WorkerThread
This threads id number.
IDENTIFIER - Static variable in class jutil.Lex
This regular expression is matched by any alphanumeric sequence beginning with a letter.
initStreams() - Method in class jutil.Correspondent
initializes the reader and writer fields.
insert(Comparable) - Method in class jutil.BinaryHeap
Inserts element according to its natural order.
insert(Comparable) - Method in interface jutil.PriorityQueue
Inserts an element according to its priority.
IOUtils - Class in jutil
Utilities for console and file I/O.
IOUtils() - Constructor for class jutil.IOUtils
 
isEmpty() - Method in class jutil.BinaryHeap
Returns true if size is 0.
isEmpty() - Method in interface jutil.PriorityQueue
 
isLocked() - Method in class jutil.Lock
 
isPaused() - Method in class jutil.WorkerThread
 
isStopped() - Method in class jutil.WorkerThread
 

J

join(String, String) - Static method in class jutil.Lex
A utility for joining two patterns.
joinAll() - Method in class jutil.ThreadManager
Joins all workers.
joinAll(long) - Method in class jutil.ThreadManager
Join all workers until the stop or a timeout occurs.
jutil - package jutil
 

L

Lex - Class in jutil
Lexical analysis utilities.
Lex() - Constructor for class jutil.Lex
 
listen() - Method in class jutil.Server
Perpetually listens for incoming client requests, the spawns a request handler slave to handle the request.
load() - Method in class jutil.Console
Loads a mnodel from a file. User will be prompted for a file name.
Lock - Class in jutil
The methods in this class are meant to mimic the indivisible swap and testAndSet instructions provided by most computers.
Lock(boolean) - Constructor for class jutil.Lock
 
Lock() - Constructor for class jutil.Lock
sets lock to false
lock() - Method in class jutil.Lock
sets lock to true without interruption.
locked - Variable in class jutil.Lock
if true, then lock is locked

M

main(String[]) - Static method in class jutil.AppWindow
test
main(String[]) - Static method in class jutil.Server
Users may specify the port and request handler subclass at the command line.
main(String[]) - Static method in class jutil.SimpleClient
Allows user to specify the server at the command line.
MainJFrame - Class in jutil
 
MainJFrame() - Constructor for class jutil.MainJFrame
 
MainJFrame.Terminator - Class in jutil
 
MainJFrame.Terminator() - Constructor for class jutil.MainJFrame.Terminator
 
makeHandler(Socket) - Method in class jutil.Server
Creates a request handler equipped with a socket connected to the client.
makeMenu(String, String[]) - Method in class jutil.AppWindow
Creates a JMenu named name containing items listed in the items array.
makeReader(String) - Static method in class jutil.IOUtils
A factory for turning file names into character input streams.
makeWriter(String) - Static method in class jutil.IOUtils
A factory for turning file names into character output streams.
maxValue - Variable in class jutil.Semaphore
max # of threads allowed to access some resource
menuBar - Variable in class jutil.AppWindow
 
model - Variable in class jutil.Console
Reference to the model. This is the component that encapsulates application data and logic.
myPort - Variable in class jutil.Server
The server's port.
mySocket - Variable in class jutil.Server
The server will listen for incoming requests on this socket.

N

nextID - Static variable in class jutil.WorkerThread
An ID generator.
NUMBER - Static variable in class jutil.Lex
This regular expression is matched by any sequence of digits possibly containing a decimal point.

O

OPERATOR - Static variable in class jutil.Lex
This regular expression is matched by common arithmetic operators.
OverflowException - Exception in jutil
This exception is thrown by static data structures when they are full.
OverflowException() - Constructor for exception jutil.OverflowException
 

P

pause - Variable in class jutil.WorkerThread
set to true to pause the thread
pause() - Method in class jutil.WorkerThread
Safely pause this thread
pauseAll() - Method in class jutil.ThreadManager
Safely pauses all workers.
percolateDown(int) - Method in class jutil.BinaryHeap
A helper method that repeatedly swaps a node with its smaller child until there are no smaller children.
print(PrintWriter, String) - Static method in class jutil.IOUtils
Prints a message to a character output stream without a newline.
print(String) - Static method in class jutil.IOUtils
Prints a message to stdout without a newline.
println(PrintWriter, String) - Static method in class jutil.IOUtils
Prints a message to a character output stream with a newline.
println(String) - Static method in class jutil.IOUtils
Prints a message to stdout with a newline.
PriorityQueue - Interface in jutil
A queue sorted by priority.
probe() - Method in class jutil.Semaphore
waits until value is positive, then decrements it
Profiler - Class in jutil
The class contains primitive utilities for profiling method calls.
Profiler() - Constructor for class jutil.Profiler
 
prompt - Variable in class jutil.Console
The prompt displayed by the control loop.
PUNCTUATION - Static variable in class jutil.Lex
This regular expression is matched by parenthesis, curly braces, braces, and the semicolon.

R

readLine(BufferedReader) - Static method in class jutil.IOUtils
Reads a line from a reader without throwing an exception.
readLine() - Static method in class jutil.IOUtils
Reads a line from stdin without throwing an exception.
receive() - Method in class jutil.Correspondent
Receives a message from server.
requestConnection(String, int) - Method in class jutil.Correspondent
Initializes sock and other fields by requesting a connection to a server.
RequestHandler - Class in jutil
Base class of all request handler slaves.
RequestHandler() - Constructor for class jutil.RequestHandler
This constructor does not initialize inherited fields.
RequestHandler(Socket) - Constructor for class jutil.RequestHandler
Initializes all fields using provided socket.
response(String) - Method in class jutil.RequestHandler
Override this method in a subclass.
run() - Method in class jutil.RequestHandler
Perpetually receives a message from the client, creates a response, then sends the response back to the client.
run() - Method in class jutil.Simulator
Repeatedly removes the next event from the event queue, updates the clock, and fires the event.
run() - Method in class jutil.WorkerThread
repeatedly calls the task method until the thread is stopped or the task method returns false.

S

save(boolean) - Method in class jutil.Console
Saves model to a file. If no file name has been specified yet, or if this method was called by the "save as" command, then the user will be prompted for a file name.
saveChanges() - Method in class jutil.AppWindow
Warns user of unsaved changes before quitting or opening a new model.
saveChanges() - Method in class jutil.Console
Prompts user to save model if there are unsaved changes.
scan(String, String) - Static method in class jutil.Lex
Breaks a string into a list of tokens.
schedule(Event) - Method in class jutil.Simulator
Adds events to the events queue.
Semaphore - Class in jutil
 
Semaphore(int) - Constructor for class jutil.Semaphore
 
Semaphore() - Constructor for class jutil.Semaphore
sets maxValue to 1
send(String) - Method in class jutil.Correspondent
Sends a message to the server.
seriousError(String) - Static method in class jutil.IOUtils
Prints an error message to stdout then terminates the application.
Server - Class in jutil
A simple reusable server.
Server() - Constructor for class jutil.Server
Initializes port to 5555.
Server(int) - Constructor for class jutil.Server
Initializes port, sets handlerType to RequestHandler.
Server(int, String) - Constructor for class jutil.Server
Initializes port and handler type.
setFileName(String) - Method in class jutil.AppModel
 
setSocket(Socket) - Method in class jutil.RequestHandler
Initialize all fields using the socket provided.
setUnsavedChanges(boolean) - Method in class jutil.AppModel
Call this each time the application data is modified.
signal() - Method in class jutil.Semaphore
increments value and notifies all waiters.
SimpleClient - Class in jutil
A command line interface to a remote server.
SimpleClient(String, int) - Constructor for class jutil.SimpleClient
Connects client to some server, initializes standard I/O streams.
SimpleClient(int) - Constructor for class jutil.SimpleClient
Connects client to server running on local host.
Simulator - Class in jutil
The Sim framework consists of the Simulator, Events, and priority queue.
Simulator(PriorityQueue) - Constructor for class jutil.Simulator
 
Simulator() - Constructor for class jutil.Simulator
Initializes event queue as a binary heap.
size - Variable in class jutil.BinaryHeap
The number of elements stored.
size() - Method in class jutil.BinaryHeap
Returns the size of the heap.
size() - Method in interface jutil.PriorityQueue
 
sock - Variable in class jutil.Correspondent
The socket for this correspondent
sockIn - Variable in class jutil.Correspondent
Connected to sock's output stream
sockOut - Variable in class jutil.Correspondent
Connected to sock's input stream
start(String) - Static method in class jutil.Profiler
Call this method just before the method call you want to time.
start() - Static method in class jutil.Profiler
same as start but with no message.
startAll() - Method in class jutil.ThreadManager
Start all workers.
startTime - Static variable in class jutil.Profiler
The timer
stderr - Variable in class jutil.Console
Standard error stream.
stderr - Static variable in class jutil.IOUtils
Represents standard error stream; default destination is console window unless redirected at the command line.
stderr - Variable in class jutil.SimpleClient
Standard error output (the console window)
stdin - Variable in class jutil.Console
Standard input stream.
stdin - Static variable in class jutil.IOUtils
Represents standard input stream; default source is keyboard unless redirected at the command line.
stdin - Variable in class jutil.SimpleClient
Standard input (the keyboard)
stdout - Variable in class jutil.Console
Standard output stream.
stdout - Static variable in class jutil.IOUtils
Represents standard output stream; default destination is console window unless redirected at the command line.
stdout - Variable in class jutil.SimpleClient
Standard output (the console window)
stop(String) - Static method in class jutil.Profiler
Call this method immediately after the method call.
stop() - Static method in class jutil.Profiler
Same as start with no message.
stop - Variable in class jutil.WorkerThread
set to true to stop the thread.
swap(Lock) - Method in class jutil.Lock
Swaps this locks state with the state of another lock without interruption.

T

task() - Method in class jutil.WorkerThread
Override this method with the basic thread task.
testAndSet() - Method in class jutil.Lock
sets lock to true without interruption
theModel - Variable in class jutil.AppWindow
The application model
ThreadManager - Class in jutil
The thread manager is an extensible class that safely manages a pool of worker threads.
ThreadManager() - Constructor for class jutil.ThreadManager
 
toArray() - Method in class jutil.BinaryHeap
Converts heap into a sorted array.
tokenize(String) - Static method in class jutil.IOUtils
Parses a string into a sequence of tokens.
toString() - Method in class jutil.BinaryHeap
Converts heap into a LISP-style string representation of a heap.
toString(int) - Method in class jutil.BinaryHeap
Recursively converts the heap rooted at element i into a LISP style string representation of a tree.
toString() - Method in class jutil.Event
 
toString() - Method in class jutil.ThreadManager
 

U

unlock() - Method in class jutil.Lock
Sets lock to false without interruption.
unpause() - Method in class jutil.WorkerThread
Safely unpause this thread.
unpauseAll() - Method in class jutil.ThreadManager
Safely unpauses all the workers.
unsavedChanges - Variable in class jutil.AppModel
Set to true when the model is updated.
unsavedChanges - Variable in class jutil.Console
This flag should be set to true each time the model is modified.

V

value - Variable in class jutil.Semaphore
# of threads currently allowed to access some resource

W

windowClosing(WindowEvent) - Method in class jutil.MainJFrame.Terminator
 
workers - Variable in class jutil.ThreadManager
The pool of worker threads to be managed.
WorkerThread - Class in jutil
Base class for all threads that need to be safely stopped, paused, and unpaused.
WorkerThread(String, int) - Constructor for class jutil.WorkerThread
 
WorkerThread(int) - Constructor for class jutil.WorkerThread
 
WorkerThread(String) - Constructor for class jutil.WorkerThread
 
WorkerThread() - Constructor for class jutil.WorkerThread
 

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