Revision: 679
Author: allain.lalonde
Date: Thu Oct 8 14:01:22 2009
Log: Stabbing at some more CheckStyle complaints and making FileLength
max=4000. We have PNode to thank for that.
http://code.google.com/p/piccolo2d/source/detail?r=679
Modified:
/piccolo2d.java/trunk/core/src/build/conf/checkstyle.xml
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PActivityScheduler.java
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PColorActivity.java
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PInterpolatingActivity.java
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PTransformActivity.java
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java
=======================================
--- /piccolo2d.java/trunk/core/src/build/conf/checkstyle.xml Thu Oct 8
13:24:19 2009
+++ /piccolo2d.java/trunk/core/src/build/conf/checkstyle.xml Thu Oct 8
14:01:22 2009
@@ -98,7 +98,9 @@
<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
- <module name="FileLength"/>
+ <module name="FileLength">
+ <property name="max" value="4000"/>
+ </module>
<module name="LineLength">
<property name="max" value="120"/>
</module>
=======================================
---
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PActivityScheduler.java
Thu Oct 8 13:24:19 2009
+++
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PActivityScheduler.java
Thu Oct 8 14:01:22 2009
@@ -62,10 +62,11 @@
private final ArrayList processingActivities;
/**
- * Constructs an instance of PActivityScheduler. All activities it
will schedule will
- * take place on children of the rootNode provided.
+ * Constructs an instance of PActivityScheduler. All activities it will
+ * schedule will take place on children of the rootNode provided.
*
- * @param rootNode
+ * @param rootNode root node of all activities to be performed. All
nodes
+ * being animated should have this node as an ancestor.
*/
public PActivityScheduler(final PRoot rootNode) {
root = rootNode;
@@ -75,7 +76,7 @@
/**
* Returns the node from which all activities will be attached.
- *
+ *
* @return this scheduler's associated root node
*/
public PRoot getRoot() {
@@ -97,7 +98,8 @@
* this set processLast to true when adding the activity.
*
* @param activity activity to be scheduled
- * @param processLast whether or not this activity should be performed
after all other scheduled activities
+ * @param processLast whether or not this activity should be performed
after
+ * all other scheduled activities
*/
public void addActivity(final PActivity activity, final boolean
processLast) {
if (activities.contains(activity)) {
@@ -121,7 +123,8 @@
}
/**
- * Removes the given activity from the scheduled activities. Does
nothing if it's not found.
+ * Removes the given activity from the scheduled activities. Does
nothing if
+ * it's not found.
*
* @param activity the activity to be removed
*/
@@ -149,6 +152,7 @@
/**
* Returns a reference to the current activities list. Handle with
care.
+ *
* @return reference to the current activities list.
*/
public List getActivitiesReference() {
@@ -159,7 +163,7 @@
* Process all scheduled activities for the given time. Each activity
is
* given one "step", equivalent to one frame of animation.
*
- * @param currentTime the current unix time in milliseconds.
+ * @param currentTime the current unix time in milliseconds.
*/
public void processActivities(final long currentTime) {
final int size = activities.size();
@@ -174,8 +178,9 @@
}
/**
- * Return true if any of the scheduled activities return true to the
message
- * isAnimation();
+ * Return true if any of the scheduled activities are animations.
+ *
+ * @return true if any of the scheduled activities are animations.
*/
public boolean getAnimating() {
if (activitiesChanged) {
@@ -190,7 +195,8 @@
}
/**
- * Starts the current activity timer. Multiple calls to this method
are ignored.
+ * Starts the current activity timer. Multiple calls to this method are
+ * ignored.
*/
protected void startActivityTimer() {
getActivityTimer().start();
=======================================
---
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PColorActivity.java
Thu Oct 8 13:24:19 2009
+++
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PColorActivity.java
Thu Oct 8 14:01:22 2009
@@ -54,27 +54,49 @@
/**
* This will be called by the color activity for each new
interpolated
* color that it computes while it is stepping.
+ *
+ * @param color the color to assign to the target
*/
public void setColor(Color color);
/**
* This method is called right before the color activity starts.
That
- * way an object's color is always animated from its current color
the
- * the destination color that is specified in the color activity.
+ * way an object's color is always animated from its current color.
+ *
+ * @return the target's current color.
*/
public Color getColor();
}
+ /**
+ * Constructs a color activity for the given target that will animate
for
+ * the duration provided at an interval of stepRate.
+ *
+ * Destination color must be assigned later.
+ *
+ * @param duration duration in milliseconds that the animation should
last
+ * @param stepRate the time between interpolations
+ * @param aTarget the target onto which the animation is being
performed
+ */
public PColorActivity(final long duration, final long stepRate, final
Target aTarget) {
this(duration, stepRate, aTarget, null);
}
+ /**
+ * Constructs a color activity for the given target that will animate
for
+ * the duration provided at an interval of stepRate from the target's
starting color to the destination color.
+ *
+ * @param duration duration in milliseconds that the animation should
last
+ * @param stepRate the time between interpolations
+ * @param aTarget the target onto which the animation is being
performed
+ * @param aDestination the color to which the animation is aiming at
+ */
public PColorActivity(final long duration, final long stepRate, final
Target aTarget, final Color aDestination) {
this(duration, stepRate, 1,
PInterpolatingActivity.SOURCE_TO_DESTINATION, aTarget, aDestination);
}
/**
- * Create a new PColorActivity.
+ * Create a new PColorActivity.
*
* @param duration the length of one loop of the activity
* @param stepRate the amount of time between steps of the activity
@@ -91,6 +113,11 @@
destination = aDestination;
}
+ /**
+ * Returns true since all PColorActivities animate the scene.
+ *
+ * @return always returns true
+ */
protected boolean isAnimation() {
return true;
}
@@ -98,6 +125,8 @@
/**
* Return the final color that will be set on the color activities
target
* when the activity stops stepping.
+ *
+ * @return the final color for this color activity
*/
public Color getDestinationColor() {
return destination;
@@ -106,6 +135,8 @@
/**
* Set the final color that will be set on the color activities target
when
* the activity stops stepping.
+ *
+ * @param changes this activity's destination color
*/
public void setDestinationColor(final Color newDestination) {
destination = newDestination;
@@ -123,7 +154,8 @@
}
/**
- * Interpolates the target node's color by mixing the source color and
the destination color.
+ * Interpolates the target node's color by mixing the source color and
the
+ * destination color.
*
* @param zeroToOne 0 = all source color, 1 = all destination color
*/
=======================================
---
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PInterpolatingActivity.java
Thu Oct 8 13:24:19 2009
+++
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PInterpolatingActivity.java
Thu Oct 8 14:01:22 2009
@@ -199,10 +199,21 @@
// final step). See PTransformActivity for an example.
// ****************************************************************
+ /**
+ * Called when activity is started. Makes sure target value is set
properly
+ * for start of activity.
+ */
protected void activityStarted() {
super.activityStarted();
setRelativeTargetValueAdjustingForMode(0);
}
+
+ /**
+ * Called at each step of the activity. Sets the current position
taking
+ * mode into account.
+ *
+ * @param elapsedTime number of milliseconds since the activity began
+ */
protected void activityStep(final long elapsedTime) {
super.activityStep(elapsedTime);
@@ -219,6 +230,10 @@
setRelativeTargetValueAdjustingForMode(t);
}
+ /**
+ * Called whenever the activity finishes. Reschedules it if the
+ * value of loopCount is > 0.
+ */
protected void activityFinished() {
setRelativeTargetValueAdjustingForMode(1);
super.activityFinished();
@@ -251,6 +266,13 @@
public void setRelativeTargetValue(final float zeroToOne) {
}
+ /**
+ * Computes percent or linear interpolation to apply when taking
+ * acceleration into account.
+ *
+ * @param zeroToOne Percentage of activity completed
+ * @return strength of acceleration
+ */
public float computeSlowInSlowOut(final float zeroToOne) {
if (zeroToOne < 0.5) {
return 2.0f * zeroToOne * zeroToOne;
@@ -262,8 +284,8 @@
}
/**
- * Computes relative target value taking the mode into account.
- *
+ * Assigns relative target value taking the mode into account.
+ *
* @param zeroToOne Percentage of activity completed
*/
protected void setRelativeTargetValueAdjustingForMode(float zeroToOne)
{
=======================================
---
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PTransformActivity.java
Fri Jul 31 14:04:44 2009
+++
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PTransformActivity.java
Thu Oct 8 14:01:22 2009
@@ -60,12 +60,16 @@
/**
* This will be called by the transform activity for each new
transform
* that it computes while it is stepping.
+ *
+ * @param aTransform the transform to be applied to the target.
*/
public void setTransform(AffineTransform aTransform);
/**
* This method is called right before the transform activity
starts.
* That way an object is always animated from its current position.
+ *
+ * @param aSource array to be populated with the target's gurrent
matrix
*/
public void getSourceMatrix(double[] aSource);
}
=======================================
---
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java
Wed Aug 5 07:47:02 2009
+++
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java
Thu Oct 8 14:01:22 2009
@@ -1381,4 +1381,8 @@
final PPickPath path = canvas.getCamera().pick(5, 5, 5);
assertSame(node1, path.getPickedNode());
}
-}
+
+ public void testToImageDoesNotClip() {
+
+ }
+}
--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---