From 4768e909e3652f5360d01843788d0423fa792ff7 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 22 Sep 2024 08:21:17 -0400 Subject: [PATCH] Javadoc --- .../apache/commons/lang3/time/StopWatch.java | 71 +++++++++---------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/time/StopWatch.java b/src/main/java/org/apache/commons/lang3/time/StopWatch.java index 86eea98ca..fefb1e4f6 100644 --- a/src/main/java/org/apache/commons/lang3/time/StopWatch.java +++ b/src/main/java/org/apache/commons/lang3/time/StopWatch.java @@ -151,23 +151,23 @@ public class StopWatch { }; /** - * Tests whether the StopWatch is started. A suspended StopWatch is also started. + * Tests whether this StopWatch is started. A suspended StopWatch is also started. * - * @return boolean If the StopWatch is started. + * @return boolean If this StopWatch is started. */ abstract boolean isStarted(); /** - * Tests whether the StopWatch is stopped. A StopWatch which is not yet started and explicitly stopped is considered stopped. + * Tests whether this StopWatch is stopped. A StopWatch which is not yet started and explicitly stopped is considered stopped. * - * @return boolean If the StopWatch is stopped. + * @return boolean If this StopWatch is stopped. */ abstract boolean isStopped(); /** - * Tests whether the StopWatch is suspended. + * Tests whether this StopWatch is suspended. * - * @return boolean If the StopWatch is suspended. + * @return boolean If this StopWatch is suspended. */ abstract boolean isSuspended(); } @@ -206,12 +206,12 @@ public class StopWatch { private final String message; /** - * The current running state of the StopWatch. + * The current running state of this StopWatch. */ private State runningState = State.UNSTARTED; /** - * Whether the StopWatch has a split time recorded. + * Whether this StopWatch has a split time recorded. */ private SplitState splitState = SplitState.UNSPLIT; @@ -228,7 +228,7 @@ public class StopWatch { * nanoTime is only for elapsed time so we need to also store the currentTimeMillis to maintain the old getStartTime API. *

*

- * On Java 8, Instant has millisecond precision, only later versions use nanoseconds. + * On Java 8, Instant has millisecond precision, later versions use nanoseconds. *

*/ private Instant startInstant; @@ -239,7 +239,7 @@ public class StopWatch { * nanoTime is only for elapsed time so we need to also store the currentTimeMillis to maintain the old getStartTime API. *

*

- * On Java 8, Instant has millisecond precision, only later versions use nanoseconds. + * On Java 8, Instant has millisecond precision, later versions use nanoseconds. *

*/ private Instant stopInstant; @@ -306,7 +306,7 @@ public class StopWatch { } /** - * Gets the Duration on the StopWatch. + * Gets the Duration on this StopWatch. * *

* This is either the Duration between the start and the moment this method is called, or the Duration between start and stop. @@ -356,7 +356,7 @@ public class StopWatch { } /** - * Gets the split Duration on the StopWatch. + * Gets the split Duration on this StopWatch. * *

* This is the Duration between start and latest split. @@ -364,7 +364,7 @@ public class StopWatch { * * @return the split Duration * - * @throws IllegalStateException if the StopWatch has not yet been split. + * @throws IllegalStateException if this StopWatch has not yet been split. * @since 3.16.0 */ public Duration getSplitDuration() { @@ -380,7 +380,7 @@ public class StopWatch { * * @return the split time in nanoseconds * - * @throws IllegalStateException if the StopWatch has not yet been split. + * @throws IllegalStateException if this StopWatch has not yet been split. * @since 3.0 */ public long getSplitNanoTime() { @@ -391,7 +391,7 @@ public class StopWatch { } /** - * Gets the split time on the StopWatch. + * Gets the split time on this StopWatch. * *

* This is the time between start and latest split. @@ -399,7 +399,7 @@ public class StopWatch { * * @return the split time in milliseconds * - * @throws IllegalStateException if the StopWatch has not yet been split. + * @throws IllegalStateException if this StopWatch has not yet been split. * @since 2.1 * @deprecated Use {@link #getSplitDuration()}. */ @@ -484,7 +484,7 @@ public class StopWatch { } /** - * Gets the time on the StopWatch. + * Gets the time on this StopWatch. * *

* This is either the time between the start and the moment this method is called, or the amount of time between start and stop. @@ -503,8 +503,8 @@ public class StopWatch { * *

* This is either the time between the start and the moment this method is called, or the amount of time between start and stop. The resulting time will be - * expressed in the desired TimeUnit with any remainder rounded down. For example, if the specified unit is {@code TimeUnit.HOURS} and the StopWatch time is - * 59 minutes, then the result returned will be {@code 0}. + * expressed in the desired TimeUnit with any remainder rounded down. For example, if the specified unit is {@code TimeUnit.HOURS} and this StopWatch time + * is 59 minutes, then the result returned will be {@code 0}. *

* * @param timeUnit the unit of time, not null @@ -516,9 +516,9 @@ public class StopWatch { } /** - * Tests whether the StopWatch is started. A suspended StopWatch is also started watch. + * Tests whether this StopWatch is started. A suspended StopWatch is also started watch. * - * @return boolean If the StopWatch is started. + * @return boolean If this StopWatch is started. * @since 3.2 */ public boolean isStarted() { @@ -526,9 +526,9 @@ public class StopWatch { } /** - * Tests whether StopWatch is stopped. The StopWatch which's not yet started and explicitly stopped StopWatch is considered as stopped. + * Tests whether StopWatch is stopped. this StopWatch which's not yet started and explicitly stopped StopWatch is considered as stopped. * - * @return boolean If the StopWatch is stopped. + * @return boolean If this StopWatch is stopped. * @since 3.2 */ public boolean isStopped() { @@ -536,9 +536,9 @@ public class StopWatch { } /** - * Tests whether the StopWatch is suspended. + * Tests whether this StopWatch is suspended. * - * @return boolean If the StopWatch is suspended. + * @return boolean If this StopWatch is suspended. * @since 3.2 */ public boolean isSuspended() { @@ -556,7 +556,7 @@ public class StopWatch { } /** - * Resets the StopWatch. Stops it if need be. + * Resets this StopWatch. Stops it if need be. * *

* This method clears the internal values to allow the object to be reused. @@ -568,13 +568,13 @@ public class StopWatch { } /** - * Resumes the StopWatch after a suspend. + * Resumes this StopWatch after a suspend. * *

* This method resumes the watch after it was suspended. The watch will not include time between the suspend and resume calls in the total time. *

* - * @throws IllegalStateException if the StopWatch has not been suspended. + * @throws IllegalStateException if this StopWatch has not been suspended. */ public void resume() { if (runningState != State.SUSPENDED) { @@ -624,7 +624,7 @@ public class StopWatch { * timing from the original start point. *

* - * @throws IllegalStateException if the StopWatch is not running. + * @throws IllegalStateException if this StopWatch is not running. */ public void split() { if (runningState != State.RUNNING) { @@ -641,7 +641,7 @@ public class StopWatch { * This method starts a new timing session, clearing any previous values. *

* - * @throws IllegalStateException if the StopWatch is already running. + * @throws IllegalStateException if this StopWatch is already running. */ public void start() { if (runningState == State.STOPPED) { @@ -673,7 +673,7 @@ public class StopWatch { * This method ends a new timing session, allowing the time to be retrieved. *

* - * @throws IllegalStateException if the StopWatch is not running. + * @throws IllegalStateException if this StopWatch is not running. */ public void stop() { if (runningState != State.RUNNING && runningState != State.SUSPENDED) { @@ -693,7 +693,7 @@ public class StopWatch { * This method suspends the watch until it is resumed. The watch will not include time between the suspend and resume calls in the total time. *

* - * @throws IllegalStateException if the StopWatch is not currently running. + * @throws IllegalStateException if this StopWatch is not currently running. */ public void suspend() { if (runningState != State.RUNNING) { @@ -705,7 +705,7 @@ public class StopWatch { } /** - * Gets a summary of the split time that the StopWatch recorded as a string. + * Gets a summary of the split time that this StopWatch recorded as a string. * *

* The format used is ISO 8601-like, [message ]hours:minutes:seconds.milliseconds. @@ -722,7 +722,7 @@ public class StopWatch { } /** - * Gets a summary of the time that the StopWatch recorded as a string. + * Gets a summary of the time that this StopWatch recorded as a string. * *

* The format used is ISO 8601-like, [message ]hours:minutes:seconds.milliseconds. @@ -745,7 +745,7 @@ public class StopWatch { * This method clears the stop time. The start time is unaffected, enabling timing from the original start point to continue. *

* - * @throws IllegalStateException if the StopWatch has not been split. + * @throws IllegalStateException if this StopWatch has not been split. */ public void unsplit() { if (splitState != SplitState.SPLIT) { @@ -754,5 +754,4 @@ public class StopWatch { splitState = SplitState.UNSPLIT; } - }