edu.trinity.cs.gamecore
Class ListBasedPriorityQueue<B extends Block<B,E>,E extends GameEntity<B,E>>

java.lang.Object
  extended by edu.trinity.cs.gamecore.ListBasedPriorityQueue<B,E>
All Implemented Interfaces:
PriorityQueue<B,E>

public class ListBasedPriorityQueue<B extends Block<B,E>,E extends GameEntity<B,E>>
extends java.lang.Object
implements PriorityQueue<B,E>

This is an implementation of the PriorityQueue interface that uses a linked list. It is provided so that you can do the early assignments before you write your own.

This class is a generic that takes the general block type and the general entity type for each game.


Constructor Summary
ListBasedPriorityQueue()
           
 
Method Summary
 void add(E ge)
          This method adds a GameEntity into the queue.
 E getFirst()
          This method should return the first entity in the queue.
 void removeFirst()
          This method removes the first entity from the queue assuming one is present.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListBasedPriorityQueue

public ListBasedPriorityQueue()
Method Detail

add

public void add(E ge)
Description copied from interface: PriorityQueue
This method adds a GameEntity into the queue. It calls the getUpdateTime() method of the GameEntity to determine where it should be placed in the queue.

Specified by:
add in interface PriorityQueue<B extends Block<B,E>,E extends GameEntity<B,E>>
Parameters:
ge - The game entity to be added.

removeFirst

public void removeFirst()
Description copied from interface: PriorityQueue
This method removes the first entity from the queue assuming one is present.

Specified by:
removeFirst in interface PriorityQueue<B extends Block<B,E>,E extends GameEntity<B,E>>

getFirst

public E getFirst()
Description copied from interface: PriorityQueue
This method should return the first entity in the queue. Notice that it does not remove it. A separate call to removeFirst must be made to remove the item from the queue.

Specified by:
getFirst in interface PriorityQueue<B extends Block<B,E>,E extends GameEntity<B,E>>
Returns:
The first GameEntity in the queue or null if the queue is empty.