Remove a node from the hash table, given the key.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
||
class(*), | intent(in) | :: | key | The key. |
subroutine remove(self, key)
!---------------------------------------------------------------------------------------------------------------------------------
!< Remove a node from the hash table, given the key.
!---------------------------------------------------------------------------------------------------------------------------------
class(hash_table), intent(inout) :: self !< The hash table.
class(*), intent(in) :: key !< The key.
integer(I4P) :: b !< Bucket index, namely hashed key.
integer(I4P) :: i !< Image index.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
if (self%is_initialized_) then
call self%get_bucket_image_indexes(key=key, bucket=b, image=i)
if (b>0.and.i==self%me) then
call self%bucket(b)%remove(key=key)
self%nodes_number_ = self%nodes_number_ - 1
self%ids_(1:2, b) = self%bucket(b)%ids()
endif
endif
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine remove