Skip to content

Commit

Permalink
Rename Index fields in accessors to "typeIndex"
Browse files Browse the repository at this point in the history
  • Loading branch information
tpietzsch committed Apr 21, 2021
1 parent 56969db commit f413f0b
Show file tree
Hide file tree
Showing 16 changed files with 155 additions and 155 deletions.
20 changes: 10 additions & 10 deletions src/main/java/net/imglib2/img/array/AbstractArrayCursor.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public abstract class AbstractArrayCursor< T extends NativeType< T > > extends A
*/
protected final T type;

private final Index index;
private final Index typeIndex;

/**
* Source image
Expand All @@ -92,12 +92,12 @@ protected AbstractArrayCursor( final AbstractArrayCursor< T > cursor )

this.img = cursor.img;
this.type = img.createLinkedType();
this.index = type.index();
this.typeIndex = type.index();
this.offset = cursor.offset;
this.size = cursor.size;
this.lastIndex = cursor.lastIndex;

index.set( cursor.index.get() );
typeIndex.set( cursor.typeIndex.get() );
type.updateContainer( this );
}

Expand All @@ -113,7 +113,7 @@ public AbstractArrayCursor( final ArrayImg< T, ? > img, final int offset, final
super( img.numDimensions() );

this.type = img.createLinkedType();
this.index = type.index();
this.typeIndex = type.index();
this.img = img;
this.lastIndex = offset + size - 1;
this.offset = offset;
Expand All @@ -131,25 +131,25 @@ public T get()
@Override
public boolean hasNext()
{
return index.get() < lastIndex;
return typeIndex.get() < lastIndex;
}

@Override
public void jumpFwd( final long steps )
{
index.inc( ( int ) steps );
typeIndex.inc( ( int ) steps );
}

@Override
public void fwd()
{
index.inc();
typeIndex.inc();
}

@Override
public void reset()
{
index.set( offset - 1 );
typeIndex.set( offset - 1 );
type.updateContainer( this );
}

Expand All @@ -162,12 +162,12 @@ public String toString()
@Override
public int getIntPosition( final int dim )
{
return IntervalIndexer.indexToPosition( index.get(), img.dim, dim );
return IntervalIndexer.indexToPosition( typeIndex.get(), img.dim, dim );
}

@Override
public void localize( final int[] position )
{
IntervalIndexer.indexToPosition( index.get(), img.dim, position );
IntervalIndexer.indexToPosition( typeIndex.get(), img.dim, position );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public abstract class AbstractArrayLocalizingCursor< T extends NativeType< T > >
*/
protected final T type;

private final Index index;
private final Index typeIndex;

