Removes a hole. Called on transaction recover to invalidate a delete for a record. Try to shrink the file if the invalidated
entry is not in the middle of valid entries.

@param iPosition
Record position to find and invalidate
@return
@throws IOException
763223
public boolean removeEntryWithPosition(final long iPosition) throws IOException {
    // BROWSE IN ASCENDING ORDER UNTIL THE REQUESTED POSITION IS FOUND
    boolean canShrink = true;
    for (int pos = getHoles() - 1; pos >= 0; --pos) {
      final long recycledPosition = file.readLong(pos * RECORD_SIZE);

      if (recycledPosition == iPosition) {
        if (OLogManager.instance().isDebugEnabled())
          OLogManager.instance().debug(this, "Removing hole #%d containing the position #%d:%d", pos, owner.getId(),
              recycledPosition);

        file.writeLong(pos * RECORD_SIZE, -1);
        if (canShrink)
          // SHRINK THE FILE
          file.removeTail((getHoles() - pos) * RECORD_SIZE);

        return true;

      } else if (iPosition != -1)
        // NO NULL ENTRY: CAN'T SHRINK WITHOUT LOST OF ENTRIES
        canShrink = false;
    }
    return false;
  }
927048
public void insert(RecordId rid) {
		// Block read-only transaction
		if (tx.isReadOnly() && !isTempTable())
			throw new UnsupportedOperationException();

		// Insertion may change the properties of this file,
		// so that we need to lock the file.
		if (!isTempTable())
			tx.concurrencyMgr().modifyFile(fileName);

		// Open the header
		if (fhp == null)
			fhp = openHeaderForModification();

		// Log that this logical operation starts
		tx.recoveryMgr().logLogicalStart();

		// Mark the specified slot as in used
		moveToRecordId(rid);
		if (!rp.insertIntoTheCurrentSlot())
			throw new RuntimeException("the specified slot: " + rid + " is in used");

		// Traverse the free chain to find the specified slot
		RecordId lastSlot = null;
		RecordId currentSlot = fhp.getLastDeletedSlot();
		while (!currentSlot.equals(rid) && currentSlot.block().number() != FileHeaderPage.NO_SLOT_BLOCKID) {
			moveToRecordId(currentSlot);
			lastSlot = currentSlot;
			currentSlot = rp.getNextDeletedSlotId();
		}

		// Remove the specified slot from the chain
		// If it is the first slot
		if (lastSlot == null) {
			moveToRecordId(currentSlot);
			fhp.setLastDeletedSlot(rp.getNextDeletedSlotId());

			// If it is in the middle
		} else if (currentSlot.block().number() != FileHeaderPage.NO_SLOT_BLOCKID) {
			moveToRecordId(currentSlot);
			RecordId nextSlot = rp.getNextDeletedSlotId();
			moveToRecordId(lastSlot);
			rp.setNextDeletedSlotId(nextSlot);
		}

		// Log that this logical operation ends
		tx.recoveryMgr().logRecordFileInsertionEnd(ti.tableName(), rid.block().number(), rid.id());

		// Close the header (release the header lock)
		closeHeader();
	}
205353
public static base_response delete(nitro_service client, String ipfrom) throws Exception {
		location deleteresource = new location();
		deleteresource.ipfrom = ipfrom;
		return deleteresource.delete_resource(client);
	}
446093
@Override
  public void remove( int offset, int length ) throws BadLocationException
  {
    super.remove( offset, length );
    processChangedLines( offset, 0 );
  }
179750
public long popLastEntryPosition() throws IOException {
    // BROWSE IN ASCENDING ORDER UNTIL A GOOD POSITION IS FOUND (!=-1)
    for (int pos = getHoles() - 1; pos >= 0; --pos) {
      final long recycledPosition = file.readLong(pos * RECORD_SIZE);

      if (recycledPosition > -1) {
        if (OLogManager.instance().isDebugEnabled())
          OLogManager.instance().debug(this, "Recycled hole %s/#%d -> #%d:%d", owner.getName(), pos, owner.getId(),
              recycledPosition);

        // SHRINK THE FILE
        file.removeTail((getHoles() - pos) * RECORD_SIZE);

        return recycledPosition;
      }
    }

    return -1;
  }
376310
@Indexable(type = IndexableType.DELETE)
	@Override
	public CPAttachmentFileEntry deleteCPAttachmentFileEntry(
		CPAttachmentFileEntry cpAttachmentFileEntry) throws PortalException {
		return cpAttachmentFileEntryPersistence.remove(cpAttachmentFileEntry);
	}
1203480
@Override
    public IAtomContainer remove(int i) {
        IAtomContainer oldAtomContainer = get(i);
        coordinates.remove(i);
        return oldAtomContainer;
    }
174922
public FieldList move(int iRelPosition) throws DBException
    {
        this.setCurrentRecord(this.getBaseRecord());
        boolean bAfterRequery = !this.getBaseRecord().isOpen();
        if (!this.isOpen())
            this.open();    // Make sure any listeners are called before disabling.
        Object[] rgobjEnabledFields = this.getBaseRecord().setEnableNonFilter(null, false, false, false, false, true);
        try {
            Record record = (Record)super.move(iRelPosition);
            if (record == null)
                return null;

            this.getBaseRecord().setEnableNonFilter(rgobjEnabledFields, true, false, bAfterRequery, false, true);
            rgobjEnabledFields = null;
            
      //      this.getBaseRecord().handleValidRecord(); // Display Fields (handleValidRecord this was done in setEnableNonFilter)
            record = this.moveToCurrentRecord(record);
            if (record != null) if (record != this.getBaseRecord())
                record.handleValidRecord(); // Display Fields

            return record;
        } catch (DBException ex)    {
            throw ex;
        } finally {
            if (rgobjEnabledFields != null)
                this.getBaseRecord().setEnableNonFilter(rgobjEnabledFields, false, false, bAfterRequery, true, true);   // EOF
        }
    }
1002929
public CmsClientSitemapEntry removeSubEntry(int position) {

        CmsClientSitemapEntry removed = m_subEntries.remove(position);
        updatePositions(position);
        return removed;
    }
1345599
private boolean remove(HashtableEntry entry)
                    throws IOException,
                    EOFException,
                    FileManagerException,
                    ClassNotFoundException,
                    HashtableOnDiskException {
        if (entry == null) {
            throw (new HashtableOnDiskException("remove: Internal error, null entry."));
        }

        removes++;
        //
        // First unchain from hashtable
        //
        if (entry.location == getHtindex(entry.index, entry.tableid)) { // first in chain
            writeHashIndex(entry.index, entry.next, entry.tableid);
        } else { // not first in chain
            updatePointer(entry.previous, entry.next);
        }

        //
        // Now delete data
        //
        header.decrementObjectCount();
        filemgr.deallocate(entry.location); // deallocate from disk
        filemgr.flush();

        return true;
    }
1163494
protected void validatePosition(long position) throws IOException {
    if (position < 0) {
      throw new EOFException(
          String.format(
              "Invalid seek offset: position value (%d) must be >= 0 for '%s'",
              position, resourceIdString));
    }

    if (size >= 0 && position >= size) {
      throw new EOFException(
          String.format(
              "Invalid seek offset: position value (%d) must be between 0 and %d for '%s'",
              position, size, resourceIdString));
    }
  }
