diff --git a/core/src/build/conf/checkstyle.xml b/core/src/build/conf/checkstyle.xml
index d23ff3c..877fc3e 100644
--- a/core/src/build/conf/checkstyle.xml
+++ b/core/src/build/conf/checkstyle.xml
@@ -98,7 +98,9 @@
-
+
+
+
diff --git a/core/src/main/java/edu/umd/cs/piccolo/activities/PActivityScheduler.java b/core/src/main/java/edu/umd/cs/piccolo/activities/PActivityScheduler.java
index 50d6f63..7ad3e1d 100644
--- a/core/src/main/java/edu/umd/cs/piccolo/activities/PActivityScheduler.java
+++ b/core/src/main/java/edu/umd/cs/piccolo/activities/PActivityScheduler.java
@@ -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();
diff --git a/core/src/main/java/edu/umd/cs/piccolo/activities/PColorActivity.java b/core/src/main/java/edu/umd/cs/piccolo/activities/PColorActivity.java
index ab30908..86d4667 100644
--- a/core/src/main/java/edu/umd/cs/piccolo/activities/PColorActivity.java
+++ b/core/src/main/java/edu/umd/cs/piccolo/activities/PColorActivity.java
@@ -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
*/
diff --git a/core/src/main/java/edu/umd/cs/piccolo/activities/PInterpolatingActivity.java b/core/src/main/java/edu/umd/cs/piccolo/activities/PInterpolatingActivity.java
index 0c78074..6eb0a92 100644
--- a/core/src/main/java/edu/umd/cs/piccolo/activities/PInterpolatingActivity.java
+++ b/core/src/main/java/edu/umd/cs/piccolo/activities/PInterpolatingActivity.java
@@ -199,11 +199,22 @@
// 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) {
diff --git a/core/src/main/java/edu/umd/cs/piccolo/activities/PTransformActivity.java b/core/src/main/java/edu/umd/cs/piccolo/activities/PTransformActivity.java
index 966af9b..bc79182 100644
--- a/core/src/main/java/edu/umd/cs/piccolo/activities/PTransformActivity.java
+++ b/core/src/main/java/edu/umd/cs/piccolo/activities/PTransformActivity.java
@@ -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);
}
diff --git a/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java b/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java
index 5e6b3bc..8137d6a 100644
--- a/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java
+++ b/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java
@@ -1381,4 +1381,8 @@
final PPickPath path = canvas.getCamera().pick(5, 5, 5);
assertSame(node1, path.getPickedNode());
}
+
+ public void testToImageDoesNotClip() {
+
+ }
}