@Test public void testGetPrevious() { TableCutList list = new TableCutList( 2, true ); assertThat( list.getPrevious( 10 ), is( nullValue() ) ); list.put( 10, Boolean.TRUE ); list.put( 20, Boolean.TRUE ); assertThat( list.getPrevious( 10 ), is( nullValue() ) ); assertThat( list.getPrevious( 20 ), is( equalTo( true ) ) ); assertThat( list.getPrevious( 30 ), is( equalTo( true ) ) ); }
public Boolean getPrevious( final long key ) { if ( size == 0 ) { return null; } if ( key > keys[size - 1] ) { return entries[size - 1]; } final int position = findKeyInternal( key ); if ( position == 0 ) { return null; } if ( position > 0 ) { return entries[position - 1]; } final int insertPoint = -( position + 2 ); return entries[insertPoint]; }
TableCutList implements Cloneable { public Boolean getPrevious( final long key ) { if ( size == 0 ) { return null; } if ( key > keys[size - 1] ) { return entries[size - 1]; } final int position = findKeyInternal( key ); if ( position == 0 ) { return null; } if ( position > 0 ) { return entries[position - 1]; } final int insertPoint = -( position + 2 ); return entries[insertPoint]; } }
TableCutList implements Cloneable { public Boolean getPrevious( final long key ) { if ( size == 0 ) { return null; } if ( key > keys[size - 1] ) { return entries[size - 1]; } final int position = findKeyInternal( key ); if ( position == 0 ) { return null; } if ( position > 0 ) { return entries[position - 1]; } final int insertPoint = -( position + 2 ); return entries[insertPoint]; } TableCutList( final int increment, final boolean enableQuickLookup ); }
TableCutList implements Cloneable { public Boolean getPrevious( final long key ) { if ( size == 0 ) { return null; } if ( key > keys[size - 1] ) { return entries[size - 1]; } final int position = findKeyInternal( key ); if ( position == 0 ) { return null; } if ( position > 0 ) { return entries[position - 1]; } final int insertPoint = -( position + 2 ); return entries[insertPoint]; } TableCutList( final int increment, final boolean enableQuickLookup ); TableCutList clone(); void clear(); boolean isEnableQuickLookup(); void setEnableQuickLookup( final boolean enableQuickLookup ); int size(); boolean put( final long key, final Boolean entry ); boolean remove( final long key ); Boolean get( final long key ); Boolean getPrevious( final long key ); boolean containsKey( final long key ); Boolean[] getRawEntries(); long[] getKeys(); long[] getKeys( long[] retval ); int findKeyPosition( final long coordinate, final boolean greater ); int findKeyPosition( final long coordinate, final boolean greater, final int lastFoundPos ); long getKeyAt( final int indexPosition ); Boolean getValueAt( final int indexPosition ); long findKey( final long key, final boolean upperBounds ); void removeAll( final long[] cutArray, final long cutSize ); }
TableCutList implements Cloneable { public Boolean getPrevious( final long key ) { if ( size == 0 ) { return null; } if ( key > keys[size - 1] ) { return entries[size - 1]; } final int position = findKeyInternal( key ); if ( position == 0 ) { return null; } if ( position > 0 ) { return entries[position - 1]; } final int insertPoint = -( position + 2 ); return entries[insertPoint]; } TableCutList( final int increment, final boolean enableQuickLookup ); TableCutList clone(); void clear(); boolean isEnableQuickLookup(); void setEnableQuickLookup( final boolean enableQuickLookup ); int size(); boolean put( final long key, final Boolean entry ); boolean remove( final long key ); Boolean get( final long key ); Boolean getPrevious( final long key ); boolean containsKey( final long key ); Boolean[] getRawEntries(); long[] getKeys(); long[] getKeys( long[] retval ); int findKeyPosition( final long coordinate, final boolean greater ); int findKeyPosition( final long coordinate, final boolean greater, final int lastFoundPos ); long getKeyAt( final int indexPosition ); Boolean getValueAt( final int indexPosition ); long findKey( final long key, final boolean upperBounds ); void removeAll( final long[] cutArray, final long cutSize ); static long bin; static long lin; }