MONC
Private Member Functions | List of all members
collections_mod::c_contains Interface Reference

Determines whether or not a map contains a specific key. More...

Private Member Functions

logical function map_contains_key (specificmap, key)
 Determines whether or not a map contains a specific key. More...
 
logical function hashmap_contains_key (specificmap, key)
 Determines whether or not a hashmap contains a specific key. More...
 
logical function hashset_contains (specificset, key)
 Determines wheter the hashset contains a specific key or not. More...
 

Detailed Description

Determines whether or not a map contains a specific key.

This has a time complexity of O(n)

Parameters
collectionThe specific map involved
keyThe key we are looking up
Returns
Whether the map contains the key

Definition at line 447 of file collections.F90.

Member Function/Subroutine Documentation

◆ hashmap_contains_key()

logical function collections_mod::c_contains::hashmap_contains_key ( type(hashmap_type), intent(inout)  specificmap,
character(len=*), intent(in)  key 
)
private

Determines whether or not a hashmap contains a specific key.

Do not call directly from external module, this is called via the appropriate interface

Parameters
specificmapThe specific map involved
keyThe key we are looking up
Returns
Whether the map contains the key

Definition at line 1404 of file collections.F90.

1404  type(hashmap_type), intent(inout) :: specificmap
1405  character(len=*), intent(in) :: key
1406 
1407  class(*), pointer :: raw_map_node
1408 
1409  raw_map_node=>hashmap_getnode(specificmap, key)
1410  hashmap_contains_key=associated(raw_map_node)

◆ hashset_contains()

logical function collections_mod::c_contains::hashset_contains ( type(hashset_type), intent(inout)  specificset,
character(len=*), intent(in)  key 
)
private

Determines wheter the hashset contains a specific key or not.

Parameters
specificsetThe specific set involved
keyThe string key to test for
Returns
Whether the hashset contains this key or not

Definition at line 2006 of file collections.F90.

2006  type(hashset_type), intent(inout) :: specificset
2007  character(len=*), intent(in) :: key
2008 
2009  integer :: hash, key_location
2010 
2011  call hashset_getlocation(specificset, key, hash, key_location)
2012  hashset_contains= (hash .gt. 0 .and. key_location .gt. 0)

◆ map_contains_key()

logical function collections_mod::c_contains::map_contains_key ( type(map_type), intent(inout)  specificmap,
character(len=*), intent(in)  key 
)
private

Determines whether or not a map contains a specific key.

Do not call directly from external module, this is called via the appropriate interface

Parameters
specificmapThe specific map involved
keyThe key we are looking up
Returns
Whether the map contains the key

Definition at line 762 of file collections.F90.

762  type(map_type), intent(inout) :: specificmap
763  character(len=*), intent(in) :: key
764 
765  integer :: key_location
766  class(*), pointer :: raw_map_node
767 
768  raw_map_node => map_getnode(specificmap, key, key_location)
769  map_contains_key = key_location .gt. 0

The documentation for this interface was generated from the following file: