Package simulation
Class Movable
java.lang.Object
simulation.Movable
- Direct Known Subclasses:
PopulationMember
public abstract class Movable
extends java.lang.Object
Gives ability to move.
-
Constructor Summary
Constructors Constructor Description Movable()
-
Method Summary
Modifier and Type Method Description void
addVelocity(Vector velocity)
Add a new velocity.Vector
getVelocity()
Get the velocity of an object.void
multiply(int num)
Multiply velocity by scalar.void
multiply(Vector vector)
Multiply velocity by a vector.void
setVelocity(Vector velocity)
Set velocity of the object.
-
Constructor Details
-
Movable
public Movable()
-
-
Method Details
-
getVelocity
Get the velocity of an object.- Returns:
- velocity
-
setVelocity
Set velocity of the object.- Parameters:
velocity
- Vector containing velocity values.
-
addVelocity
Add a new velocity.- Parameters:
velocity
- velocity to be added.
-
multiply
public void multiply(int num)Multiply velocity by scalar.- Parameters:
num
- a scalar to be multiplied by.
-
multiply
Multiply velocity by a vector.- Parameters:
vector
- a vector to be multiplied by.
-