Skip to content

Commit b929677

Browse files
gselzerctrueden
authored andcommitted
Remove ProgressReporters
1 parent 227da43 commit b929677

10 files changed

Lines changed: 6 additions & 371 deletions

File tree

scijava/scijava-ops-api/src/main/java/org/scijava/ops/api/OpExecution.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,19 @@
66
public class OpExecution {
77

88
private final RichOp<?> op;
9-
private ProgressReporter reporter;
109
private final CompletableFuture<Object> outContainer;
1110

1211
public OpExecution(RichOp<?> op) {
1312
this.op = op;
1413
this.outContainer = new CompletableFuture<>();
1514
}
1615

17-
public void setReporter(ProgressReporter p) {
18-
this.reporter = p;
19-
}
20-
2116
public RichOp<?> op() {
2217
return op;
2318
}
2419

25-
public ProgressReporter reporter() {
26-
return reporter;
27-
}
28-
2920
public void recordCompletion(Object output) {
3021
outContainer.complete(output);
31-
reporter.reportCompletion();
3222
}
3323

3424
public Future<Object> output() {

scijava/scijava-ops-api/src/main/java/org/scijava/ops/api/OpHistory.java

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ public interface OpHistory {
3535
*/
3636
List<RichOp<?>> executionsUpon(Object o);
3737

38-
/**
39-
* Describes the set of {@Link OpExecution}s currently running
40-
*
41-
* @return the {@link Set} of Ops currently running
42-
*/
43-
Set<OpExecution> currentExecutions();
44-
4538
/**
4639
* Returns the hierarchy of {@link OpInfo}s describing the dependency chain of
4740
* the {@link Object} {@code op}.
@@ -59,13 +52,6 @@ default String signatureOf(Object op) {
5952

6053
// -- HISTORY MAINTENANCE API -- //
6154

62-
/**
63-
* Logs an {@link OpExecution} in the history
64-
*
65-
* @param e the {@link OpExecution}
66-
*/
67-
void addExecution(OpExecution e);
68-
6955
/**
7056
* Logs the creation of {@link RichOp}
7157
*
@@ -74,10 +60,10 @@ default String signatureOf(Object op) {
7460
void logOp(RichOp<?> op);
7561

7662
/**
77-
* Logs the {@link Object} output of the {@link OpExecution} e.
78-
* @param e the {@link OpExecution} producing {@code output}
63+
* Logs the {@link Object} output of the {@link RichOp} {@code op}.
64+
* @param op the {@link RichOp} producing {@code output}
7965
* @param output the {@link Object} output of {@code e}
8066
*/
81-
void logOutput(OpExecution e, Object output);
67+
void logOutput(RichOp<?> op, Object output);
8268

8369
}

scijava/scijava-ops-api/src/main/java/org/scijava/ops/api/ProgressReporter.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

scijava/scijava-ops-engine/src/main/java/org/scijava/ops/engine/impl/DefaultOpHistory.java

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.scijava.ops.api.OpHistory;
1515
import org.scijava.ops.api.OpInfo;
1616
import org.scijava.ops.api.RichOp;
17-
import org.scijava.ops.engine.progress.ProgressReporters;
1817
import org.scijava.plugin.Plugin;
1918
import org.scijava.service.AbstractService;
2019
import org.scijava.service.Service;
@@ -52,8 +51,6 @@ public class DefaultOpHistory extends AbstractService implements OpHistory {
5251

5352
private final Map<Object, List<RichOp<?>>> mutationMap = new WeakHashMap<>();
5453

55-
private final Set<OpExecution> currentExecutions = new HashSet<>();
56-
5754
// -- USER API -- //
5855

5956
/**
@@ -70,46 +67,22 @@ public List<RichOp<?>> executionsUpon(Object o) {
7067
return mutationMap.getOrDefault(o, Collections.emptyList());
7168
}
7269

73-
@Override
74-
public Set<OpExecution> currentExecutions() {
75-
return new HashSet<>(currentExecutions);
76-
}
77-
78-
7970
@Override
8071
public InfoChain opExecutionChain(Object op) {
8172
return dependencyChain.get(op);
8273
}
8374

8475
// -- HISTORY MAINTENANCE API -- //
8576

86-
/**
87-
* Logs an Op execution in the history
88-
* <p>
89-
* TODO: It would be nice if different Objects returned different Objects with
90-
* the same hash code would hash differently. For example, if two Ops return a
91-
* {@link Double} of the same value, they will appear as the same Object, and
92-
* asking for the execution history on either of the {@link Object}s will
93-
* suggest that both executions mutated both {@link Object}s. This would
94-
* really hamper the simplicity of the implementation, however.
95-
*
96-
* @param e the {@link OpExecution} that we'd like to record
97-
*/
98-
@Override
99-
public void addExecution(OpExecution e) {
100-
currentExecutions.add(e);
101-
}
102-
10377
@Override
10478
public void logOp(RichOp<?> op) {
10579
dependencyChain.put(op, op.infoChain());
10680
}
10781

10882
@Override
109-
public void logOutput(OpExecution e, Object output) {
110-
currentExecutions.remove(e);
83+
public void logOutput(RichOp<?> op, Object output) {
11184
if (!mutationMap.containsKey(output)) updateList(output);
112-
resolveExecution(e.op(), output);
85+
resolveExecution(op, output);
11386
}
11487

11588
// -- HELPER METHODS -- //

scijava/scijava-ops-engine/src/main/java/org/scijava/ops/engine/matcher/impl/AbstractRichOp.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33

44
import java.lang.reflect.Type;
55

6-
import org.scijava.ops.api.OpExecution;
76
import org.scijava.ops.api.OpInstance;
87
import org.scijava.ops.api.OpMetadata;
98
import org.scijava.ops.api.RichOp;
109
import org.scijava.ops.api.features.BaseOpHints.History;
11-
import org.scijava.ops.engine.progress.BinaryProgressReporter;
1210
import org.scijava.ops.engine.progress.Progress;
13-
import org.scijava.ops.engine.progress.ProgressReporters;
1411

1512
/**
1613
* An abstract implementation of {@link RichOp}. While this class has <b>no
@@ -48,19 +45,13 @@ public OpMetadata metadata() {
4845

4946
@Override
5047
public void preprocess(Object... inputs) {
51-
OpExecution e = new OpExecution(this);
52-
e.setReporter(new BinaryProgressReporter());
53-
ProgressReporters.add(e);
54-
metadata.history().addExecution(e);
5548
Progress.pushExecution(this);
5649
}
5750

5851
@Override
5952
public void postprocess(Object output) {
6053
// Log a new execution
61-
OpExecution e = ProgressReporters.remove();
62-
e.recordCompletion(output);
63-
metadata.history().logOutput(e, output);
54+
metadata.history().logOutput(this, output);
6455
Progress.popExecution();
6556
}
6657

scijava/scijava-ops-engine/src/main/java/org/scijava/ops/engine/progress/BinaryProgressReporter.java

Lines changed: 0 additions & 41 deletions
This file was deleted.

scijava/scijava-ops-engine/src/main/java/org/scijava/ops/engine/progress/DefaultProgressReporter.java

Lines changed: 0 additions & 41 deletions
This file was deleted.

scijava/scijava-ops-engine/src/main/java/org/scijava/ops/engine/progress/MultiStageProgressReporter.java

Lines changed: 0 additions & 65 deletions
This file was deleted.

scijava/scijava-ops-engine/src/main/java/org/scijava/ops/engine/progress/ProgressReporters.java

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)