Package
Class
Tree
Deprecated
Index
Help
PREV NEXT
FRAMES
NO FRAMES
All Classes
A
B
C
D
E
F
G
H
I
M
N
R
S
T
U
V
W
A
ACCEPTABLE_LOSS
- Variable in class
WoolieWar
The acceptable casualty number needed to further the agenda.
B
BattleFront
<
T
extends java.lang.Comparable<
T
>> - Class in
<Unnamed>
The BattleFront is a generic priority queue that orders elements of type T based on their natural order comparison.
BattleFront()
- Constructor for class
BattleFront
Constructor which initializes the head to null, and the current count to 0.
battleFront
- Variable in class
WoolieWar
The battleFront is a priority queue of woolie's that are used to fight the war.
C
compareTo(Woolie)
- Method in class
Woolie
Naturally compare's two woolies first based on rank and then id (from lowest to highest).
conduct()
- Method in class
WoolieWar
The WOOLIEWAR runs on the main thread and is responsible for reporting the current status of the war.
create
- Variable in class
WoolieWar
Used to block multiple recruiters from creating woolie's at the same time and potentially corrupting id's
D
data
- Variable in class
Node
The node's data.
deathToll
- Variable in class
WoolieWar.Warmonger
Tracks the death toll.
dequeue()
- Method in class
BattleFront
Removes and returns the front element from the queue.
dequeue()
- Method in interface
IQueue
Removes the front element from the queue.
E
empty()
- Method in class
BattleFront
Indicates if the queue is empty or not.
empty()
- Method in interface
IQueue
Indicates if the queue is empty or not.
enqueue(T)
- Method in class
BattleFront
Adds an element to the queue based on the priority of the elements.
enqueue(T)
- Method in interface
IQueue
Adds an element to the back of the queue.
F
full()
- Method in class
BattleFront
Indicates if the queue is full or not.
full()
- Method in interface
IQueue
Indicates if the queue is full or not.
G
getData()
- Method in class
Node
Accessor for node's data.
getDeathToll()
- Method in class
WoolieWar.Warmonger
Accessor for the current death toll.
getId()
- Method in class
Woolie
Accessor for the woolie's unique id.
getNext()
- Method in class
Node
Accessor for the next node
getRank()
- Method in class
Woolie
Accessor for the woolie's rank.
H
head
- Variable in class
BattleFront
The head of the queue.
I
id
- Static variable in class
Woolie
An id counter used to keep track of the total number of woolie's that have been created (it should start at 1 and increment after each new Woolie is created).
IQueue
<
T
> - Interface in
<Unnamed>
An interface for a queue collection (FIFO).
M
main(String[])
- Static method in class
WoolieWar
The main method conducts the war of the woolies.
MAX_RECRUITERS
- Variable in class
WoolieWar
The number of recruiters that are out recruiting woolie's.
myId
- Variable in class
Woolie
A unique id for this Woolie.
N
next
- Variable in class
Node
A reference to the next node.
Node
<
T
> - Class in
<Unnamed>
A generic, singly linked node where T represents the data type the node holds.
Node(T)
- Constructor for class
Node
Constructs a node with a data element, and null for the next node.
Node(T, Node<T>)
- Constructor for class
Node
Constructs a node with both data and next element defined.
NUM_RANKS
- Static variable in class
Woolie
The total number of military rankings.
R
rand
- Variable in class
WoolieWar
Used for randomization.
rank
- Variable in class
Woolie
This woolie's military rank.
RECRUITER_SLEEP_TIME
- Variable in class
WoolieWar.Recruiter
The recruiter threads sleep for this random amount of time (ms) before recruiting again.
recruiters
- Variable in class
WoolieWar
The collection of recruiter threads.
run()
- Method in class
WoolieWar.Recruiter
The recruiter work is done here.
run()
- Method in class
WoolieWar.Warmonger
The warmonger's work is done here.
S
serialVersionUID
- Static variable in exception
UnderflowException
setData(T)
- Method in class
Node
Mutator for the node's data.
setNext(Node<T>)
- Method in class
Node
Mutator for the next node.
size
- Variable in class
BattleFront
The current number of elements in the queue.
size()
- Method in class
BattleFront
Indicates how many elements are in the queue
size()
- Method in interface
IQueue
Indicates how many elements are in the queue.
T
toString()
- Method in class
Woolie
Returns a string in the form (where MILITARY_RANK is their ranking, and the id is this woolie's unique id:
{MILITARY_RANK} Woolie({id})
truce
- Variable in class
WoolieWar
Once a truce is reached the war is over.
U
UnderflowException
- Exception in
<Unnamed>
An exception that is generated when an element is accessed or removed from a collection that is already empty.
UnderflowException(String)
- Constructor for exception
UnderflowException
Constructs the exception.
V
valueOf(String)
- Static method in enum
Woolie.Ranking
Returns the enum constant of this type with the specified name.
values()
- Static method in enum
Woolie.Ranking
Returns an array containing the constants of this enum type, in the order they are declared.
W
warmonger
- Variable in class
WoolieWar
The warmonger thread.
WARMONGER_SLEEP_TIME
- Variable in class
WoolieWar.Warmonger
The warmonger sleeps this random amount of time (ms) before getting another woolie from the battle front to fight and die
Woolie
- Class in
<Unnamed>
Represents a Woolie who is thirsty for some war action.
Woolie(Woolie.Ranking)
- Constructor for class
Woolie
Construct a woolie with the supplied rank, and brand it.
Woolie.Ranking
- Enum in
<Unnamed>
The military rankings of the woolies from lowest to highest.
Woolie.Ranking()
- Constructor for enum
Woolie.Ranking
WoolieWar
- Class in
<Unnamed>
The WoolieWar is a battle simulation program.
WoolieWar()
- Constructor for class
WoolieWar
The constructor starts all the recruiter threads, and the warmonger thread.
WoolieWar.Recruiter
- Class in
<Unnamed>
The recruiter is a nested class that is responsible for creating random woolie's and inserting them into the battlefront.
WoolieWar.Recruiter(String)
- Constructor for class
WoolieWar.Recruiter
Constructs the recruiter.
WoolieWar.Warmonger
- Class in
<Unnamed>
The warmonger is a nested class responsible for waging the war.
WoolieWar.Warmonger(String)
- Constructor for class
WoolieWar.Warmonger
Constructs the warmonger.
WOOLIEWAR_SLEEP_TIME
- Variable in class
WoolieWar
The WOOLIEWAR sleeps for this amount of time (ms) during the war, and then wakes up to update the readers.
A
B
C
D
E
F
G
H
I
M
N
R
S
T
U
V
W
Package
Class
Tree
Deprecated
Index
Help
PREV NEXT
FRAMES
NO FRAMES
All Classes