242255
public void insertOrReplaceRecord(T record, T tempHolder) throws IOException {
		final int searchHashCode = hash(this.buildSideComparator.hash(record));
		final int posHashCode = searchHashCode % this.numBuckets;
		
		// get the bucket for the given hash code
		MemorySegment originalBucket = this.buckets[posHashCode >> this.bucketsPerSegmentBits];
		int originalBucketOffset = (posHashCode & this.bucketsPerSegmentMask) << NUM_INTRA_BUCKET_BITS;
		MemorySegment bucket = originalBucket;
		int bucketInSegmentOffset = originalBucketOffset;
		
		// get the basic characteristics of the bucket
		final int partitionNumber = bucket.get(bucketInSegmentOffset + HEADER_PARTITION_OFFSET);
		final InMemoryPartition<T> partition = this.partitions.get(partitionNumber);
		final MemorySegment[] overflowSegments = partition.overflowSegments;
		
		this.buildSideComparator.setReference(record);
		
		int countInSegment = bucket.getInt(bucketInSegmentOffset + HEADER_COUNT_OFFSET);
		int numInSegment = 0;
		int posInSegment = bucketInSegmentOffset + BUCKET_HEADER_LENGTH;
		
		long currentForwardPointer = BUCKET_FORWARD_POINTER_NOT_SET;

		// loop over all segments that are involved in the bucket (original bucket plus overflow buckets)
		while (true) {
			
			while (numInSegment < countInSegment) {
				
				final int thisCode = bucket.getInt(posInSegment);
				posInSegment += HASH_CODE_LEN;
					
				// check if the hash code matches
				if (thisCode == searchHashCode) {
					// get the pointer to the pair
					final int pointerOffset = bucketInSegmentOffset + BUCKET_POINTER_START_OFFSET + (numInSegment * POINTER_LEN);
					final long pointer = bucket.getLong(pointerOffset);
					numInSegment++;
					
					// deserialize the key to check whether it is really equal, or whether we had only a hash collision
					try {
						partition.readRecordAt(pointer, tempHolder);
						if (this.buildSideComparator.equalToReference(tempHolder)) {
							long newPointer = partition.appendRecord(record);
							bucket.putLong(pointerOffset, newPointer);
							partition.setCompaction(false);
							if((newPointer >> this.pageSizeInBits) > this.compactionMemory.getBlockCount()) {
								this.compactionMemory.allocateSegments((int)(newPointer >> this.pageSizeInBits));
							}
							return;
						}
					} catch (EOFException e) {
						// system is out of memory so we attempt to reclaim memory with a copy compact run
						long newPointer;
						try {
							compactPartition(partition.getPartitionNumber());
							// retry append
							newPointer = this.partitions.get(partitionNumber).appendRecord(record);
						} catch (EOFException ex) {
							throw new RuntimeException("Memory ran out. Compaction failed. numPartitions: " + this.partitions.size() + 
									" minPartition: " + getMinPartition() +
									" maxPartition: " + getMaxPartition() +
									" bucketSize: " + this.buckets.length +
									" Message: " + ex.getMessage());
						} catch (IndexOutOfBoundsException ex) {
							throw new RuntimeException("Memory ran out. Compaction failed. numPartitions: " + this.partitions.size() + 
									" minPartition: " + getMinPartition() +
									" maxPartition: " + getMaxPartition() +
									" bucketSize: " + this.buckets.length +
									" Message: " + ex.getMessage());
						}
						bucket.putLong(pointerOffset, newPointer);
						return;
					} catch (IndexOutOfBoundsException e) {
						// system is out of memory so we attempt to reclaim memory with a copy compact run
						long newPointer;
						try {
							compactPartition(partition.getPartitionNumber());
							// retry append
							newPointer = this.partitions.get(partitionNumber).appendRecord(record);
						} catch (EOFException ex) {
							throw new RuntimeException("Memory ran out. Compaction failed. numPartitions: " + this.partitions.size() + 
									" minPartition: " + getMinPartition() +
									" maxPartition: " + getMaxPartition() +
									" bucketSize: " + this.buckets.length +
									" Message: " + ex.getMessage());
						} catch (IndexOutOfBoundsException ex) {
							throw new RuntimeException("Memory ran out. Compaction failed. numPartitions: " + this.partitions.size() + 
									" minPartition: " + getMinPartition() +
									" maxPartition: " + getMaxPartition() +
									" bucketSize: " + this.buckets.length +
									" Message: " + ex.getMessage());
						}
						bucket.putLong(pointerOffset, newPointer);
						return;
					} catch (IOException e) {
						throw new RuntimeException("Error deserializing record from the hashtable: " + e.getMessage(), e);
					} 
				}
				else {
					numInSegment++;
				}
			}
			
			// this segment is done. check if there is another chained bucket
			long newForwardPointer = bucket.getLong(bucketInSegmentOffset + HEADER_FORWARD_OFFSET);
			if (newForwardPointer == BUCKET_FORWARD_POINTER_NOT_SET) {
				// nothing found. append and insert
				long pointer = partition.appendRecord(record);
				insertBucketEntryFromSearch(partition, originalBucket, bucket, originalBucketOffset, bucketInSegmentOffset, countInSegment, currentForwardPointer, searchHashCode, pointer);
				if((pointer >> this.pageSizeInBits) > this.compactionMemory.getBlockCount()) {
					this.compactionMemory.allocateSegments((int)(pointer >> this.pageSizeInBits));
				}
				return;
			}
			
			final int overflowSegNum = (int) (newForwardPointer >>> 32);
			bucket = overflowSegments[overflowSegNum];
			bucketInSegmentOffset = (int) (newForwardPointer & 0xffffffff);
			countInSegment = bucket.getInt(bucketInSegmentOffset + HEADER_COUNT_OFFSET);
			posInSegment = bucketInSegmentOffset + BUCKET_HEADER_LENGTH;
			numInSegment = 0;
			currentForwardPointer = newForwardPointer;
		}
	}
