public static class Momentum.State
extends java.lang.Object
Constructor and Description |
---|
State(Point initialPosition,
Point initialVelocity)
Construct a new
Momentum.State . |
Modifier and Type | Method and 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.
|
public State(Point initialPosition, Point initialVelocity)
Momentum.State
.initialPosition
- the initial position, which is also set to the
current positioninitialVelocity
- the initial velocity in pixels per millisecond,
which is also set to the current velocitypublic int getCumulativeElapsedMillis()
public int getElapsedMillis()
public Point getInitialPosition()
public Point getInitialVelocity()
public Point getPosition()
public Point getVelocity()
public void setPosition(Point position)
position
- set the current positionpublic void setVelocity(Point velocity)
velocity
- set the current velocityvoid setCumulativeElapsedMillis(int cumulativeElapsedMillis)
void setElapsedMillis(int elapsedMillis)