Skip to content

Commit

Permalink
Fix toString formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd committed Mar 9, 2018
1 parent b6b411e commit 66fab1e
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 29 deletions.
Expand Up @@ -62,7 +62,7 @@ public int compareValueTo( DateSchemaKey other )
@Override @Override
public String toString() public String toString()
{ {
return format( "value=%s,entityId=%d,epochDay=%s", asValue(), getEntityId(), epochDay ); return format( "value=%s,entityId=%d,epochDay=%d", asValue(), getEntityId(), epochDay );
} }


@Override @Override
Expand Down
Expand Up @@ -19,8 +19,6 @@
*/ */
package org.neo4j.kernel.impl.index.schema; package org.neo4j.kernel.impl.index.schema;


import java.util.Comparator;

import org.neo4j.index.internal.gbptree.Layout; import org.neo4j.index.internal.gbptree.Layout;
import org.neo4j.io.pagecache.PageCursor; import org.neo4j.io.pagecache.PageCursor;
import org.neo4j.kernel.api.schema.index.IndexDescriptor; import org.neo4j.kernel.api.schema.index.IndexDescriptor;
Expand All @@ -35,13 +33,12 @@ public static Layout<DurationSchemaKey,NativeSchemaValue> of( IndexDescriptor de
return descriptor.type() == IndexDescriptor.Type.UNIQUE ? DurationLayout.UNIQUE : DurationLayout.NON_UNIQUE; return descriptor.type() == IndexDescriptor.Type.UNIQUE ? DurationLayout.UNIQUE : DurationLayout.NON_UNIQUE;
} }


private static DurationLayout UNIQUE = new DurationLayout( "UTdu", 0, 1, ComparableNativeSchemaKey.UNIQUE() ); private static DurationLayout UNIQUE = new DurationLayout( "UTdu", 0, 1 );
private static DurationLayout NON_UNIQUE = new DurationLayout( "NTdu", 0, 1, ComparableNativeSchemaKey.NON_UNIQUE() ); private static DurationLayout NON_UNIQUE = new DurationLayout( "NTdu", 0, 1 );


private DurationLayout( private DurationLayout( String layoutName, int majorVersion, int minorVersion )
String layoutName, int majorVersion, int minorVersion, Comparator<DurationSchemaKey> comparator )
{ {
super( layoutName, majorVersion, minorVersion, comparator ); super( layoutName, majorVersion, minorVersion );
} }


