multiset Derived Type

type, public, abstract, extends(dynamic_set) :: multiset

type~~multiset~~InheritsGraph type~multiset multiset type~dynamic_set dynamic_set type~dynamic_set->type~multiset type~data_set data_set type~data_set->type~dynamic_set type~countable countable type~countable->type~data_set type~iterable iterable type~iterable->type~countable
Help


Provides an abstract type for a multi-set data structure. These behave like a normal set, except they keep count of the number of times which an item has been added. When an item is removed, the count will be decremented by 1. The item will only become absent from the list (has returns .false.) when the count reaches zero.


Type-Bound Procedures

procedure(get_func), public, deferred :: get

Returns the number of times this item is present in the set.

  • pure function get_func(this, item) Prototype

    Arguments

    Type IntentOptional AttributesName
    class(multiset), intent(in) :: this
    class(*), intent(in) :: item

    The item whose presence in the set is being checked

    Return Value integer

    The number of times this item appears in the set

Source Code

  type, public, extends(dynamic_set), abstract :: multiset
    !* Author: Chris MacMackin
    !  Date: March 2016
    !  License: LGPLv3
    !
    ! Provides an abstract type for a multi-set data structure. These 
    ! behave like a normal set, except they keep count of the number of
    ! times which an item has been added. When an item is removed, the
    ! count will be decremented by 1. The item will only become absent
    ! from the list ([[data_set:has]] returns `.false.`) when the count
    ! reaches zero.
    !
  contains
    procedure(get_func), deferred :: get
      !! Returns the number of times this item is present in the set.
  end type multiset