Class Momentum.State

  • Enclosing interface:
    Momentum

    public static class Momentum.State
    extends java.lang.Object
    A snapshot of the current state.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getCumulativeElapsedMillis()
      Get the cumulative elapsed time in milliseconds since momentum took over.
      int getElapsedMillis()
      Get the elapsed time in milliseconds since the last time the state was updated.
      Point getInitialPosition()
      Get the initial position when the momentum took over.
      Point getInitialVelocity()
      Get the initial velocity in pixels per millisecond when the momentum took over.
      Point getPosition()
      Get the current position.
      Point getVelocity()
      Get the current velocity in pixels per millisecond.
      (package private) void setCumulativeElapsedMillis​(int cumulativeElapsedMillis)
      Set the cumulative elapsed time in milliseconds since momentum took over.
      (package private) void setElapsedMillis​(int elapsedMillis)
      Set the elapsed time in milliseconds since the last time the state was updated.
      void setPosition​(Point position)
      Set the current position.
      void setVelocity​(Point velocity)
      Get the current velocity in pixels per millisecond.
      • Methods inherited from class java.lang.Object

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

      • State

        public State​(Point initialPosition,
                     Point initialVelocity)
        Construct a new Momentum.State.
        Parameters:
        initialPosition - the initial position, which is also set to the current position
        initialVelocity - the initial velocity in pixels per millisecond, which is also set to the current velocity
    • Method Detail

      • getCumulativeElapsedMillis

        public int getCumulativeElapsedMillis()
        Get the cumulative elapsed time in milliseconds since momentum took over.
        Returns:
        the elapsed time in milliseconds
      • getElapsedMillis

        public int getElapsedMillis()
        Get the elapsed time in milliseconds since the last time the state was updated.
        Returns:
        the elapsed time in milliseconds
      • getInitialPosition

        public Point getInitialPosition()
        Get the initial position when the momentum took over.
        Returns:
        the initial position
      • getInitialVelocity

        public Point getInitialVelocity()
        Get the initial velocity in pixels per millisecond when the momentum took over.
        Returns:
        the initial velocity
      • getPosition

        public Point getPosition()
        Get the current position.
        Returns:
        the current position
      • getVelocity

        public Point getVelocity()
        Get the current velocity in pixels per millisecond.
        Returns:
        the current velocity
      • setPosition

        public void setPosition​(Point position)
        Set the current position.
        Parameters:
        position - set the current position
      • setVelocity

        public void setVelocity​(Point velocity)
        Get the current velocity in pixels per millisecond.
        Parameters:
        velocity - set the current velocity
      • setCumulativeElapsedMillis

        void setCumulativeElapsedMillis​(int cumulativeElapsedMillis)
        Set the cumulative elapsed time in milliseconds since momentum took over.
      • setElapsedMillis

        void setElapsedMillis​(int elapsedMillis)
        Set the elapsed time in milliseconds since the last time the state was updated.