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

java.lang.Object
  extended by edu.trinity.cs.gamecore.GameEntityList<B,E>
All Implemented Interfaces:
java.io.Serializable

public class GameEntityList<B extends Block<B,E>,E extends GameEntity<B,E>>
extends java.lang.Object
implements java.io.Serializable

This class is a basic implementation of a linked list that can hold GameEntity objects. Students will use it for some of the early assignments.

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

Author:
Mark Lewis
See Also:
Serialized Form

Constructor Summary
GameEntityList()
           
 
Method Summary
 void add(E entity)
          Adds the specified entity to the list.
 java.util.Iterator<E> createIterator()
          Returns an Iterator object that can be used to "walk through" the list of entities.
 void remove(E entity)
          Searches for the specified entity in the screen and removes it if found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GameEntityList

public GameEntityList()
Method Detail

createIterator

public java.util.Iterator<E> createIterator()
Returns an Iterator object that can be used to "walk through" the list of entities. See java.util.Iterator for the methods of the Iterator interface. Does not support the (optional) remove operation (throws an exception).

Returns:
An Iterator that will walk through this list.
See Also:
Iterator

add

public void add(E entity)
Adds the specified entity to the list.

Parameters:
entity - The entity to add to the list.

remove

public void remove(E entity)
            throws java.util.NoSuchElementException
Searches for the specified entity in the screen and removes it if found. If not found it throws an exception.

Parameters:
entity - The entity to remove.
Throws:
java.util.NoSuchElementException