Class that act as stacks, queues, and priority queues. See iDynamicArray_Class for more information on how to use this class.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=i32), | public | :: | N | Current size of the array |
|||
integer(kind=i32), | public, | allocatable | :: | values(:) | Memory for values, can be larger than N |
||
logical, | public | :: | sorted | = | .false. | Keep track of whether the array is sorted for potential speed increases |
|
logical, | public | :: | fixed | = | .false. | Don't allow the memory to change after initial instantiation. |
Overloaded by interface iDynamicArray()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=i32), | intent(in), | optional | :: | M | Amount of memory to allocate. |
|
logical, | intent(in), | optional | :: | sorted | Maintain a sorted array. |
|
logical, | intent(in), | optional | :: | fixed | Maintain a fixed size array. |
Return type.
Overloaded by interface iDynamicArray()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=i32), | intent(in) | :: | values(:) | Set of values to initialize with. |
||
integer(kind=i32), | intent(in), | optional | :: | M | Amount of memory to allocate. |
|
logical, | intent(in), | optional | :: | sorted | Maintain a sorted array. |
|
logical, | intent(in), | optional | :: | fixed | Maintain a fixed size array. |
Return type
iDynamicArray%append() - Append a value to the end of the dynamic array. Will change a sorted dynamic array to unsorted.
Overloaded type bound procedure iDynamicArray%append()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(iDynamicArray) | :: | this | ||||
integer(kind=i32) | :: | val | Value to append. |
iDynamicArray%deallocate() - Deallocate a dynamic array.
Overloaded type bound procedure iDynamicArray%deallocate()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(iDynamicArray) | :: | this |
iDynamicArray%insertAt() - Insert a value at a given index.
Private insert into array without checking for sorted flag.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(iDynamicArray) | :: | this | ||||
integer(kind=i32) | :: | i | Insert value at this location. |
|||
integer(kind=i32) | :: | val | Insert this value. |
iDynamicArray%insertSorted() - Insert a value into a sorted dynamic array.
Overloaded type bound procedure iDynamicArray%insertSorted()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(iDynamicArray) | :: | this | ||||
integer(kind=i32) | :: | val | Insert this value. |
iDynamicArray%insertSortedUnique() - Inserts only unique numbers into a dynamic array.
Overloaded type bound procedure iDynamicArray%insertSortedUnique()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(iDynamicArray) | :: | this | ||||
integer(kind=i32) | :: | val | Insert this value. |
iDynamicArray%isEmpty() - True if the array is empty.
Overloaded type bound procedure iDynamicArray%isEmpty()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(iDynamicArray) | :: | this |
Array is empty
iDynamicArray%isFilled() - True if the array is filled.
Overloaded type bound procedure iDynamicArray%isFilled()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(iDynamicArray) | :: | this |
Array is filled
iDynamicArray%locationOf() - Get the location of a value in a sorted dynamic array.
Overloaded type bound procedure iDynamicArray%locationOf().
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(iDynamicArray) | :: | this | ||||
integer(kind=i32) | :: | val | Get the location of this value |
Location of value
iDynamicArray%prepend() - Prepend a value to the start of the dynamic array. Only for unsorted dynamic arrays
Overloaded type bound procedure iDynamicArray%prepend()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(iDynamicArray) | :: | this | ||||
integer(kind=i32) | :: | val | Value to prepend. |
iDynamicArray%reallocate() - Create new contiguous memory to match the needs of the expanding or shrinking array.
Overloaded type bound procedure iDynamicArray%reallocate().
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(iDynamicArray) | :: | this | ||||
integer(kind=i32) | :: | M | Reallocate memory to this size. |
iDynamicArray%remove() - Remove an element from the array.
Overloaded type bound procedure iDynamicArray%remove().
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(iDynamicArray) | :: | this | ||||
integer(kind=i32) | :: | i | Remove the value at this location. |
iDynamicArray%tighten() - Removes excess buffer memory and trims it to the current length.
Overloaded type bound procedure iDynamicArray%tighten().
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(iDynamicArray) | :: | this |