/** * @brief Delete from ALL auction lists! * <p>The FilterManager does this, as it needs to be internally self-consistent. * @param ae - The auction entry to delete. */ public void delEntry(AuctionEntry ae) { String id = ae.getIdentifier(); DeletedEntry.create(id); ae.cancelSnipe(false); mFilter.deleteAuction(ae); ae.delete(); }
public int clearDeleted() { int rval = DeletedEntry.clear(); saveAuctions(); System.gc(); return rval; }
public void remove(K key) { int hash = getIndex(key); int initialHash = -1; // 테이블전체가 꽉차있지않고 && 해당노드가 지워지거나 다른것이있을때 반복 while (hash != initialHash && (table[hash] == DeletedEntry.getUniqueDeletedEntry() || table[hash] != null && !table[hash].getKey().equals(key))) { if (initialHash == -1) initialHash = hash; hash = (hash + 1) % table.length; } // 전체가 꽉차있지않고 && 해당노드가 null이아닌경우 삭제 if (hash != initialHash && table[hash] != null) { table[hash] = DeletedEntry.getUniqueDeletedEntry(); size--; } }
private void resize() { int tableSize = 2 * table.length; maxSize = (int) (tableSize * threshold); HashEntry[] oldTable = table; table = new HashEntry[tableSize]; size = 0; // 그대로 복사X 다시 해싱 후 put for (int i = 0; i < oldTable.length; i++) if (oldTable[i] != null && oldTable[i] != DeletedEntry.getUniqueDeletedEntry()) put((K) oldTable[i].getKey(), (V) oldTable[i].getValue()); }
public void put(K key, V value) { int hash = getIndex(key); int initialHash = -1; int indexOfDeletedEntry = -1; // 테이블전체가 꽉차있지않고 && 해당노드가 지워지거나 다른것이있을때 반복 while (hash != initialHash && (table[hash] == DeletedEntry.getUniqueDeletedEntry() || (table[hash] != null && !table[hash].getKey().equals(key)))) { if (initialHash == -1) initialHash = hash; if (table[hash] == DeletedEntry.getUniqueDeletedEntry()) indexOfDeletedEntry = hash; hash = (hash + 1) % table.length; } // 꽉차있거나 빈노드가 있어서 while 루프를 멈췄지만 삭제된 노드가 있는경우 if (indexOfDeletedEntry != -1 && (table[hash] == null || hash == initialHash)) { table[indexOfDeletedEntry] = new HashEntry(key, value); // 삭제된 곳에 삽입 size++; } // 꽉차있지 않은경우 else if (initialHash != hash) { // value값을 수정하는경우 if (table[hash] != DeletedEntry.getUniqueDeletedEntry() && table[hash] != null && table[hash].getKey().equals(key)) { table[hash].setValue(value); } else { table[hash] = new HashEntry(key, value); size++; } if (size >= maxSize) // 최대적재율보다 커진경우 resize(); resize(); } }
public V get(K key) { int hash = getIndex(key); int initialHash = -1; // 테이블전체가 꽉차있지않고 && 해당노드가 지워지거나 다른것이있을때 반복 while (hash != initialHash && (table[hash] == DeletedEntry.getUniqueDeletedEntry() || (table[hash] != null && !table[hash].getKey().equals(key)))) { if (initialHash == -1) initialHash = hash; hash = (hash + 1) % table.length; } // 못찾은 경우 if (table[hash] == null || hash == initialHash) { return null; } else { // 찾은경우 return (V) table[hash].getValue(); } }