Interface PriorityQueue
- All Known Implementing Classes:
- ListBasedPriorityQueue
- public interface PriorityQueue
The PriorityQueue class it used to keep track of which entities should be
updated in any given time step. This general API can be implemented in a
number of different ways that provide different levels of performance.
Method Summary |
void | add(GameEntity ge) This method adds a GameEntity into the queue. |
GameEntity | 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. |
add
public void add(GameEntity ge)
- 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.- Parameters:
- ge The game entity to be added.
getFirst
public GameEntity getFirst()
- 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.- Returns: The first GameEntity in the queue or null if the queue is empty.
removeFirst
public void removeFirst()
- This method removes the first entity from the queue assuming one is present.