Skip to content

Commit 1a4766e

Browse files
committed
Fix ordering bug in Computers.match
1 parent 5671ae0 commit 1a4766e

File tree

2 files changed

+29
-28
lines changed

2 files changed

+29
-28
lines changed

src/main/java/org/scijava/ops/function/Computers.java

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -99,62 +99,62 @@ public static <I, O> Computers.Arity1<I, O> match(final OpService ops, final Str
9999
@SuppressWarnings("unchecked")
100100
public static <I1, I2, O> Computers.Arity2<I1, I2, O> match(final OpService ops, final String opName,
101101
final Nil<I1> in1Type, final Nil<I2> in2Type, final Nil<O> outType) {
102-
return matchHelper(ops, opName, Computers.Arity2.class, outType, in2Type, in1Type);
102+
return matchHelper(ops, opName, Computers.Arity2.class, outType, in1Type, in2Type);
103103
}
104104

105105
@SuppressWarnings("unchecked")
106106
public static <I1, I2, I3, O> Computers.Arity3<I1, I2, I3, O> match(final OpService ops, final String opName,
107107
final Nil<I1> in1Type, final Nil<I2> in2Type, final Nil<I3> in3Type, final Nil<O> outType) {
108-
return matchHelper(ops, opName, Computers.Arity3.class, outType, in2Type, in3Type, in1Type);
108+
return matchHelper(ops, opName, Computers.Arity3.class, outType, in1Type, in2Type, in3Type);
109109
}
110110

111111
@SuppressWarnings("unchecked")
112112
public static <I1, I2, I3, I4, O> Computers.Arity4<I1, I2, I3, I4, O> match(final OpService ops,
113113
final String opName, final Nil<I1> in1Type, final Nil<I2> in2Type, final Nil<I3> in3Type,
114114
final Nil<I4> in4Type, final Nil<O> outType) {
115-
return matchHelper(ops, opName, Computers.Arity4.class, outType, in2Type, in3Type, in4Type, in1Type);
115+
return matchHelper(ops, opName, Computers.Arity4.class, outType, in1Type, in2Type, in3Type, in4Type);
116116
}
117117

118118
@SuppressWarnings("unchecked")
119119
public static <I1, I2, I3, I4, I5, O> Computers.Arity5<I1, I2, I3, I4, I5, O> match(final OpService ops,
120120
final String opName, final Nil<I1> in1Type, final Nil<I2> in2Type, final Nil<I3> in3Type,
121121
final Nil<I4> in4Type, final Nil<I5> in5Type, final Nil<O> outType) {
122-
return matchHelper(ops, opName, Computers.Arity5.class, outType, in2Type, in3Type, in4Type, in5Type, in1Type);
122+
return matchHelper(ops, opName, Computers.Arity5.class, outType, in1Type, in2Type, in3Type, in4Type, in5Type);
123123
}
124124

125125
@SuppressWarnings("unchecked")
126126
public static <I1, I2, I3, I4, I5, I6, O> Computers.Arity6<I1, I2, I3, I4, I5, I6, O> match(final OpService ops,
127127
final String opName, final Nil<I1> in1Type, final Nil<I2> in2Type, final Nil<I3> in3Type,
128128
final Nil<I4> in4Type, final Nil<I5> in5Type, final Nil<I6> in6Type, final Nil<O> outType) {
129-
return matchHelper(ops, opName, Computers.Arity6.class, outType, in2Type, in3Type, in4Type, in5Type, in6Type,
130-
in1Type);
129+
return matchHelper(ops, opName, Computers.Arity6.class, outType, in1Type, in2Type, in3Type, in4Type, in5Type,
130+
in6Type);
131131
}
132132

133133
@SuppressWarnings("unchecked")
134134
public static <I1, I2, I3, I4, I5, I6, I7, O> Computers.Arity7<I1, I2, I3, I4, I5, I6, I7, O> match(
135135
final OpService ops, final String opName, final Nil<I1> in1Type, final Nil<I2> in2Type,
136136
final Nil<I3> in3Type, final Nil<I4> in4Type, final Nil<I5> in5Type, final Nil<I6> in6Type,
137137
final Nil<I7> in7Type, final Nil<O> outType) {
138-
return matchHelper(ops, opName, Computers.Arity7.class, outType, in2Type, in3Type, in4Type, in5Type, in6Type,
139-
in7Type, in1Type);
138+
return matchHelper(ops, opName, Computers.Arity7.class, outType, in1Type, in2Type, in3Type, in4Type, in5Type,
139+
in6Type, in7Type);
140140
}
141141

142142
@SuppressWarnings("unchecked")
143143
public static <I1, I2, I3, I4, I5, I6, I7, I8, O> Computers.Arity8<I1, I2, I3, I4, I5, I6, I7, I8, O> match(
144144
final OpService ops, final String opName, final Nil<I1> in1Type, final Nil<I2> in2Type,
145145
final Nil<I3> in3Type, final Nil<I4> in4Type, final Nil<I5> in5Type, final Nil<I6> in6Type,
146146
final Nil<I7> in7Type, final Nil<I8> in8Type, final Nil<O> outType) {
147-
return matchHelper(ops, opName, Computers.Arity8.class, outType, in2Type, in3Type, in4Type, in5Type, in6Type,
148-
in7Type, in8Type, in1Type);
147+
return matchHelper(ops, opName, Computers.Arity8.class, outType, in1Type, in2Type, in3Type, in4Type, in5Type,
148+
in6Type, in7Type, in8Type);
149149
}
150150

151151
@SuppressWarnings("unchecked")
152152
public static <I1, I2, I3, I4, I5, I6, I7, I8, I9, O> Computers.Arity9<I1, I2, I3, I4, I5, I6, I7, I8, I9, O> match(
153153
final OpService ops, final String opName, final Nil<I1> in1Type, final Nil<I2> in2Type,
154154
final Nil<I3> in3Type, final Nil<I4> in4Type, final Nil<I5> in5Type, final Nil<I6> in6Type,
155155
final Nil<I7> in7Type, final Nil<I8> in8Type, final Nil<I9> in9Type, final Nil<O> outType) {
156-
return matchHelper(ops, opName, Computers.Arity9.class, outType, in2Type, in3Type, in4Type, in5Type, in6Type,
157-
in7Type, in8Type, in9Type, in1Type);
156+
return matchHelper(ops, opName, Computers.Arity9.class, outType, in1Type, in2Type, in3Type, in4Type, in5Type,
157+
in6Type, in7Type, in8Type, in9Type);
158158
}
159159

160160
@SuppressWarnings("unchecked")
@@ -163,8 +163,8 @@ public static <I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, O> Computers.Arity10<I1,
163163
final Nil<I3> in3Type, final Nil<I4> in4Type, final Nil<I5> in5Type, final Nil<I6> in6Type,
164164
final Nil<I7> in7Type, final Nil<I8> in8Type, final Nil<I9> in9Type, final Nil<I10> in10Type,
165165
final Nil<O> outType) {
166-
return matchHelper(ops, opName, Computers.Arity10.class, outType, in2Type, in3Type, in4Type, in5Type, in6Type,
167-
in7Type, in8Type, in9Type, in10Type, in1Type);
166+
return matchHelper(ops, opName, Computers.Arity10.class, outType, in1Type, in2Type, in3Type, in4Type, in5Type,
167+
in6Type, in7Type, in8Type, in9Type, in10Type);
168168
}
169169

