Class ParticleList

java.lang.Object
  extended by ParticleList

public class ParticleList
extends java.lang.Object

A collection class that can only hold Particle objects. Particle can be added or removed. They can be accessed and the number of particles can be requested. Removing Particles is not garanteed to be stable--that is, the order before and after may be different.


Constructor Summary
ParticleList()
          Create a new, initially empty, ParticleList
 
Method Summary
 void add(Particle toAdd)
          Add the given Particle to the list
 Particle get(int index)
          Get the Particle at the specified index.
 boolean isEmpty()
          Returns true if the list has no Particles
 boolean isValidIndex(int index)
          Returns true if the suppled index is valid for this ParticleList
 void remove(int index)
          Remove the Particle at the specified index.
 int size()
          Get's the number of Particles in this list.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParticleList

public ParticleList()
Create a new, initially empty, ParticleList

Method Detail

get

public Particle get(int index)
Get the Particle at the specified index. Returns null if the index is invalid.

Parameters:
index - The index of the desired Particle
Returns:
the desired Particle or null

add

public void add(Particle toAdd)
Add the given Particle to the list

Parameters:
toAdd - The Particle to add

remove

public void remove(int index)
Remove the Particle at the specified index. The other elements may or may not change position. The request is ignored if the index provided is not valid.

Parameters:
index - The index of the Particle to remove

isValidIndex

public boolean isValidIndex(int index)
Returns true if the suppled index is valid for this ParticleList

Parameters:
index - The index to check
Returns:
true if the index is valid

isEmpty

public boolean isEmpty()
Returns true if the list has no Particles

Returns:
true if the list has no Particles

size

public int size()
Get's the number of Particles in this list.

Returns:
The number of particles in this list