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 voidaddVelocity(Vector velocity)Add a new velocity.VectorgetVelocity()Get the velocity of an object.voidmultiply(int num)Multiply velocity by scalar.voidmultiply(Vector vector)Multiply velocity by a vector.voidsetVelocity(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.
-