@Test public void testIsNew() { final long delta = 10000; final Shard firstShard = new Shard( 10000, 10000, true ); final Shard secondShard = new Shard( 10000, 10001, true ); final ShardEntryGroup shardGroup = new ShardEntryGroup( delta ); shardGroup.addShard( secondShard ); shardGroup.addShard( firstShard ); final boolean resultCreateTime = shardGroup.isNew( secondShard.getCreatedTime() ); assertTrue( "This is a new shard", resultCreateTime ); final boolean resultEqualToDelta = shardGroup.isNew( secondShard.getCreatedTime() + delta ); assertTrue( "This is a new shard", resultEqualToDelta ); final boolean greaterThan = shardGroup.isNew( secondShard.getCreatedTime() + delta + 1 ); assertFalse( "This is not a new shard", greaterThan ); }
public boolean isNew(final long currentTime){ return currentTime - delta <= maxCreatedTime; }
ShardEntryGroup { public boolean isNew(final long currentTime){ return currentTime - delta <= maxCreatedTime; } }
ShardEntryGroup { public boolean isNew(final long currentTime){ return currentTime - delta <= maxCreatedTime; } ShardEntryGroup( final long delta ); }
ShardEntryGroup { public boolean isNew(final long currentTime){ return currentTime - delta <= maxCreatedTime; } ShardEntryGroup( final long delta ); boolean addShard( final Shard shard ); Shard getMinShard(); Collection<Shard> getReadShards(); Collection<Shard> getWriteShards( long currentTime ); boolean isCompactionPending(); Shard getCompactionTarget(); int entrySize(); boolean shouldCompact( final long currentTime ); boolean isNew(final long currentTime); boolean canBeDeleted( final Shard shard ); @Override String toString(); }
ShardEntryGroup { public boolean isNew(final long currentTime){ return currentTime - delta <= maxCreatedTime; } ShardEntryGroup( final long delta ); boolean addShard( final Shard shard ); Shard getMinShard(); Collection<Shard> getReadShards(); Collection<Shard> getWriteShards( long currentTime ); boolean isCompactionPending(); Shard getCompactionTarget(); int entrySize(); boolean shouldCompact( final long currentTime ); boolean isNew(final long currentTime); boolean canBeDeleted( final Shard shard ); @Override String toString();  }