-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathInvocationResult.java
More file actions
68 lines (52 loc) · 1.83 KB
/
Copy pathInvocationResult.java
File metadata and controls
68 lines (52 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package tests;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class InvocationResult {
public final Object result;
private long runtime;
private final List <Object> consumers = new ArrayList <> ();
private final List <String> output = new ArrayList <> ();
public InvocationResult (Object result, long runtime, List <Object> consumerResults) {
this.result = result; this.runtime = runtime;
consumers.addAll (consumerResults);
}
public InvocationResult (Object result, long runtime) {
this (result, runtime, List.of ());
}
public InvocationResult addConsumerValue (Object value) {
consumers.add (value);
return this;
}
public InvocationResult addConsumerValues (List <Object> values) {
consumers.addAll (values);
return this;
}
public InvocationResult addOutput (String output) {
this.output.add (0, output);
return this;
}
public InvocationResult addOutputs (List <String> output) {
this.output.addAll (0, output);
return this;
}
public InvocationResult addRuntime (long delta) {
runtime += delta;
return this;
}
public InvocationResult addAnotherResult (InvocationResult result) {
addConsumerValues (result.getConsumers ());
addRuntime (result.getRuntime ());
addOutputs (result.getOutput ());
return this;
}
public long getRuntime () {
return runtime;
}
public List <Object> getConsumers () {
return Collections.unmodifiableList (consumers);
}
public List <String> getOutput () {
return Collections.unmodifiableList (output);
}
}