Whitespace

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@877 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Dave Hoover
2010-02-08 23:43:45 +00:00
parent 62f572fac4
commit e760b308c1
8 changed files with 101 additions and 128 deletions
+22 -27
View File
@@ -24,46 +24,42 @@ package com.threerings.media.util;
import java.awt.Graphics2D;
/**
* A path is used to cause a {@link Pathable} to follow a particular path
* along the screen. The {@link Pathable} is responsible for calling
* {@link #tick} on the path with reasonable frequency (generally as a
* part of the frame tick. The path is responsible for updating the
* position of the {@link Pathable} based on the time that has elapsed
* since the {@link Pathable} started down the path.
* A path is used to cause a {@link Pathable} to follow a particular path along the screen. The
* {@link Pathable} is responsible for calling {@link #tick} on the path with reasonable frequency
* (generally as a part of the frame tick. The path is responsible for updating the position of
* the {@link Pathable} based on the time that has elapsed since the {@link Pathable} started down
* the path.
*
* <p> The path should call the appropriate callbacks on the {@link
* Pathable} when appropriate (e.g. {@link Pathable#pathBeginning}, {@link
* Pathable#pathCompleted}).
* <p> The path should call the appropriate callbacks on the {@link Pathable} when appropriate
* (e.g. {@link Pathable#pathBeginning}, {@link Pathable#pathCompleted}).
*/
public interface Path
{
/**
* Called once to let the path prepare itself for the process of
* animating the supplied pathable. Path users should also call {@link
* #tick} after {@link #init} with the same initialization timestamp.
* Called once to let the path prepare itself for the process of animating the supplied
* pathable. Path users should also call {@link #tick} after {@link #init} with the same
* initialization timestamp.
*/
public void init (Pathable pable, long tickStamp);
/**
* Called to request that this path update the position of the
* specified pathable based on the supplied timestamp information. A
* path should record its initial timestamp and determine the progress
* of the pathable along the path based on the time elapsed since the
* pathable began down the path.
* Called to request that this path update the position of the specified pathable based on the
* supplied timestamp information. A path should record its initial timestamp and determine
* the progress of the pathable along the path based on the time elapsed since the pathable
* began down the path.
*
* @param pable the pathable whose position should be updated.
* @param tickStamp the timestamp associated with this frame.
*
* @return true if the pathable's position was updated, false if the
* path determined that the pathable should not move at this time.
* @return true if the pathable's position was updated, false if the path determined that the
* pathable should not move at this time.
*/
public boolean tick (Pathable pable, long tickStamp);
/**
* This is called if the pathable is paused for some length of time
* and then unpaused. Paths should adjust any time stamps they are
* maintaining internally by the delta so that time maintains the
* illusion of flowing smoothly forward.
* This is called if the pathable is paused for some length of time and then unpaused. Paths
* should adjust any time stamps they are maintaining internally by the delta so that time
* maintains the illusion of flowing smoothly forward.
*/
public void fastForward (long timeDelta);
@@ -73,10 +69,9 @@ public interface Path
public void paint (Graphics2D gfx);
/**
* When a path is removed from a pathable, whether that is because the
* path was completed or because it was replaced by another path, this
* method will be called to let the path know that it is no longer
* associated with this pathable.
* When a path is removed from a pathable, whether that is because the path was completed or
* because it was replaced by another path, this method will be called to let the path know
* that it is no longer associated with this pathable.
*/
public void wasRemoved (Pathable pable);
}
@@ -46,14 +46,23 @@ public class PathSequence
/**
* Construct a path sequence with the list of paths.
* Note: Paths may be added to the end of the list while
* the pathable is still traversing earlier paths!
*
* Note: Paths may be added to the end of the list while the pathable is still traversing
* earlier paths!
*/
public PathSequence (List<Path> paths)
{
_paths = paths;
}
/**
* Add a new path to the end of our current list.
*/
public void addPath (Path path)
{
_paths.add(path);
}
// documentation inherited from interface Path
public void init (Pathable pable, long tickStamp)
{
@@ -62,9 +71,8 @@ public class PathSequence
@Override
public void pathCompleted (long timeStamp) {
long initStamp;
// if we just finished a timed path, we can figure out how
// long ago it really finished and init the next path at
// that time in the past.
// if we just finished a timed path, we can figure out how long ago it really
// finished and init the next path at that time in the past.
if (_curPath instanceof TimedPath) {
initStamp = _lastInit + ((TimedPath) _curPath)._duration;
} else {
@@ -81,8 +89,7 @@ public class PathSequence
public boolean tick (Pathable pable, long tickStamp)
{
if (pable != _pable) {
log.warning("PathSequence ticked with different path than " +
"it was inited with.");
log.warning("PathSequence ticked with different path than it was inited with.");
}
return _curPath.tick(_pableRep, tickStamp);
}