JSci.physics
Class ClassicalParticle

java.lang.Object
  extended byJSci.physics.Particle
      extended byJSci.physics.AbstractClassicalParticle
          extended byJSci.physics.ClassicalParticle
All Implemented Interfaces:
java.io.Serializable

public class ClassicalParticle
extends AbstractClassicalParticle

The ClassicalParticle class provides an object for encapsulating classical point particles. This class is suitable for representing particles that live in an arbitrary number of dimensions.

See Also:
Serialized Form

Field Summary
protected  double mass
           
protected  AbstractDoubleVector v
           
protected  AbstractDoubleVector x
           
 
Constructor Summary
ClassicalParticle(int n)
          Constructs a classical particle.
 
Method Summary
 ClassicalParticle accelerate(AbstractDoubleVector a, double dt)
          Accelerates this particle.
 ClassicalParticle applyForce(AbstractDoubleVector F, double dt)
          Applies a force to this particle.
 double energy()
          Returns the energy of this particle.
 double getMass()
          Returns the mass of this particle.
 AbstractDoubleVector getMomentum()
           
 AbstractDoubleVector getPosition()
           
 AbstractDoubleVector getVelocity()
           
 ClassicalParticle move(double dt)
          Evolves this particle forward according to its kinematics.
 void setMass(double m)
          Sets the mass of this particle.
 void setMomentum(AbstractDoubleVector momentum)
           
 void setPosition(AbstractDoubleVector pos)
           
 void setVelocity(AbstractDoubleVector vel)
           
 double speed()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mass

protected double mass

x

protected AbstractDoubleVector x

v

protected AbstractDoubleVector v
Constructor Detail

ClassicalParticle

public ClassicalParticle(int n)
Constructs a classical particle.

Parameters:
n - number of dimensions.
Method Detail

setMass

public void setMass(double m)
Sets the mass of this particle.


getMass

public double getMass()
Returns the mass of this particle.

Specified by:
getMass in class AbstractClassicalParticle

setPosition

public void setPosition(AbstractDoubleVector pos)

getPosition

public AbstractDoubleVector getPosition()
Specified by:
getPosition in class AbstractClassicalParticle

setVelocity

public void setVelocity(AbstractDoubleVector vel)

getVelocity

public AbstractDoubleVector getVelocity()
Specified by:
getVelocity in class AbstractClassicalParticle

speed

public double speed()
Overrides:
speed in class AbstractClassicalParticle

setMomentum

public void setMomentum(AbstractDoubleVector momentum)

getMomentum

public AbstractDoubleVector getMomentum()
Overrides:
getMomentum in class AbstractClassicalParticle

energy

public double energy()
Returns the energy of this particle.

Overrides:
energy in class AbstractClassicalParticle

move

public ClassicalParticle move(double dt)
Evolves this particle forward according to its kinematics. This method changes the particle's position.

Returns:
this.

accelerate

public ClassicalParticle accelerate(AbstractDoubleVector a,
                                    double dt)
Accelerates this particle. This method changes the particle's velocity. It is additive, that is accelerate(a1, dt).accelerate(a2, dt) is equivalent to accelerate(a1+a2, dt).

Returns:
this.

applyForce

public ClassicalParticle applyForce(AbstractDoubleVector F,
                                    double dt)
Applies a force to this particle. This method changes the particle's velocity. It is additive, that is applyForce(F1, dt).applyForce(F2, dt) is equivalent to applyForce(F1+F2, dt).

Returns:
this.