/**
* The underlying source {@link ArrayImg}.
Expand Down Expand Up @@ -99,7 +99,7 @@ protected AbstractArrayLocalizingCursor( final AbstractArrayLocalizingCursor< T

this.img = cursor.img;
this.type = img.createLinkedType();
this.index = type.index();
this.typeIndex = type.index();
this.offset = cursor.offset;
this.size = cursor.size;

Expand All @@ -112,7 +112,7 @@ protected AbstractArrayLocalizingCursor( final AbstractArrayLocalizingCursor< T
max[ d ] = cursor.max[ d ];
}

index.set( cursor.index.get() );
typeIndex.set( cursor.typeIndex.get() );
type.updateContainer( this );
}

Expand All @@ -132,7 +132,7 @@ public AbstractArrayLocalizingCursor( final ArrayImg< T, ? > img, final int offs
this.size = size;

this.type = img.createLinkedType();
this.index = type.index();
this.typeIndex = type.index();
this.lastIndex = offset + size - 1;

max = new int[ n ];
Expand All @@ -157,7 +157,7 @@ public T get()
@Override
public boolean hasNext()
{
return index.get() < lastIndex;
return typeIndex.get() < lastIndex;
}

/**
Expand All @@ -166,7 +166,7 @@ public boolean hasNext()
@Override
public void fwd()
{
index.inc();
typeIndex.inc();

// for ( int d = 0; d < n; ++d )
// {
Expand Down Expand Up @@ -207,8 +207,8 @@ public void fwd()
@Override
public void jumpFwd( final long steps )
{
index.inc( ( int ) steps );
IntervalIndexer.indexToPosition( index.get(), img.dim, position );
typeIndex.inc( ( int ) steps );
IntervalIndexer.indexToPosition( typeIndex.get(), img.dim, position );
}

/**
Expand All @@ -217,7 +217,7 @@ public void jumpFwd( final long steps )
@Override
public void reset()
{
index.set( offset - 1 );
typeIndex.set( offset - 1 );

IntervalIndexer.indexToPosition( offset, img.dim, position );
position[ 0 ]--;
Expand Down
48 changes: 24 additions & 24 deletions src/main/java/net/imglib2/img/array/ArrayRandomAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class ArrayRandomAccess< T extends NativeType< T > > extends AbstractLoca
{
protected final T type;

private final Index index;
private final Index typeIndex;

final ArrayImg< T, ? > img;

Expand All @@ -63,13 +63,13 @@ protected ArrayRandomAccess( final ArrayRandomAccess< T > randomAccess )

this.img = randomAccess.img;
this.type = img.createLinkedType();
this.index = type.index();
this.typeIndex = type.index();

index.set( 0 );
typeIndex.set( 0 );
for ( int d = 0; d < n; d++ )
{
position[ d ] = randomAccess.position[ d ];
index.inc( position[ d ] * img.steps[ d ] );
typeIndex.inc( position[ d ] * img.steps[ d ] );
}

type.updateContainer( this );
Expand All @@ -81,9 +81,9 @@ public ArrayRandomAccess( final ArrayImg< T, ? > container )

this.img = container;
this.type = container.createLinkedType();
this.index = type.index();
this.typeIndex = type.index();

index.set( 0 );
typeIndex.set( 0 );
for ( int d = 0; d < n; d++ )
position[ d ] = 0;

Expand All @@ -99,28 +99,28 @@ public T get()
@Override
public void fwd( final int d )
{
index.inc( img.steps[ d ] );
typeIndex.inc( img.steps[ d ] );
++position[ d ];
}

@Override
public void bck( final int d )
{
index.dec( img.steps[ d ] );
typeIndex.dec( img.steps[ d ] );
--position[ d ];
}

@Override
public void move( final int distance, final int d )
{
index.inc( img.steps[ d ] * distance );
typeIndex.inc( img.steps[ d ] * distance );
position[ d ] += distance;
}

@Override
public void move( final long distance, final int d )
{
index.inc( img.steps[ d ] * ( int ) distance );
typeIndex.inc( img.steps[ d ] * ( int ) distance );
position[ d ] += distance;
}

Expand All @@ -134,7 +134,7 @@ public void move( final Localizable localizable )
position[ d ] += distance;
move += distance * img.steps[ d ];
}
index.inc( move );
typeIndex.inc( move );
}

@Override
Expand All @@ -146,7 +146,7 @@ public void move( final int[] distance )
position[ d ] += distance[ d ];
move += distance[ d ] * img.steps[ d ];
}
index.inc( move );
typeIndex.inc( move );
}

@Override
Expand All @@ -158,7 +158,7 @@ public void move( final long[] distance )
position[ d ] += distance[ d ];
move += distance[ d ] * img.steps[ d ];
}
index.inc( move );
typeIndex.inc( move );
}

@Override
Expand All @@ -170,7 +170,7 @@ public void setPosition( final Localizable localizable )
position[ d ] = localizable.getIntPosition( d );
i += position[ d ] * img.steps[ d ];
}
index.set( i );
typeIndex.set( i );
}

@Override
Expand All @@ -182,7 +182,7 @@ public void setPosition( final int[] pos )
position[ d ] = pos[ d ];
i += pos[ d ] * img.steps[ d ];
}
index.set( i );
typeIndex.set( i );
}

@Override
Expand All @@ -195,20 +195,20 @@ public void setPosition( final long[] pos )
position[ d ] = p;
i += p * img.steps[ d ];
}
index.set( i );
typeIndex.set( i );
}

@Override
public void setPosition( final int pos, final int d )
{
index.inc( ( pos - position[ d ] ) * img.steps[ d ] );
typeIndex.inc( ( pos - position[ d ] ) * img.steps[ d ] );
position[ d ] = pos;
}

@Override
public void setPosition( final long pos, final int d )
{
index.inc( ( ( int ) pos - position[ d ] ) * img.steps[ d ] );
typeIndex.inc( ( ( int ) pos - position[ d ] ) * img.steps[ d ] );
position[ d ] = ( int ) pos;
}

Expand All @@ -231,7 +231,7 @@ public ArrayRandomAccess< T > copyRandomAccess()
*/
public void fwdDim0()
{
index.inc();
typeIndex.inc();
++position[ 0 ];
}

Expand All @@ -240,7 +240,7 @@ public void fwdDim0()
*/
public void bckDim0()
{
index.dec();
typeIndex.dec();
--position[ 0 ];
}

Expand All @@ -252,7 +252,7 @@ public void bckDim0()
*/
public void moveDim0( final int distance )
{
index.inc( distance );
typeIndex.inc( distance );
position[ 0 ] += distance;
}

Expand All @@ -264,7 +264,7 @@ public void moveDim0( final int distance )
*/
public void move( final long distance )
{
index.inc( ( int ) distance );
typeIndex.inc( ( int ) distance );
position[ 0 ] += distance;
}

Expand All @@ -279,7 +279,7 @@ public void move( final long distance )
*/
public void setPositionDim0( final int pos )
{
index.set( pos );
typeIndex.set( pos );
position[ 0 ] = pos;
}

Expand All @@ -294,7 +294,7 @@ public void setPositionDim0( final int pos )
*/
public void setPositionDim0( final long pos )
{
index.set( ( int ) pos );
typeIndex.set( ( int ) pos );
position[ 0 ] = ( int ) pos;
}
}
Loading

0 comments on commit f413f0b

Please sign in to comment.