@Override @Override
Expand Down
Expand Up @@ -30,7 +30,7 @@
* Durations are tricky, because exactly how long a duration is depends on the start date. We therefore sort them by * Durations are tricky, because exactly how long a duration is depends on the start date. We therefore sort them by
* average total time in seconds, but keep the original months and days so we can reconstruct the value. * average total time in seconds, but keep the original months and days so we can reconstruct the value.
*/ */
class DurationSchemaKey extends TemporalSchemaKey implements ComparableNativeSchemaKey<DurationSchemaKey> class DurationSchemaKey extends ComparableNativeSchemaKey<DurationSchemaKey>
{ {
/** /**
* An average month is 30 days, 10 hours and 30 minutes. * An average month is 30 days, 10 hours and 30 minutes.
Expand Down Expand Up @@ -59,19 +59,17 @@ public Value asValue()
} }


@Override @Override
public void initAsLowest() public void initValueAsLowest()
{ {
super.initAsLowest();
totalAvgSeconds = Long.MIN_VALUE; totalAvgSeconds = Long.MIN_VALUE;
nanosOfSecond = Integer.MIN_VALUE; nanosOfSecond = Integer.MIN_VALUE;
months = Long.MIN_VALUE; months = Long.MIN_VALUE;
days = Long.MIN_VALUE; days = Long.MIN_VALUE;
} }


@Override @Override
public void initAsHighest() public void initValueAsHighest()
{ {
super.initAsHighest();
totalAvgSeconds = Long.MAX_VALUE; totalAvgSeconds = Long.MAX_VALUE;
nanosOfSecond = Integer.MAX_VALUE; nanosOfSecond = Integer.MAX_VALUE;
months = Long.MAX_VALUE; months = Long.MAX_VALUE;
Expand Down Expand Up @@ -101,7 +99,7 @@ public int compareValueTo( DurationSchemaKey other )
public String toString() public String toString()
{ {
return format( "value=%s,entityId=%d,totalAvgSeconds=%d,nanosOfSecond=%d,months=%d,days=%d", return format( "value=%s,entityId=%d,totalAvgSeconds=%d,nanosOfSecond=%d,months=%d,days=%d",
asValue(), entityId, totalAvgSeconds, nanosOfSecond, months, days ); asValue(), getEntityId(), totalAvgSeconds, nanosOfSecond, months, days );
} }


@Override @Override
Expand Down
Expand Up @@ -62,7 +62,7 @@ public int compareValueTo( LocalTimeSchemaKey other )
@Override @Override
public String toString() public String toString()
{ {
return format( "value=%s,entityId=%d,nanoOfDay=%s", asValue(), getEntityId(), nanoOfDay ); return format( "value=%s,entityId=%d,nanoOfDay=%d", asValue(), getEntityId(), nanoOfDay );
} }


@Override @Override
Expand Down
Expand Up @@ -258,7 +258,7 @@ public PartAccessor<?> newZonedTime() throws IOException
} }


@Override @Override
public PartAccessor<?> newDuration() public PartAccessor<?> newDuration() throws IOException
{ {
return createPartAccessor( temporalIndexFiles.duration() ); return createPartAccessor( temporalIndexFiles.duration() );
} }
Expand Down
Expand Up @@ -19,8 +19,6 @@
*/ */
package org.neo4j.kernel.impl.index.schema; package org.neo4j.kernel.impl.index.schema;


import java.util.Comparator;

import org.neo4j.index.internal.gbptree.Layout; import org.neo4j.index.internal.gbptree.Layout;
import org.neo4j.io.pagecache.PageCursor; import org.neo4j.io.pagecache.PageCursor;
import org.neo4j.kernel.api.schema.index.IndexDescriptor; import org.neo4j.kernel.api.schema.index.IndexDescriptor;
Expand All @@ -35,13 +33,12 @@ public static Layout<ZonedTimeSchemaKey,NativeSchemaValue> of( IndexDescriptor d
return descriptor.type() == IndexDescriptor.Type.UNIQUE ? ZonedTimeLayout.UNIQUE : ZonedTimeLayout.NON_UNIQUE; return descriptor.type() == IndexDescriptor.Type.UNIQUE ? ZonedTimeLayout.UNIQUE : ZonedTimeLayout.NON_UNIQUE;
} }


private static final ZonedTimeLayout UNIQUE = new ZonedTimeLayout( "UTzt", 0, 1, ComparableNativeSchemaKey.UNIQUE() ); private static final ZonedTimeLayout UNIQUE = new ZonedTimeLayout( "UTzt", 0, 1 );
private static final ZonedTimeLayout NON_UNIQUE = new ZonedTimeLayout( "NTzt", 0, 1, ComparableNativeSchemaKey.NON_UNIQUE() ); private static final ZonedTimeLayout NON_UNIQUE = new ZonedTimeLayout( "NTzt", 0, 1 );


private ZonedTimeLayout( private ZonedTimeLayout( String layoutName, int majorVersion, int minorVersion )
String layoutName, int majorVersion, int minorVersion, Comparator<ZonedTimeSchemaKey> comparator )
{ {
super( layoutName, majorVersion, minorVersion, comparator ); super( layoutName, majorVersion, minorVersion );
} }


@Override @Override
Expand Down
Expand Up @@ -31,7 +31,7 @@
* *
* With these keys the TimeValues are sorted by UTC time of day, and then by time zone. * With these keys the TimeValues are sorted by UTC time of day, and then by time zone.
*/ */
class ZonedTimeSchemaKey extends TemporalSchemaKey implements ComparableNativeSchemaKey<ZonedTimeSchemaKey> class ZonedTimeSchemaKey extends ComparableNativeSchemaKey<ZonedTimeSchemaKey>
{ {
static final int SIZE = static final int SIZE =
Long.BYTES + /* nanosOfDayUTC */ Long.BYTES + /* nanosOfDayUTC */
Expand All @@ -48,17 +48,15 @@ public Value asValue()
} }


@Override @Override
public void initAsLowest() public void initValueAsLowest()
{ {
super.initAsLowest();
nanosOfDayUTC = Long.MIN_VALUE; nanosOfDayUTC = Long.MIN_VALUE;
zoneOffsetSeconds = Integer.MIN_VALUE; zoneOffsetSeconds = Integer.MIN_VALUE;
} }


@Override @Override
public void initAsHighest() public void initValueAsHighest()
{ {
super.initAsHighest();
nanosOfDayUTC = Long.MAX_VALUE; nanosOfDayUTC = Long.MAX_VALUE;
zoneOffsetSeconds = Integer.MAX_VALUE; zoneOffsetSeconds = Integer.MAX_VALUE;
} }
Expand All @@ -78,7 +76,7 @@ public int compareValueTo( ZonedTimeSchemaKey other )
public String toString() public String toString()
{ {
return format( "value=%s,entityId=%d,nanosOfDayUTC=%d,zoneOffsetSeconds=%d", return format( "value=%s,entityId=%d,nanosOfDayUTC=%d,zoneOffsetSeconds=%d",
asValue(), entityId, nanosOfDayUTC, zoneOffsetSeconds ); asValue(), getEntityId(), nanosOfDayUTC, zoneOffsetSeconds );
} }


@Override @Override
Expand Down

0 comments on commit 66fab1e

Please sign in to comment.