Skip to content

Commit

Permalink
Rename method in AbstractInterleavedBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
haozhun committed Jun 24, 2016
1 parent 20841d3 commit 6ad169e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
Expand Up @@ -25,7 +25,7 @@ public abstract class AbstractInterleavedBlock

protected abstract Block getBlock(int blockIndex);

protected abstract int computePosition(int position);
protected abstract int toAbsolutePosition(int position);

@Override
public abstract InterleavedBlockEncoding getEncoding();
Expand Down Expand Up @@ -69,7 +69,7 @@ protected InterleavedBlockEncoding computeBlockEncoding()
@Override
public void writePositionTo(int position, BlockBuilder blockBuilder)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -79,7 +79,7 @@ public void writePositionTo(int position, BlockBuilder blockBuilder)
@Override
public byte getByte(int position, int offset)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -89,7 +89,7 @@ public byte getByte(int position, int offset)
@Override
public short getShort(int position, int offset)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -99,7 +99,7 @@ public short getShort(int position, int offset)
@Override
public int getInt(int position, int offset)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -109,7 +109,7 @@ public int getInt(int position, int offset)
@Override
public long getLong(int position, int offset)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -119,7 +119,7 @@ public long getLong(int position, int offset)
@Override
public Slice getSlice(int position, int offset, int length)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -129,7 +129,7 @@ public Slice getSlice(int position, int offset, int length)
@Override
public <T> T getObject(int position, Class<T> clazz)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -139,7 +139,7 @@ public <T> T getObject(int position, Class<T> clazz)
@Override
public int getLength(int position)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -149,7 +149,7 @@ public int getLength(int position)
@Override
public boolean equals(int position, int offset, Block otherBlock, int otherPosition, int otherOffset, int length)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -159,7 +159,7 @@ public boolean equals(int position, int offset, Block otherBlock, int otherPosit
@Override
public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -169,7 +169,7 @@ public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherO
@Override
public long hash(int position, int offset, int length)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -179,7 +179,7 @@ public long hash(int position, int offset, int length)
@Override
public int compareTo(int position, int offset, int length, Block otherBlock, int otherPosition, int otherOffset, int otherLength)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -189,7 +189,7 @@ public int compareTo(int position, int offset, int length, Block otherBlock, int
@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -199,7 +199,7 @@ public int bytesCompare(int position, int offset, int length, Slice otherSlice,
@Override
public void writeBytesTo(int position, int offset, int length, BlockBuilder blockBuilder)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -209,7 +209,7 @@ public void writeBytesTo(int position, int offset, int length, BlockBuilder bloc
@Override
public Block getSingleValueBlock(int position)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand All @@ -231,7 +231,7 @@ public Block copyPositions(List<Integer> positions)
}
int ordinal = 0;
for (int position : positions) {
position = computePosition(position);
position = toAbsolutePosition(position);
if (ordinal % columns != position % columns) {
throw new IllegalArgumentException("Position (" + position + ") is not congruent to ordinal (" + ordinal + ") modulo columns (" + columns + ")");
}
Expand Down Expand Up @@ -262,7 +262,7 @@ protected void validateRange(int position, int length)

protected Block sliceRange(int position, int length, boolean compact)
{
position = computePosition(position);
position = toAbsolutePosition(position);
Block[] resultBlocks = new Block[columns];
int positionInBlock = position / columns;
int subBlockLength = length / columns;
Expand All @@ -280,7 +280,7 @@ protected Block sliceRange(int position, int length, boolean compact)
@Override
public boolean isNull(int position)
{
position = computePosition(position);
position = toAbsolutePosition(position);
int blockIndex = position % columns;
int positionInBlock = position / columns;

Expand Down
Expand Up @@ -71,7 +71,7 @@ private InterleavedBlock(Block[] blocks, int start, int positionCount, int retai
public Block getRegion(int position, int length)
{
validateRange(position, length);
return new InterleavedBlock(blocks, computePosition(position), length, retainedSizeInBytes, blockEncoding);
return new InterleavedBlock(blocks, toAbsolutePosition(position), length, retainedSizeInBytes, blockEncoding);
}

@Override
Expand All @@ -85,7 +85,7 @@ protected Block getBlock(int blockIndex)
}

@Override
protected int computePosition(int position)
protected int toAbsolutePosition(int position)
{
return position + start;
}
Expand Down
Expand Up @@ -91,7 +91,7 @@ protected Block getBlock(int blockIndex)
}

@Override
protected int computePosition(int position)
protected int toAbsolutePosition(int position)
{
return position;
}
Expand Down

0 comments on commit 6ad169e

Please sign in to comment.