public Int2IntSortedMap getTopK() { final Int2IntSortedMap finalMap = new Int2IntRBTreeMap(this.greater); this.data.forEach((k, v) -> finalMap.put(k.intValue(), v.get())); return finalMap; }
@Override public boolean contains(final int k) { return containsValue(k); } @Override
/** * Creates a new tree map using the elements of two parallel arrays and the * given comparator. * * @param k * the array of keys of the new tree map. * @param v * the array of corresponding values in the new tree map. * @param c * a (possibly type-specific) comparator. * @throws IllegalArgumentException * if {@code k} and {@code v} have different lengths. */ public Int2IntRBTreeMap(final int[] k, final int v[], final Comparator<? super Integer> c) { this(c); if (k.length != v.length) throw new IllegalArgumentException( "The key array and the value array have different lengths (" + k.length + " and " + v.length + ")"); for (int i = 0; i < k.length; i++) this.put(k[i], v[i]); } /**
final Int2IntRBTreeMap candidates = new Int2IntRBTreeMap(); while( candidates.size() < MAX_TRY && ! candidates.containsValue( entryBitLength = (int)( td.bitsForTowers() / td.numberOfEntries() ) ) ) { td.clear(); tryTower( quantumBitLength, entryBitLength, toTheEnd, cacheSkipBitCount, td, false ); candidates.put( (int)( td.bitsForTowers() / td.numberOfEntries() ), entryBitLength ); if ( ASSERTS ) assert candidates.size() < MAX_TRY; entryBitLength = candidates.get( candidates.firstIntKey() );
final Int2IntRBTreeMap candidates = new Int2IntRBTreeMap(); while( candidates.size() < MAX_TRY && ! candidates.containsValue( entryBitLength = (int)( td.bitsForTowers() / td.numberOfEntries() ) ) ) { td.clear(); tryTower( quantumBitLength, entryBitLength, toTheEnd, cacheSkipBitCount, td, false ); candidates.put( (int)( td.bitsForTowers() / td.numberOfEntries() ), entryBitLength ); if ( ASSERTS ) assert candidates.size() < MAX_TRY; entryBitLength = candidates.get( candidates.firstIntKey() );
final Int2IntRBTreeMap candidates = new Int2IntRBTreeMap(); while( candidates.size() < MAX_TRY && ! candidates.containsValue( entryBitLength = (int)( td.bitsForTowers() / td.numberOfEntries() ) ) ) { td.clear(); tryTower( quantumBitLength, entryBitLength, toTheEnd, cacheSkipBitCount, td, false ); candidates.put( (int)( td.bitsForTowers() / td.numberOfEntries() ), entryBitLength ); if ( ASSERTS ) assert candidates.size() < MAX_TRY; entryBitLength = candidates.get( candidates.firstIntKey() );
@Override public int put(final int k, final int v) { modified = false; if (!in(k)) throw new IllegalArgumentException("Key (" + k + ") out of range [" + (bottom ? "-" : String.valueOf(from)) + ", " + (top ? "-" : String.valueOf(to)) + ")"); final int oldValue = Int2IntRBTreeMap.this.put(k, v); return modified ? this.defRetValue : oldValue; } @Override
public Int2IntSortedMap getTopK() { final Int2IntSortedMap finalMap = new Int2IntRBTreeMap(this.greater); this.data.forEach((k, v) -> finalMap.put(k.intValue(), v.get())); return finalMap; }
final Int2IntRBTreeMap candidates = new Int2IntRBTreeMap(); while( candidates.size() < MAX_TRY && ! candidates.containsValue( entryBitLength = (int)( td.bitsForTowers() / td.numberOfEntries() ) ) ) { td.clear(); tryTower( quantumBitLength, entryBitLength, toTheEnd, cacheSkipBitCount, td, false ); candidates.put( (int)( td.bitsForTowers() / td.numberOfEntries() ), entryBitLength ); if ( ASSERTS ) assert candidates.size() < MAX_TRY; entryBitLength = candidates.get( candidates.firstIntKey() );
final Int2IntRBTreeMap candidates = new Int2IntRBTreeMap(); while( candidates.size() < MAX_TRY && ! candidates.containsValue( entryBitLength = (int)( td.bitsForTowers() / td.numberOfEntries() ) ) ) { td.clear(); tryTower( quantumBitLength, positionsQuantumBitLength, entryBitLength, toTheEnd, cacheSkipBitCount, td, false ); candidates.put( (int)( td.bitsForTowers() / td.numberOfEntries() ), entryBitLength ); if ( ASSERTS ) assert candidates.size() < MAX_TRY; entryBitLength = candidates.get( candidates.firstIntKey() );
final Int2IntRBTreeMap candidates = new Int2IntRBTreeMap(); while( candidates.size() < MAX_TRY && ! candidates.containsValue( entryBitLength = (int)( td.bitsForTowers() / td.numberOfEntries() ) ) ) { td.clear(); tryTower( quantumBitLength, positionsQuantumBitLength, entryBitLength, toTheEnd, cacheSkipBitCount, td, false ); candidates.put( (int)( td.bitsForTowers() / td.numberOfEntries() ), entryBitLength ); if ( ASSERTS ) assert candidates.size() < MAX_TRY; entryBitLength = candidates.get( candidates.firstIntKey() );
final Int2IntRBTreeMap candidates = new Int2IntRBTreeMap(); while( candidates.size() < MAX_TRY && ! candidates.containsValue( entryBitLength = (int)( td.bitsForTowers() / td.numberOfEntries() ) ) ) { td.clear(); tryTower( quantumBitLength, positionsQuantumBitLength, entryBitLength, toTheEnd, cacheSkipBitCount, td, false ); candidates.put( (int)( td.bitsForTowers() / td.numberOfEntries() ), entryBitLength ); if ( ASSERTS ) assert candidates.size() < MAX_TRY; entryBitLength = candidates.get( candidates.firstIntKey() );
final Int2IntRBTreeMap candidates = new Int2IntRBTreeMap(); while( candidates.size() < MAX_TRY && ! candidates.containsValue( entryBitLength = (int)( td.bitsForTowers() / td.numberOfEntries() ) ) ) { td.clear(); tryTower( quantumBitLength, positionsQuantumBitLength, entryBitLength, toTheEnd, cacheSkipBitCount, td, false ); candidates.put( (int)( td.bitsForTowers() / td.numberOfEntries() ), entryBitLength ); if ( ASSERTS ) assert candidates.size() < MAX_TRY; entryBitLength = candidates.get( candidates.firstIntKey() );