An abstract type for set data structures. These sets support a similar selection of operations as do their mathematical counterparts. The collection of methods for this type waas inspired by those available for the frozenset type in Python.
Returns a set containing the items held in this set and the passed set.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
A set containing all elements found in this one and the other
Returns the union of the two sets
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
A set containing all elements found in this one and the other
Returns a set containing only the items present in both this set and the argument
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
Returns a set containing the item present in this set but not present in the argument
Returns the difference between the two sets
Returns a set containing those items present either only in this set or only in the argument
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
A set containing elements found in one, but not both, of this set or the other set
True if none of the items in this set are present in the argument
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
Whether the relationship between this
and other
is true
True if every element in this set is also in the argument
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
Whether the relationship between this
and other
is true
True if every element in this set is also in the argument and this set is not equal to the argument
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
Whether the relationship between this
and other
is true
True if every element in the argument is also present in this set.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
Whether the relationship between this
and other
is true
True if every element in the argument is also present in this set and the argument is not equal to this set.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
Whether the relationship between this
and other
is true
True if this set and the argument contain only the same items.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
Whether the relationship between this
and other
is true
True if every element in this set is also in the argument
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
Whether the relationship between this
and other
is true
True if every element in this set is also in the argument and this set is not equal to the argument
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
Whether the relationship between this
and other
is true
True if every element in the argument is also present in this set.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
Whether the relationship between this
and other
is true
True if every element in the argument is also present in this set and the argument is not equal to this set.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
Whether the relationship between this
and other
is true
True if this set and the argument contain only the same items.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(data_set), | intent(in) | :: | other | A second set |
Whether the relationship between this
and other
is true
True if the argument is present in the set
True if the set contains no items
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this |
.true.
if this set contains no items
Returns an item, at random, from the set
Returns a set containing all elements from this set for which
the provided test procedure returns .true.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
procedure(test_func) | :: | test | A test for which the values that pass will be returned in a new list |
Contains those items in this set for which test
returns
.true.
Returns an [array_list] containing all of the items present in this set.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this |
A list containing copies of all of the items in this set
Returns the smallest item in the set as determined using the provided comparison procedure
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
procedure(comparison_func) | :: | comparison | A procedure which evaluates whether a container object is less than, equal to, or greater than another |
The smallest item in the set, as determined by the
comparison
function
Returns the largest item in the set as determined using the provided comparison procedure
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
procedure(comparison_func) | :: | comparison | A procedure which evaluates whether a container object is less than, equal to, or greater than another |
The largest item in the set, as determined by the
comparison
function
Returns the item in the set for which the provided subtraction procedure returns the smallest absolute value
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
class(*), | intent(in) | :: | item | The value which those in the set are being compared to |
||
procedure(subtraction_func) | :: | subtraction | A function determining the magnitude of the difference between two items |
The value from the set which, when passed to subtraction
with item
as the other argument, returns the smallest value
Returns an item representing the sum as determined by iteratively applying the provided addition procedure to all items in the set
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(data_set), | intent(in) | :: | this | |||
procedure(addition_func) | :: | addition | A procedure performing addition between two container objects and returning the result in another container |
A container holding the sum of all of the items held within this set
type, public, extends(countable), abstract :: data_set
!* Author: Chris MacMackin
! Date: March 2016
!
! An abstract type for set data structures. These sets support a
! similar selection of operations as do their mathematical
! counterparts. The collection of methods for this type waas inspired
! by those available for the
! [frozenset](https://docs.python.org/2/library/stdtypes.html#frozenset)
! type in Python.
!
contains
procedure(union_func), deferred :: union
!! Returns a set containing the items held in this set and the
!! passed set.
generic :: operator(+) => union
!! Returns the union of the two sets
procedure(intersect_func), deferred :: intersection
!! Returns a set containing only the items present in both this
!! set and the argument
procedure(diff_func), deferred :: difference
!! Returns a set containing the item present in this set but not
!! present in the argument
generic :: operator(-) => difference
!! Returns the difference between the two sets
procedure(pure_diff_func), deferred :: symmetric_difference
!! Returns a set containing those items present either only in
!! this set or only in the argument
procedure(relation_func), deferred :: is_disjoint
!! True if none of the items in this set are present in the
!! argument
procedure(relation_func), deferred :: is_subset
!! True if every element in this set is also in the argument
procedure(relation_func), deferred :: is_proper_subset
!! True if every element in this set is also in the argument and
!! this set is not equal to the argument
procedure(relation_func), deferred :: is_superset
!! True if every element in the argument is also present in this
!! set.
procedure(relation_func), deferred :: is_proper_superset
!! True if every element in the argument is also present in this
!! set and the argument is not equal to this set.
procedure(relation_func), deferred :: is_equal
!! True if this set and the argument contain only the same items.
generic :: operator(<=) => is_subset
!! True if every element in this set is also in the argument
generic :: operator(<) => is_proper_subset
!! True if every element in this set is also in the argument and
!! this set is not equal to the argument
generic :: operator(>=) => is_superset
!! True if every element in the argument is also present in this
!! set.
generic :: operator(>) => is_proper_superset
!! True if every element in the argument is also present in this
!! set and the argument is not equal to this set.
generic :: operator(==) => is_equal
!! True if this set and the argument contain only the same items.
procedure(has_func), deferred :: has
!! True if the argument is present in the set
procedure(empty_func), deferred :: is_empty
!! True if the set contains no items
procedure(peek_func), deferred :: peek
!! Returns an item, at random, from the set
procedure(filter_func), deferred :: filter
!! Returns a set containing all elements from this set for which
!! the provided test procedure returns `.true.`
procedure(enum_func), deferred :: enumerate
!! Returns an [array_list] containing all of the items present
!! in this set.
procedure(min_func), deferred :: min
!! Returns the smallest item in the set as determined using the
!! provided comparison procedure
procedure(max_func), deferred :: max
!! Returns the largest item in the set as determined using the
!! provided comparison procedure
procedure(nearest_func), deferred :: nearest
!! Returns the item in the set for which the provided subtraction
!! procedure returns the smallest absolute value
procedure(sum_func), deferred :: sum
!! Returns an item representing the sum as determined by
!! iteratively applying the provided addition procedure to all
!! items in the set
end type data_set