Skip to content

Commit

Permalink
Add default getType impl for Sampler and IterableRealInterval
Browse files Browse the repository at this point in the history
  • Loading branch information
tpietzsch committed May 7, 2024
1 parent eb42ae1 commit 6d46513
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/main/java/net/imglib2/IterableRealInterval.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ default T firstElement() // TODO: fix places where it is not necessary to implem
* NB: We cannot have a default implementation here because of
* https://bugs.openjdk.org/browse/JDK-7120669
*/
// @Override
// default T getType()
// {
// return firstElement();
// }
@Override
default T getType()
{
return firstElement();
}

/**
* Returns the iteration order of this {@link IterableRealInterval}. If the
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/net/imglib2/KDTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ private static < A > Iterable< RealLocalizable > positionsIterable( IterableReal
{
return new AbstractConvertedIterableRealInterval< A, RealLocalizable >( sourceInterval )
{

class Cursor extends AbstractConvertedRealCursor< A, RealLocalizable >
{
Cursor( final RealCursor< A > source )
Expand All @@ -143,12 +144,6 @@ public RealLocalizable getType()
}
}

@Override
public RealLocalizable getType()
{
return firstElement();
}

@Override
public AbstractConvertedRealCursor< A, RealLocalizable > cursor()
{
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/net/imglib2/Sampler.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ public interface Sampler< T > extends Typed< T >
*/
Sampler< T > copy();

// @Override default T getType() // TODO GET-TYPE: do we want a default implementation here?
// {
// return get();
// }
@Override
default T getType()
{
return get();
}
}

0 comments on commit 6d46513

Please sign in to comment.