Skip to content

Commit e2e2059

Browse files
gselzerctrueden
authored andcommitted
Delete IntegerType create ops
1 parent a530091 commit e2e2059

2 files changed

Lines changed: 24 additions & 156 deletions

File tree

src/main/java/net/imagej/ops/create/Creators.java

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -161,34 +161,10 @@ public class Creators<N extends NativeType<N>, L, I extends IntegerType<I>, T ex
161161
Util.getTypeFromInterval(rai));
162162

163163
/* IntegerType */
164-
// TODO: delete
165164

166-
@OpField(names = "create.integerType")
167-
@Parameter(key = "maxValue")
165+
@OpField(names = "create.integerType", priority = Priority.NORMAL)
168166
@Parameter(key = "integerType", type = ItemIO.OUTPUT)
169-
public final Function<Long, IntegerType> integerTypeFromLong = (maxValue) -> {
170-
if (maxValue <= 0L)
171-
return new IntType();
172-
if (maxValue <= 1L)
173-
return new BitType();
174-
if (maxValue <= 0x7fL)
175-
return new ByteType();
176-
if (maxValue <= 0xffL)
177-
return new UnsignedByteType();
178-
if (maxValue <= 0x7fffL)
179-
return new ShortType();
180-
if (maxValue <= 0xffffL)
181-
return new UnsignedShortType();
182-
if (maxValue <= 0x7fffffffL)
183-
return new IntType();
184-
if (maxValue <= 0xffffffffL)
185-
return new UnsignedIntType();
186-
return new LongType();
187-
};
188-
189-
@OpField(names = "create.integerType")
190-
@Parameter(key = "integerType", type = ItemIO.OUTPUT)
191-
public final Source<IntegerType> integerTypeSource = () -> integerTypeFromLong.apply(new Long(0));
167+
public final Source<LongType> integerTypeSource = () -> new LongType();
192168

193169
/* Type */
194170

@@ -197,8 +173,7 @@ public class Creators<N extends NativeType<N>, L, I extends IntegerType<I>, T ex
197173
@Parameter(key = "type", type = ItemIO.OUTPUT)
198174
public final Function<T, T> typeFromSampleType = (sample) -> sample.createVariable();
199175

200-
// TODO: is this safe?
201-
@OpField(names = "create.type")
176+
@OpField(names = "create.type", priority = Priority.LOW)
202177
@Parameter(key = "booleanType", type = ItemIO.OUTPUT)
203178
public final Source<BitType> booleanTypeSource = () -> new BitType();
204179

@@ -506,6 +481,26 @@ public class Creators<N extends NativeType<N>, L, I extends IntegerType<I>, T ex
506481
@Parameter(key = "labelingMapping", type = ItemIO.OUTPUT)
507482
public final Source<LabelingMapping<L>> labelingMappingSource = () -> new LabelingMapping<>(
508483
integerTypeSource.create());
484+
485+
public final Function<Long, IntegerType> integerTypeFromLong = (maxValue) -> {
486+
if (maxValue <= 0L)
487+
return new IntType();
488+
if (maxValue <= 1L)
489+
return new BitType();
490+
if (maxValue <= 0x7fL)
491+
return new ByteType();
492+
if (maxValue <= 0xffL)
493+
return new UnsignedByteType();
494+
if (maxValue <= 0x7fffL)
495+
return new ShortType();
496+
if (maxValue <= 0xffffL)
497+
return new UnsignedShortType();
498+
if (maxValue <= 0x7fffffffL)
499+
return new IntType();
500+
if (maxValue <= 0xffffffffL)
501+
return new UnsignedIntType();
502+
return new LongType();
503+
};
509504

510505
@OpField(names = "create.labelingMapping")
511506
@Parameter(key = "maxNumSets")
@@ -530,7 +525,7 @@ public class Creators<N extends NativeType<N>, L, I extends IntegerType<I>, T ex
530525

531526
/* NativeType */
532527

533-
@OpField(names = "create.nativeType")
528+
@OpField(names = "create.nativeType", priority = Priority.HIGH)
534529
@Parameter(key = "nativeType", type = ItemIO.OUTPUT)
535530
public final Source<DoubleType> defaultNativeType = () -> new DoubleType();
536531

src/test/java/net/imagej/ops/create/CreateIntegerTypeTest.java

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

0 commit comments

Comments
 (0)