Skip to content

Commit

Permalink
Small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
burqen committed Aug 16, 2018
1 parent 05947db commit 54b0999
Showing 1 changed file with 19 additions and 15 deletions.
Expand Up @@ -916,11 +916,6 @@ private ArrayElementWriter numberArrayElementWriter( long long1 )
}
}

interface ArrayElementWriter
{
void write( PageCursor cursor, int i );
}

private void putArray( PageCursor cursor, ArrayElementWriter writer )
{
cursor.putInt( arrayLength );
Expand Down Expand Up @@ -1065,13 +1060,7 @@ boolean read( PageCursor cursor, int size )
case BOOLEAN_ARRAY:
return readArray( cursor, ArrayType.BOOLEAN, this::readBoolean );
case NUMBER_ARRAY:
long1 = cursor.getByte(); // number type, like: byte, int, short a.s.o.
ArrayType numberType = numberArrayTypeOf( (byte) long1 );
if ( numberType == null )
{
return false;
}
return readArray( cursor, numberType, numberArrayElementReader( long1 ) );
return readNumberArray( cursor );
default:
return false;
}
Expand All @@ -1095,6 +1084,17 @@ private boolean readArray( PageCursor cursor, ArrayType type, ArrayElementReader
return true;
}

private boolean readNumberArray( PageCursor cursor )
{
long1 = cursor.getByte(); // number type, like: byte, int, short a.s.o.
ArrayType numberType = numberArrayTypeOf( (byte) long1 );
if ( numberType == null )
{
return false;
}
return readArray( cursor, numberType, numberArrayElementReader( long1 ) );
}

private ArrayElementReader numberArrayElementReader( long long1 )
{
switch ( (int) long1 )
Expand Down Expand Up @@ -1862,8 +1862,6 @@ private static long[] ensureBigEnough( long[] array, int targetLength )

private static NumberValue numberAsValue( long long0, long long1 )
{
// There's a difference between composing a single text value and a array text value
// and there's therefore no common "raw" variant of it
return RawBits.asNumberValue( long0, (byte) long1 );
}

Expand All @@ -1879,7 +1877,7 @@ private static boolean booleanAsValueRaw( long long0 )

private static Value textAsValue( byte[] byteArray, long long0 )
{
// There's a difference between composing a single text value and a array text value
// There's a difference between composing a single text value and a array text values
// and there's therefore no common "raw" variant of it
return byteArray == null ? NO_VALUE : Values.utf8Value( byteArray, 0, (int) long0 );
}
Expand Down Expand Up @@ -1982,6 +1980,12 @@ interface ArrayElementReader
boolean readFrom( PageCursor cursor );
}

@FunctionalInterface
interface ArrayElementWriter
{
void write( PageCursor cursor, int i );
}

@FunctionalInterface
interface ArrayElementValueFactory<T>
{
Expand Down

0 comments on commit 54b0999

Please sign in to comment.