MCPcopy Index your code
hub / github.com/EdwardRaff/JSAT / enlargeIfNeeded

Method enlargeIfNeeded

JSAT/src/jsat/utils/IntDoubleMap.java:234–252  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

232 }
233
234 private void enlargeIfNeeded()
235 {
236 if(used < keys.length*loadFactor)
237 return;
238 //enlarge
239 final byte[] oldSatus = status;
240 final int[] oldKeys = keys;
241 final double[] oldTable = table;
242
243 int newSize = getNextPow2TwinPrime(status.length*3/2);//it will actually end up doubling in size since we have twin primes spaced that was
244 status = new byte[newSize];
245 keys = new int[newSize];
246 table = new double[newSize];
247
248 used = 0;
249 for(int oldIndex = 0; oldIndex < oldSatus.length; oldIndex++)
250 if(oldSatus[oldIndex] == OCCUPIED)
251 put(oldKeys[oldIndex], oldTable[oldIndex]);
252 }
253
254 @Override
255 public boolean containsKey(Object key)

Callers 2

putMethod · 0.95
incrementMethod · 0.95

Calls 2

putMethod · 0.95
getNextPow2TwinPrimeMethod · 0.80

Tested by

no test coverage detected