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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getVelocity

      public Vector getVelocity()
      Get the velocity of an object.
      Returns:
      velocity
    • setVelocity

      public void setVelocity​(Vector velocity)
      Set velocity of the object.
      Parameters:
      velocity - Vector containing velocity values.
    • addVelocity

      public void addVelocity​(Vector velocity)
      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

      public void multiply​(Vector vector)
      Multiply velocity by a vector.
      Parameters:
      vector - a vector to be multiplied by.