629673
function( cb ){
              if( ! self.positionField ){
                cb( null );
              } else {

                // If repositioning is required, do it
                if( self.positionField ){
                  var where, beforeId;
                  if( ! options.position ){
                    where = 'end';
                  } else {
                    where = options.position.where;
                    beforeId = options.position.beforeId;
                  }
                  self.reposition( recordWithLookups, where, beforeId, cb );
                }
              }
            }
1295391
public synchronized XEvent remove(int index)
			throws IndexOutOfBoundsException, IOException {
		// check overflow list and adjust indices
		XEvent removed = null;
		int smallerOverflow = 0;
		for (int i = 0; i < overflowSize; i++) {
			if (overflowIndices[i] == index) {
				removed = overflowEntries[i];
			} else if (overflowIndices[i] > index) {
				overflowIndices[i] = overflowIndices[i] - 1;
				if (removed != null) {
					// move left
					overflowIndices[i - 1] = overflowIndices[i];
					overflowEntries[i - 1] = overflowEntries[i];
				}
			} else if (overflowIndices[i] < index) {
				smallerOverflow++;
			}
		}
		if (removed != null) {
			// adjust overflow size
			overflowSize--;
			// invalidate entry in overflow set
			overflowIndices[overflowSize] = -1;
			overflowEntries[overflowSize] = null;
		} else {
			int bufferIndex = index - smallerOverflow;
			for (int hole = holeFlags.nextSetBit(0); hole >= 0
					&& hole <= bufferIndex; hole = holeFlags
					.nextSetBit(hole + 1)) {
				bufferIndex++;
			}
			removed = buffer.get(bufferIndex);
			holeFlags.set(bufferIndex, true);
		}
		size--;
		return removed;
	}
575139
private void deallocate(HashtableEntry entry)
                    throws IOException,
                    EOFException,
                    FileManagerException,
                    ClassNotFoundException,
                    HashtableOnDiskException {
        if (entry.location == 0) {
            throw (new HashtableOnDiskException("deallocate:  space not allocated."));
        }

        filemgr.deallocate(entry.location);
        entry.location = 0;
    }
323641
public void removeItemByPosition(int position) {
        if (mDrawerBuilder.checkDrawerItem(position, false)) {
            mDrawerBuilder.getItemAdapter().remove(position);
        }
    }
259545
@Override
	public void delete(SearchKey key, RecordId dataRecordId, boolean doLogicalLogging) {
		// search the position
		beforeFirst(new SearchRange(key));
		
		// log the logical operation starts
		if (doLogicalLogging)
			tx.recoveryMgr().logLogicalStart();
		
		// delete the specified entry
		while (next())
			if (getDataRecordId().equals(dataRecordId)) {
				rf.delete();
				return;
			}
		
		// log the logical operation ends
		if (doLogicalLogging)
			tx.recoveryMgr().logIndexDeletionEnd(ii.indexName(), key,
					dataRecordId.block().number(), dataRecordId.id());
	}