simogl.effect.particle
Class ParticleContainer

java.lang.Object
  extended by simogl.effect.particle.ParticleContainer

public class ParticleContainer
extends java.lang.Object

This class is used to store and manage a set of similar particles

Author:
Frank Bruns

Constructor Summary
ParticleContainer(int maxNumberOfParticles)
          Creates a new container for particles
 
Method Summary
 void addParticle(AbstractParticle particle)
          Adds a particle to the particle container
 void clean()
          This method removes all particles from the container that have already reached their maximum age and therefore shall not be used anymore.
 void deleteAll()
          Removes every particle from the container.
 void deleteParticle(AbstractParticle particle)
          Removes the specified particle from the container
 int getMaximumParticles()
          Returns the maximum possible number of particles in the container
 int getParticleCount()
          Returns the number of particles in the particle container
 java.util.ArrayList<AbstractParticle> getParticles()
          Return a list with all the particles in the container
 void setMaximumParticles(int number)
          Sets the maximum number of particles possible in the container
 void update(long elapsedTime)
          Updates the particles in the container according to the amount of time passed since the last update
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParticleContainer

public ParticleContainer(int maxNumberOfParticles)
Creates a new container for particles

Method Detail

addParticle

public void addParticle(AbstractParticle particle)
Adds a particle to the particle container

Parameters:
particle - particle to add

deleteParticle

public void deleteParticle(AbstractParticle particle)
Removes the specified particle from the container

Parameters:
particle - particle to remove

deleteAll

public void deleteAll()
Removes every particle from the container. The container will be empty after this operation.


update

public void update(long elapsedTime)
Updates the particles in the container according to the amount of time passed since the last update

Parameters:
elapsedTime - time between two frames

clean

public void clean()
This method removes all particles from the container that have already reached their maximum age and therefore shall not be used anymore.


getParticles

public java.util.ArrayList<AbstractParticle> getParticles()
Return a list with all the particles in the container

Returns:
all particles

getParticleCount

public int getParticleCount()
Returns the number of particles in the particle container

Returns:
number of particles

getMaximumParticles

public int getMaximumParticles()
Returns the maximum possible number of particles in the container

Returns:
maximum number of possible particles

setMaximumParticles

public void setMaximumParticles(int number)
Sets the maximum number of particles possible in the container

Parameters:
number - maximum number of possible particles