Skip to content

Commit f2db467

Browse files
Treiblesschorlectrueden
authored andcommitted
Add debug messages and toString
1 parent 040ff3c commit f2db467

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/main/java/org/scijava/ops/OpService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,16 @@ public <T> T findOpInstance(final String opName, final Nil<T> specialType, final
167167
OpCandidate match = findTypeMatch(ref);
168168
return (T) match.createOp(secondaryArgs);
169169
} catch (OpMatchingException e) {
170+
log.debug("No matching Op for request: " + ref + "\n");
171+
log.debug("Attempting Op transformation...");
170172
// If we can't find an op matching the original request, we try to find a transformation
171173
OpTransformationCandidate transformation = transformer.findTransfromation(ref);
172174
// If we found one, try to do transformation and return transformed op
173175
if (transformation != null) {
176+
log.debug("Matching Op transformation found:\n" + transformation + "\n");
174177
return (T) transformation.exceute(this, secondaryArgs);
175178
}
179+
log.debug("No matching Op transformation found");
176180
throw new IllegalArgumentException(e);
177181
}
178182
}

src/main/java/org/scijava/ops/transform/OpTransformation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public String toString() {
9898
int i = 0;
9999
OpTransformation c = this;
100100
do {
101-
s.append(i + ")\n");
101+
s.append(i + ")");
102102
s.append("\tFrom:\t");
103103
s.append(Arrays.deepToString(c.getSource().getTypes()));
104104
s.append("\n\tTo:\t\t");

src/main/java/org/scijava/ops/transform/OpTransformationCandidate.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,12 @@ public Object exceute(OpService opService, Object... secondaryArgs) {
2727
return null;
2828
}
2929
}
30+
31+
@Override
32+
public String toString() {
33+
StringBuilder s = new StringBuilder();
34+
s.append("Source Op:\n\n" + srcOp + "\n");
35+
s.append("With transformation: \n" + transformation);
36+
return s.toString();
37+
}
3038
}

0 commit comments

Comments
 (0)