Skip to content

Commit 89dd0a2

Browse files
committed
Format touched code
1 parent 044aa8b commit 89dd0a2

4 files changed

Lines changed: 35 additions & 24 deletions

File tree

‎scijava/scijava-progress/src/main/java/org/scijava/progress/Progress.java‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ public final class Progress {
4848
* A record of all listeners interested in the progress of all Object
4949
* executions
5050
*/
51-
private static final List<ProgressListener> globalListeners = new ArrayList<>();
51+
private static final List<ProgressListener> globalListeners =
52+
new ArrayList<>();
5253

5354
/**
5455
* A record of all listeners interested in the progress of a given Object's
@@ -108,7 +109,7 @@ public static void addListener(Object progressible, ProgressListener l) {
108109
}
109110
addListenerToList(progressible, l);
110111
}
111-
112+
112113
private static void addListenerToList(Object progressible,
113114
ProgressListener l)
114115
{
@@ -125,7 +126,8 @@ private static synchronized void createListenerList(Object progressible) {
125126

126127
/**
127128
* Completes the current task on this {@link Thread}'s execution hierarchy,
128-
* removing it in the process. This method also takaes care to ping relevant {@link ProgressListener}s.
129+
* removing it in the process. This method also takaes care to ping relevant
130+
* {@link ProgressListener}s.
129131
*
130132
* @see Task#complete()
131133
*/
@@ -148,7 +150,8 @@ public static void complete() {
148150
* {@link Progress}' progress-reporting API between the time this method is
149151
* called and the time when {@link Progress#complete()} is called.
150152
*
151-
* @param progressible an {@link Object} that would like to report its progress.
153+
* @param progressible an {@link Object} that would like to report its
154+
* progress.
152155
*/
153156
public static void register(final Object progressible) {
154157
register(progressible, progressible.toString());
@@ -160,10 +163,13 @@ public static void register(final Object progressible) {
160163
* {@link Progress}' progress-reporting API between the time this method is
161164
* called and the time when {@link Progress#complete()} is called.
162165
*
163-
* @param progressible an {@link Object} that would like to report its progress.
166+
* @param progressible an {@link Object} that would like to report its
167+
* progress.
164168
* @param description a {@link String} describing {@code progressible}
165169
*/
166-
public static void register(final Object progressible, final String description) {
170+
public static void register(final Object progressible,
171+
final String description)
172+
{
167173
Task t;
168174
if (progressibleStack.get().size() == 0) {
169175
// completely new execution hierarchy

‎scijava/scijava-progress/src/main/java/org/scijava/progress/Task.java‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ public class Task {
7272
private final AtomicLong subTasksCompleted = new AtomicLong(0);
7373

7474
/**
75-
* True iff a call to {@link Task#defineTotalProgress(long, long)} has been made
75+
* True iff a call to {@link Task#defineTotalProgress(long, long)} has been
76+
* made
7677
*/
7778
private boolean tasksDefined = false;
7879

@@ -117,7 +118,8 @@ public void complete() {
117118
* @return the subtask.
118119
*/
119120
public synchronized Task createSubtask() {
120-
final Task sub = new Task(this, "Subtask " + subTasks.size() + 1 + " of Task \"" + id + "\"");
121+
final Task sub = new Task(this, "Subtask " + subTasks.size() + 1 +
122+
" of Task \"" + id + "\"");
121123
subTasks.add(sub);
122124
return sub;
123125
}
@@ -169,8 +171,8 @@ public boolean isComplete() {
169171
/**
170172
* Calculates and returns the progress of the associated progressible
171173
* {@link Object}. If the total progress is defined using
172-
* {@link Task#defineTotalProgress(long, long)}, then this method will return a
173-
* {@code double} within the range [0, 1]. If the progress is <b>not</b>
174+
* {@link Task#defineTotalProgress(long, long)}, then this method will return
175+
* a {@code double} within the range [0, 1]. If the progress is <b>not</b>
174176
* defined, then this task will return {@code 0} until {@link #complete()} is
175177
* called; after that call this method will return {@code 1.}.
176178
*

‎scijava/scijava-progress/src/test/java/org/scijava/progress/DefaultProgressTest.java‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public class DefaultProgressTest {
4444
private static final long NUM_ITERATIONS = 100;
4545
private static final long NUM_STAGES = 10;
4646

47-
4847
/**
4948
* Tests progress listening when an progressible {@link Object} never
5049
* explicitly updates its own progress. We thus expect to be notified
@@ -172,8 +171,8 @@ public void testMultiStageReporter() {
172171
}
173172

174173
/**
175-
* Test that {@link ProgressListener}s added at a global level can listen to
176-
* a progressible object without being explicitly linked
174+
* Test that {@link ProgressListener}s added at a global level can listen to a
175+
* progressible object without being explicitly linked
177176
*/
178177
@Test
179178
public void testGlobalProgressListener() {
@@ -190,7 +189,7 @@ public void testGlobalProgressListener() {
190189
};
191190
// Add the ProgressListener
192191
var id = "This is a global listener";
193-
var listener = new TestSuiteProgressListener(NUM_ITERATIONS, id);
192+
var listener = new TestSuiteProgressListener(NUM_ITERATIONS, id);
194193
Progress.addGlobalListener(listener);
195194
// Register the Task
196195
Progress.register(progressible, id);
@@ -202,8 +201,8 @@ public void testGlobalProgressListener() {
202201
}
203202

204203
/**
205-
* Test that {@link ProgressListener}s added at a global level can listen to
206-
* a progressible object without being explicitly linked
204+
* Test that {@link ProgressListener}s added at a global level can listen to a
205+
* progressible object without being explicitly linked
207206
*/
208207
@Test
209208
public void testProgressListenerIdentifiers() {
@@ -220,13 +219,13 @@ public void testProgressListenerIdentifiers() {
220219
};
221220
// Add a ProgressListener that should acknowledge this task
222221
var goodId = "This one should be listened to";
223-
var goodListener = new TestSuiteProgressListener(NUM_ITERATIONS, goodId);
222+
var goodListener = new TestSuiteProgressListener(NUM_ITERATIONS, goodId);
224223
Progress.addGlobalListener(goodListener);
225224
// Register the Task with goodId
226225
Progress.register(progressible, goodId);
227226
// Create a second global listener that will not acknowledge this task
228227
var badId = "This one should not be listened to";
229-
var badListener = new TestSuiteProgressListener(NUM_ITERATIONS, badId);
228+
var badListener = new TestSuiteProgressListener(NUM_ITERATIONS, badId);
230229
Progress.addGlobalListener(badListener);
231230
// Run the Task
232231
progressible.get();

‎scijava/scijava-progress/src/test/java/org/scijava/progress/TestSuiteProgressListener.java‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
12
package org.scijava.progress;
23

34
import org.junit.jupiter.api.Assertions;
45

5-
public class TestSuiteProgressListener implements ProgressListener{
6+
public class TestSuiteProgressListener implements ProgressListener {
67

78
private final String id;
89
private final long expectedIterations;
@@ -15,16 +16,19 @@ public TestSuiteProgressListener(final long expectedIterations) {
1516
this.expectedIterations = expectedIterations;
1617
}
1718

18-
public TestSuiteProgressListener(final long expectedIterations, final String id) {
19+
public TestSuiteProgressListener(final long expectedIterations,
20+
final String id)
21+
{
1922
this.id = id;
2023
this.expectedIterations = expectedIterations;
2124
}
2225

23-
@Override public void acknowledgeUpdate(Task task) {
24-
if (id != null && !task.id().equals(id))
25-
return;
26+
@Override
27+
public void acknowledgeUpdate(Task task) {
28+
if (id != null && !task.id().equals(id)) return;
2629
if (!task.isComplete()) {
27-
Assertions.assertEquals(++currentIterations / expectedIterations, task.progress(), 1e-6);
30+
Assertions.assertEquals(++currentIterations / expectedIterations, task
31+
.progress(), 1e-6);
2832
}
2933
else {
3034
Assertions.assertFalse(completed);

0 commit comments

Comments
 (0)