From d2556705dd7a0ff9fed1190bc7abe38b64ee445d Mon Sep 17 00:00:00 2001 From: Tobias Pietzsch <tobias.pietzsch@gmail.com> Date: Mon, 15 Jan 2018 14:54:04 +0100 Subject: [PATCH] Remove WrappedXxxType inner classes These are not necessary anymore. The volatile types are now in the same package as corresponding non-volatile, allowing to access package-private dataAccess field. --- .../type/numeric/VolatileARGBType.java | 24 +++---------------- .../numeric/integer/VolatileByteType.java | 24 +++---------------- .../type/numeric/integer/VolatileIntType.java | 24 +++---------------- .../numeric/integer/VolatileLongType.java | 24 +++---------------- .../numeric/integer/VolatileShortType.java | 24 +++---------------- .../integer/VolatileUnsignedByteType.java | 24 +++---------------- .../integer/VolatileUnsignedIntType.java | 24 +++---------------- .../integer/VolatileUnsignedLongType.java | 24 +++---------------- .../integer/VolatileUnsignedShortType.java | 24 +++---------------- .../type/numeric/real/VolatileDoubleType.java | 24 +++---------------- .../type/numeric/real/VolatileFloatType.java | 24 +++---------------- 11 files changed, 33 insertions(+), 231 deletions(-) diff --git a/src/main/java/net/imglib2/type/numeric/VolatileARGBType.java b/src/main/java/net/imglib2/type/numeric/VolatileARGBType.java index 840ab6f4..079a5e19 100644 --- a/src/main/java/net/imglib2/type/numeric/VolatileARGBType.java +++ b/src/main/java/net/imglib2/type/numeric/VolatileARGBType.java @@ -51,35 +51,17 @@ public class VolatileARGBType extends AbstractVolatileNativeNumericType< ARGBTyp { final protected NativeImg< ?, ? extends VolatileIntAccess > img; - private static class WrappedARGBType extends ARGBType - { - public WrappedARGBType( final NativeImg< ?, ? extends IntAccess > img ) - { - super( img ); - } - - public WrappedARGBType( final IntAccess access ) - { - super( access ); - } - - public void setAccess( final IntAccess access ) - { - dataAccess = access; - } - } - // this is the constructor if you want it to read from an array public VolatileARGBType( final NativeImg< ?, ? extends VolatileIntAccess > img ) { - super( new WrappedARGBType( img ), false ); + super( new ARGBType( img ), false ); this.img = img; } // this is the constructor if you want to specify the dataAccess public VolatileARGBType( final VolatileIntAccess access ) { - super( new WrappedARGBType( access ), access.isValid() ); + super( new ARGBType( access ), access.isValid() ); this.img = null; } @@ -105,7 +87,7 @@ public class VolatileARGBType extends AbstractVolatileNativeNumericType< ARGBTyp public void updateContainer( final Object c ) { final VolatileIntAccess a = img.update( c ); - ( ( WrappedARGBType ) t ).setAccess( a ); + t.dataAccess = a; setValid( a.isValid() ); } diff --git a/src/main/java/net/imglib2/type/numeric/integer/VolatileByteType.java b/src/main/java/net/imglib2/type/numeric/integer/VolatileByteType.java index fa80a8d4..4cb78cdc 100644 --- a/src/main/java/net/imglib2/type/numeric/integer/VolatileByteType.java +++ b/src/main/java/net/imglib2/type/numeric/integer/VolatileByteType.java @@ -48,35 +48,17 @@ public class VolatileByteType extends AbstractVolatileNativeRealType< ByteType, { final protected NativeImg< ?, ? extends VolatileByteAccess > img; - private static class WrappedByteType extends ByteType - { - public WrappedByteType( final NativeImg<?, ? extends ByteAccess> img ) - { - super( img ); - } - - public WrappedByteType( final ByteAccess access ) - { - super( access ); - } - - public void setAccess( final ByteAccess access ) - { - dataAccess = access; - } - } - // this is the constructor if you want it to read from an array public VolatileByteType( final NativeImg< ?, ? extends VolatileByteAccess > img ) { - super( new WrappedByteType( img ), false ); + super( new ByteType( img ), false ); this.img = img; } // this is the constructor if you want to specify the dataAccess public VolatileByteType( final VolatileByteAccess access ) { - super( new WrappedByteType( access ), access.isValid() ); + super( new ByteType( access ), access.isValid() ); this.img = null; } @@ -102,7 +84,7 @@ public class VolatileByteType extends AbstractVolatileNativeRealType< ByteType, public void updateContainer( final Object c ) { final VolatileByteAccess a = img.update( c ); - ( (WrappedByteType) t ).setAccess( a ); + t.dataAccess = a; setValid( a.isValid() ); } diff --git a/src/main/java/net/imglib2/type/numeric/integer/VolatileIntType.java b/src/main/java/net/imglib2/type/numeric/integer/VolatileIntType.java index 0a0094d4..380d9029 100644 --- a/src/main/java/net/imglib2/type/numeric/integer/VolatileIntType.java +++ b/src/main/java/net/imglib2/type/numeric/integer/VolatileIntType.java @@ -48,35 +48,17 @@ public class VolatileIntType extends AbstractVolatileNativeRealType< IntType, Vo { final protected NativeImg< ?, ? extends VolatileIntAccess > img; - private static class WrappedIntType extends IntType - { - public WrappedIntType( final NativeImg<?, ? extends IntAccess> img ) - { - super( img ); - } - - public WrappedIntType( final IntAccess access ) - { - super( access ); - } - - public void setAccess( final IntAccess access ) - { - dataAccess = access; - } - } - // this is the constructor if you want it to read from an array public VolatileIntType( final NativeImg< ?, ? extends VolatileIntAccess > img ) { - super( new WrappedIntType( img ), false ); + super( new IntType( img ), false ); this.img = img; } // this is the constructor if you want to specify the dataAccess public VolatileIntType( final VolatileIntAccess access ) { - super( new WrappedIntType( access ), access.isValid() ); + super( new IntType( access ), access.isValid() ); this.img = null; } @@ -102,7 +84,7 @@ public class VolatileIntType extends AbstractVolatileNativeRealType< IntType, Vo public void updateContainer( final Object c ) { final VolatileIntAccess a = img.update( c ); - ( (WrappedIntType) t ).setAccess( a ); + t.dataAccess = a; setValid( a.isValid() ); } diff --git a/src/main/java/net/imglib2/type/numeric/integer/VolatileLongType.java b/src/main/java/net/imglib2/type/numeric/integer/VolatileLongType.java index 0dca3955..b2945a79 100644 --- a/src/main/java/net/imglib2/type/numeric/integer/VolatileLongType.java +++ b/src/main/java/net/imglib2/type/numeric/integer/VolatileLongType.java @@ -48,35 +48,17 @@ public class VolatileLongType extends AbstractVolatileNativeRealType< LongType, { final protected NativeImg< ?, ? extends VolatileLongAccess > img; - private static class WrappedLongType extends LongType - { - public WrappedLongType( final NativeImg<?, ? extends LongAccess> img ) - { - super( img ); - } - - public WrappedLongType( final LongAccess access ) - { - super( access ); - } - - public void setAccess( final LongAccess access ) - { - dataAccess = access; - } - } - // this is the constructor if you want it to read from an array public VolatileLongType( final NativeImg< ?, ? extends VolatileLongAccess > img ) { - super( new WrappedLongType( img ), false ); + super( new LongType( img ), false ); this.img = img; } // this is the constructor if you want to specify the dataAccess public VolatileLongType( final VolatileLongAccess access ) { - super( new WrappedLongType( access ), access.isValid() ); + super( new LongType( access ), access.isValid() ); this.img = null; } @@ -102,7 +84,7 @@ public class VolatileLongType extends AbstractVolatileNativeRealType< LongType, public void updateContainer( final Object c ) { final VolatileLongAccess a = img.update( c ); - ( (WrappedLongType) t ).setAccess( a ); + t.dataAccess = a; setValid( a.isValid() ); } diff --git a/src/main/java/net/imglib2/type/numeric/integer/VolatileShortType.java b/src/main/java/net/imglib2/type/numeric/integer/VolatileShortType.java index ef03b2cd..92198aca 100644 --- a/src/main/java/net/imglib2/type/numeric/integer/VolatileShortType.java +++ b/src/main/java/net/imglib2/type/numeric/integer/VolatileShortType.java @@ -48,35 +48,17 @@ public class VolatileShortType extends AbstractVolatileNativeRealType< ShortType { final protected NativeImg< ?, ? extends VolatileShortAccess > img; - private static class WrappedShortType extends ShortType - { - public WrappedShortType( final NativeImg<?, ? extends ShortAccess> img ) - { - super( img ); - } - - public WrappedShortType( final ShortAccess access ) - { - super( access ); - } - - public void setAccess( final ShortAccess access ) - { - dataAccess = access; - } - } - // this is the constructor if you want it to read from an array public VolatileShortType( final NativeImg< ?, ? extends VolatileShortAccess > img ) { - super( new WrappedShortType( img ), false ); + super( new ShortType( img ), false ); this.img = img; } // this is the constructor if you want to specify the dataAccess public VolatileShortType( final VolatileShortAccess access ) { - super( new WrappedShortType( access ), access.isValid() ); + super( new ShortType( access ), access.isValid() ); this.img = null; } @@ -102,7 +84,7 @@ public class VolatileShortType extends AbstractVolatileNativeRealType< ShortType public void updateContainer( final Object c ) { final VolatileShortAccess a = img.update( c ); - ( (WrappedShortType) t ).setAccess( a ); + t.dataAccess = a; setValid( a.isValid() ); } diff --git a/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedByteType.java b/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedByteType.java index b8834fcd..2be925f1 100644 --- a/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedByteType.java +++ b/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedByteType.java @@ -49,35 +49,17 @@ public class VolatileUnsignedByteType extends AbstractVolatileNativeRealType< Un { final protected NativeImg< ?, ? extends VolatileByteAccess > img; - private static class WrappedUnsignedByteType extends UnsignedByteType - { - public WrappedUnsignedByteType( final NativeImg<?, ? extends ByteAccess> img ) - { - super( img ); - } - - public WrappedUnsignedByteType( final ByteAccess access ) - { - super( access ); - } - - public void setAccess( final ByteAccess access ) - { - dataAccess = access; - } - } - // this is the constructor if you want it to read from an array public VolatileUnsignedByteType( final NativeImg< ?, ? extends VolatileByteAccess > img ) { - super( new WrappedUnsignedByteType( img ), false ); + super( new UnsignedByteType( img ), false ); this.img = img; } // this is the constructor if you want to specify the dataAccess public VolatileUnsignedByteType( final VolatileByteAccess access ) { - super( new WrappedUnsignedByteType( access ), access.isValid() ); + super( new UnsignedByteType( access ), access.isValid() ); this.img = null; } @@ -103,7 +85,7 @@ public class VolatileUnsignedByteType extends AbstractVolatileNativeRealType< Un public void updateContainer( final Object c ) { final VolatileByteAccess a = img.update( c ); - ( ( WrappedUnsignedByteType )t ).setAccess( a ); + t.dataAccess = a; setValid( a.isValid() ); } diff --git a/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedIntType.java b/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedIntType.java index 3a1cce6a..53ebf01d 100644 --- a/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedIntType.java +++ b/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedIntType.java @@ -47,35 +47,17 @@ public class VolatileUnsignedIntType extends AbstractVolatileNativeRealType< Uns { final protected NativeImg< ?, ? extends VolatileIntAccess > img; - private static class WrappedUnsignedIntType extends UnsignedIntType - { - public WrappedUnsignedIntType( final NativeImg<?, ? extends IntAccess> img ) - { - super( img ); - } - - public WrappedUnsignedIntType( final IntAccess access ) - { - super( access ); - } - - public void setAccess( final IntAccess access ) - { - dataAccess = access; - } - } - // this is the constructor if you want it to read from an array public VolatileUnsignedIntType( final NativeImg< ?, ? extends VolatileIntAccess > img ) { - super( new WrappedUnsignedIntType( img ), false ); + super( new UnsignedIntType( img ), false ); this.img = img; } // this is the constructor if you want to specify the dataAccess public VolatileUnsignedIntType( final VolatileIntAccess access ) { - super( new WrappedUnsignedIntType( access ), access.isValid() ); + super( new UnsignedIntType( access ), access.isValid() ); this.img = null; } @@ -101,7 +83,7 @@ public class VolatileUnsignedIntType extends AbstractVolatileNativeRealType< Uns public void updateContainer( final Object c ) { final VolatileIntAccess a = img.update( c ); - ( ( WrappedUnsignedIntType ) t ).setAccess( a ); + t.dataAccess = a; setValid( a.isValid() ); } diff --git a/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedLongType.java b/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedLongType.java index c8a14fe0..5be7748b 100644 --- a/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedLongType.java +++ b/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedLongType.java @@ -47,35 +47,17 @@ public class VolatileUnsignedLongType extends AbstractVolatileNativeRealType< Un { final protected NativeImg< ?, ? extends VolatileLongAccess > img; - private static class WrappedUnsignedLongType extends UnsignedLongType - { - public WrappedUnsignedLongType( final NativeImg<?, ? extends LongAccess> img ) - { - super( img ); - } - - public WrappedUnsignedLongType( final LongAccess access ) - { - super( access ); - } - - public void setAccess( final LongAccess access ) - { - dataAccess = access; - } - } - // this is the constructor if you want it to read from an array public VolatileUnsignedLongType( final NativeImg< ?, ? extends VolatileLongAccess > img ) { - super( new WrappedUnsignedLongType( img ), false ); + super( new UnsignedLongType( img ), false ); this.img = img; } // this is the constructor if you want to specify the dataAccess public VolatileUnsignedLongType( final VolatileLongAccess access ) { - super( new WrappedUnsignedLongType( access ), access.isValid() ); + super( new UnsignedLongType( access ), access.isValid() ); this.img = null; } @@ -101,7 +83,7 @@ public class VolatileUnsignedLongType extends AbstractVolatileNativeRealType< Un public void updateContainer( final Object c ) { final VolatileLongAccess a = img.update( c ); - ( ( WrappedUnsignedLongType ) t ).setAccess( a ); + t.dataAccess = a; setValid( a.isValid() ); } diff --git a/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedShortType.java b/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedShortType.java index a63ef549..8d831e99 100644 --- a/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedShortType.java +++ b/src/main/java/net/imglib2/type/numeric/integer/VolatileUnsignedShortType.java @@ -48,35 +48,17 @@ public class VolatileUnsignedShortType extends AbstractVolatileNativeRealType< U { final protected NativeImg< ?, ? extends VolatileShortAccess > img; - private static class WrappedUnsignedShortType extends UnsignedShortType - { - public WrappedUnsignedShortType( final NativeImg<?, ? extends ShortAccess> img ) - { - super( img ); - } - - public WrappedUnsignedShortType( final ShortAccess access ) - { - super( access ); - } - - public void setAccess( final ShortAccess access ) - { - dataAccess = access; - } - } - // this is the constructor if you want it to read from an array public VolatileUnsignedShortType( final NativeImg< ?, ? extends VolatileShortAccess > img ) { - super( new WrappedUnsignedShortType( img ), false ); + super( new UnsignedShortType( img ), false ); this.img = img; } // this is the constructor if you want to specify the dataAccess public VolatileUnsignedShortType( final VolatileShortAccess access ) { - super( new WrappedUnsignedShortType( access ), access.isValid() ); + super( new UnsignedShortType( access ), access.isValid() ); this.img = null; } @@ -102,7 +84,7 @@ public class VolatileUnsignedShortType extends AbstractVolatileNativeRealType< U public void updateContainer( final Object c ) { final VolatileShortAccess a = img.update( c ); - ( (WrappedUnsignedShortType) t ).setAccess( a ); + t.dataAccess = a; setValid( a.isValid() ); } diff --git a/src/main/java/net/imglib2/type/numeric/real/VolatileDoubleType.java b/src/main/java/net/imglib2/type/numeric/real/VolatileDoubleType.java index eb821a3e..3a5e3f40 100644 --- a/src/main/java/net/imglib2/type/numeric/real/VolatileDoubleType.java +++ b/src/main/java/net/imglib2/type/numeric/real/VolatileDoubleType.java @@ -48,35 +48,17 @@ public class VolatileDoubleType extends AbstractVolatileNativeRealType< DoubleTy { final protected NativeImg< ?, ? extends VolatileDoubleAccess > img; - private static class WrappedDoubleType extends DoubleType - { - public WrappedDoubleType( final NativeImg<?, ? extends DoubleAccess> img ) - { - super( img ); - } - - public WrappedDoubleType( final DoubleAccess access ) - { - super( access ); - } - - public void setAccess( final DoubleAccess access ) - { - dataAccess = access; - } - } - // this is the constructor if you want it to read from an array public VolatileDoubleType( final NativeImg< ?, ? extends VolatileDoubleAccess > img ) { - super( new WrappedDoubleType( img ), false ); + super( new DoubleType( img ), false ); this.img = img; } // this is the constructor if you want to specify the dataAccess public VolatileDoubleType( final VolatileDoubleAccess access ) { - super( new WrappedDoubleType( access ), access.isValid() ); + super( new DoubleType( access ), access.isValid() ); this.img = null; } @@ -102,7 +84,7 @@ public class VolatileDoubleType extends AbstractVolatileNativeRealType< DoubleTy public void updateContainer( final Object c ) { final VolatileDoubleAccess a = img.update( c ); - ( ( WrappedDoubleType )t ).setAccess( a ); + t.dataAccess = a; setValid( a.isValid() ); } diff --git a/src/main/java/net/imglib2/type/numeric/real/VolatileFloatType.java b/src/main/java/net/imglib2/type/numeric/real/VolatileFloatType.java index 1da5bcb8..c89bb7d3 100644 --- a/src/main/java/net/imglib2/type/numeric/real/VolatileFloatType.java +++ b/src/main/java/net/imglib2/type/numeric/real/VolatileFloatType.java @@ -48,35 +48,17 @@ public class VolatileFloatType extends AbstractVolatileNativeRealType< FloatType { final protected NativeImg< ?, ? extends VolatileFloatAccess > img; - private static class WrappedFloatType extends FloatType - { - public WrappedFloatType( final NativeImg<?, ? extends FloatAccess> img ) - { - super( img ); - } - - public WrappedFloatType( final FloatAccess access ) - { - super( access ); - } - - public void setAccess( final FloatAccess access ) - { - dataAccess = access; - } - } - // this is the constructor if you want it to read from an array public VolatileFloatType( final NativeImg< ?, ? extends VolatileFloatAccess > img ) { - super( new WrappedFloatType( img ), false ); + super( new FloatType( img ), false ); this.img = img; } // this is the constructor if you want to specify the dataAccess public VolatileFloatType( final VolatileFloatAccess access ) { - super( new WrappedFloatType( access ), access.isValid() ); + super( new FloatType( access ), access.isValid() ); this.img = null; } @@ -102,7 +84,7 @@ public class VolatileFloatType extends AbstractVolatileNativeRealType< FloatType public void updateContainer( final Object c ) { final VolatileFloatAccess a = img.update( c ); - ( ( WrappedFloatType )t ).setAccess( a ); + t.dataAccess = a; setValid( a.isValid() ); } -- GitLab