Removes a specific element from the list or map.
More...
|
subroutine | list_remove (specificlist, i) |
| Removes an element from the list at a specific index. More...
|
|
subroutine | map_remove (specificmap, key) |
| Removes a specific key-value pair from the map. More...
|
|
subroutine | hashmap_remove (specificmap, key) |
| Removes a specific key-value pair from the hashmap. More...
|
|
subroutine | hashset_remove (specificset, key) |
| Removes a string from the hashset. More...
|
|
Removes a specific element from the list or map.
This has a time complexity of O(n)
- Parameters
-
collection | The specific list or map involved |
identifier | In the cast of a list the index to remove or for a map the key (of the key-value pair) to remove |
Definition at line 419 of file collections.F90.
◆ hashmap_remove()
subroutine collections_mod::c_remove::hashmap_remove |
( |
type(hashmap_type), intent(inout) |
specificmap, |
|
|
character(len=*), intent(in) |
key |
|
) |
| |
|
private |
Removes a specific key-value pair from the hashmap.
Do not call directly from external module, this is called via the appropriate interface
- Parameters
-
specificmap | The specific hashmap involved |
key | Key of the key-value pair to remove from the map |
Definition at line 1667 of file collections.F90.
1668 type(hashmap_type),
intent(inout) :: specificmap
1669 character(len=*),
intent(in) :: key
1671 integer :: key_location
1672 class(*),
pointer :: raw_map_node
1674 raw_map_node=>hashmap_getnode(specificmap, key, key_location)
1676 if (key_location .gt. 0)
then
1677 select type (raw_map_node)
1678 type is (mapnode_type)
1679 if (raw_map_node%memory_allocation_automatic)
then
1680 if (
associated(raw_map_node%value))
deallocate(raw_map_node%value)
1682 deallocate(raw_map_node)
1684 call list_remove(specificmap%map_ds(get_hashkey(key)), key_location)
1685 specificmap%size=specificmap%size-1
◆ hashset_remove()
subroutine collections_mod::c_remove::hashset_remove |
( |
type(hashset_type), intent(inout) |
specificset, |
|
|
character(len=*), intent(in) |
key |
|
) |
| |
|
private |
Removes a string from the hashset.
Do not call directly from external module, this is called via the appropriate interface
- Parameters
-
specificset | The specific ste involved |
key | The string key to remove |
Definition at line 1987 of file collections.F90.
1988 type(hashset_type),
intent(inout) :: specificset
1989 character(len=*),
intent(in) :: key
1991 integer :: location, hash
1993 call hashset_getlocation(specificset, key, hash, location)
1994 if (hash .gt. 0 .and. location .gt. 0)
then
1995 call list_remove(specificset%set_ds(hash), location)
1996 specificset%size=specificset%size-1
◆ list_remove()
subroutine collections_mod::c_remove::list_remove |
( |
type(list_type), intent(inout) |
specificlist, |
|
|
integer, intent(in) |
i |
|
) |
| |
|
private |
Removes an element from the list at a specific index.
Do not call directly from external module, this is called via the appropriate interface
- Parameters
-
specificlist | The specific list involved |
i | Index to remove from |
Definition at line 2992 of file collections.F90.
2993 type(list_type),
intent(inout) :: specificlist
2994 integer,
intent(in) :: i
2997 type(listnode_type),
pointer :: node
3000 if (i .le. specificlist%size)
then
3001 node => specificlist%head
3003 if (.not.
associated(node))
exit
3007 if (
associated(node))
then
3008 if (
associated(node%prev)) node%prev%next => node%next
3009 if (
associated(node%next)) node%next%prev => node%prev
3010 if (
associated(node,
target=specificlist%head)) specificlist%head => node%next
3011 if (
associated(node,
target=specificlist%tail)) specificlist%tail => node%prev
3012 if (node%memory_allocation_automatic)
then
3013 if (
associated(node%data))
deallocate(node%data)
3016 specificlist%size = specificlist%size - 1
◆ map_remove()
subroutine collections_mod::c_remove::map_remove |
( |
type(map_type), intent(inout) |
specificmap, |
|
|
character(len=*), intent(in) |
key |
|
) |
| |
|
private |
Removes a specific key-value pair from the map.
Do not call directly from external module, this is called via the appropriate interface
- Parameters
-
specificmap | The specific map involved |
key | Key of the key-value pair to remove from the map |
Definition at line 1030 of file collections.F90.
1031 type(map_type),
intent(inout) :: specificmap
1032 character(len=*),
intent(in) :: key
1034 integer :: key_location
1035 class(*),
pointer :: raw_map_node
1037 raw_map_node=>map_getnode(specificmap, key, key_location)
1039 if (key_location .gt. 0)
then
1040 select type (raw_map_node)
1041 type is (mapnode_type)
1042 if (raw_map_node%memory_allocation_automatic)
then
1043 if (
associated(raw_map_node%value))
deallocate(raw_map_node%value)
1045 deallocate(raw_map_node)
1047 call list_remove(specificmap%map_ds, key_location)
The documentation for this interface was generated from the following file: