MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / enlargeIfNeeded

Method enlargeIfNeeded

JSAT/src/jsat/utils/IntSet.java:143–159  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

141 }
142
143 private void enlargeIfNeeded()
144 {
145 if(used < keys.length*loadFactor)
146 return;
147 //enlarge
148 final byte[] oldSatus = status;
149 final int[] oldKeys = keys;
150
151 int newSize = getNextPow2TwinPrime(status.length*3/2);//it will actually end up doubling in size since we have twin primes spaced that was
152 status = new byte[newSize];
153 keys = new int[newSize];
154
155 used = 0;
156 for(int oldIndex = 0; oldIndex < oldSatus.length; oldIndex++)
157 if(oldSatus[oldIndex] == OCCUPIED)
158 add(oldKeys[oldIndex]);
159 }
160
161 @Override
162 public void clear()

Callers 1

addMethod · 0.95

Calls 2

addMethod · 0.95
getNextPow2TwinPrimeMethod · 0.80

Tested by

no test coverage detected