170170
@SuppressWarnings("unchecked")
@@ -173,8 +173,8 @@ public static <I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, O> Computers.Arity1
173173
final Nil<I3> in3Type, final Nil<I4> in4Type, final Nil<I5> in5Type, final Nil<I6> in6Type,
174174
final Nil<I7> in7Type, final Nil<I8> in8Type, final Nil<I9> in9Type, final Nil<I10> in10Type,
175175
final Nil<I11> in11Type, final Nil<O> outType) {
176-
return matchHelper(ops, opName, Computers.Arity11.class, outType, in2Type, in3Type, in4Type, in5Type, in6Type,
177-
in7Type, in8Type, in9Type, in10Type, in11Type, in1Type);
176+
return matchHelper(ops, opName, Computers.Arity11.class, outType, in1Type, in2Type, in3Type, in4Type, in5Type,
177+
in6Type, in7Type, in8Type, in9Type, in10Type, in11Type);
178178
}
179179

180180
@SuppressWarnings("unchecked")
@@ -183,8 +183,8 @@ public static <I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, O> Computers.A
183183
final Nil<I3> in3Type, final Nil<I4> in4Type, final Nil<I5> in5Type, final Nil<I6> in6Type,
184184
final Nil<I7> in7Type, final Nil<I8> in8Type, final Nil<I9> in9Type, final Nil<I10> in10Type,
185185
final Nil<I11> in11Type, final Nil<I12> in12Type, final Nil<O> outType) {
186-
return matchHelper(ops, opName, Computers.Arity12.class, outType, in2Type, in3Type, in4Type, in5Type, in6Type,
187-
in7Type, in8Type, in9Type, in10Type, in11Type, in12Type, in1Type);
186+
return matchHelper(ops, opName, Computers.Arity12.class, outType, in1Type, in2Type, in3Type, in4Type, in5Type,
187+
in6Type, in7Type, in8Type, in9Type, in10Type, in11Type, in12Type);
188188
}
189189

190190
@SuppressWarnings("unchecked")
@@ -193,8 +193,8 @@ public static <I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, O> Comput
193193
final Nil<I3> in3Type, final Nil<I4> in4Type, final Nil<I5> in5Type, final Nil<I6> in6Type,
194194
final Nil<I7> in7Type, final Nil<I8> in8Type, final Nil<I9> in9Type, final Nil<I10> in10Type,
195195
final Nil<I11> in11Type, final Nil<I12> in12Type, final Nil<I13> in13Type, final Nil<O> outType) {
196-
return matchHelper(ops, opName, Computers.Arity13.class, outType, in2Type, in3Type, in4Type, in5Type, in6Type,
197-
in7Type, in8Type, in9Type, in10Type, in11Type, in12Type, in13Type, in1Type);
196+
return matchHelper(ops, opName, Computers.Arity13.class, outType, in1Type, in2Type, in3Type, in4Type, in5Type,
197+
in6Type, in7Type, in8Type, in9Type, in10Type, in11Type, in12Type, in13Type);
198198
}
199199

200200
@SuppressWarnings("unchecked")
@@ -204,8 +204,8 @@ public static <I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, O> C
204204
final Nil<I7> in7Type, final Nil<I8> in8Type, final Nil<I9> in9Type, final Nil<I10> in10Type,
205205
final Nil<I11> in11Type, final Nil<I12> in12Type, final Nil<I13> in13Type, final Nil<I14> in14Type,
206206
final Nil<O> outType) {
207-
return matchHelper(ops, opName, Computers.Arity14.class, outType, in2Type, in3Type, in4Type, in5Type, in6Type,
208-
in7Type, in8Type, in9Type, in10Type, in11Type, in12Type, in13Type, in14Type, in1Type);
207+
return matchHelper(ops, opName, Computers.Arity14.class, outType, in1Type, in2Type, in3Type, in4Type, in5Type,
208+
in6Type, in7Type, in8Type, in9Type, in10Type, in11Type, in12Type, in13Type, in14Type);
209209
}
210210

211211
@SuppressWarnings("unchecked")
@@ -215,8 +215,8 @@ public static <I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15,
215215
final Nil<I7> in7Type, final Nil<I8> in8Type, final Nil<I9> in9Type, final Nil<I10> in10Type,
216216
final Nil<I11> in11Type, final Nil<I12> in12Type, final Nil<I13> in13Type, final Nil<I14> in14Type,
217217
final Nil<I15> in15Type, final Nil<O> outType) {
218-
return matchHelper(ops, opName, Computers.Arity15.class, outType, in2Type, in3Type, in4Type, in5Type, in6Type,
219-
in7Type, in8Type, in9Type, in10Type, in11Type, in12Type, in13Type, in14Type, in15Type, in1Type);
218+
return matchHelper(ops, opName, Computers.Arity15.class, outType, in1Type, in2Type, in3Type, in4Type, in5Type,
219+
in6Type, in7Type, in8Type, in9Type, in10Type, in11Type, in12Type, in13Type, in14Type, in15Type);
220220
}
221221

222222
@SuppressWarnings("unchecked")
@@ -226,9 +226,9 @@ public static <I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15,
226226
final Nil<I7> in7Type, final Nil<I8> in8Type, final Nil<I9> in9Type, final Nil<I10> in10Type,
227227
final Nil<I11> in11Type, final Nil<I12> in12Type, final Nil<I13> in13Type, final Nil<I14> in14Type,
228228
final Nil<I15> in15Type, final Nil<I16> in16Type, final Nil<O> outType) {
229-
return matchHelper(ops, opName, Computers.Arity16.class, outType, in2Type, in3Type, in4Type, in5Type, in6Type,
230-
in7Type, in8Type, in9Type, in10Type, in11Type, in12Type, in13Type, in14Type, in15Type, in16Type,
231-
in1Type);
229+
return matchHelper(ops, opName, Computers.Arity16.class, outType, in1Type, in2Type, in3Type, in4Type, in5Type,
230+
in6Type, in7Type, in8Type, in9Type, in10Type, in11Type, in12Type, in13Type, in14Type, in15Type,
231+
in16Type);
232232
}
233233

234234
@SuppressWarnings({ "unchecked" })

templates/main/java/org/scijava/ops/function/Computers.list

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ arities = (0..maxArity).collect()
55
nilArgs = ```
66
{ arity ->
77
names = nilNames(arity)
8-
names.swap(0, names.size() - 1)
8+
output = names.remove(names.size() - 1)
9+
names.add(0, output)
910
String.join(', ', names)
1011
}
1112
```

0 commit comments

Comments
 (0)