row_t Derived Type

type, public :: row_t

Linked list for a given row index, contains the column values


Contents


Components

TypeVisibilityAttributesNameInitial
integer, public :: nb_elements

number of elements in linked list

type(node_t), public, pointer:: head

pointer to head (first element added)

type(node_t), public, pointer:: tail

pointer to tail (last element added)


Type-Bound Procedures

procedure, public :: add_node

  • private subroutine add_node(this, column, element)

    Adds a new node to the linked list with a given column index and value.

    Arguments

    TypeIntentOptionalAttributesName
    class(row_t), intent(inout) :: this

    type instance

    integer, intent(in) :: column

    column position of the element

    class(*), intent(in) :: element

    the element to be added

procedure, public :: get_node

  • private function get_node(this, column) result(node)

    Returns a pointer to the node corresponding to the given column. Returns a nullified pointer if no node containing the given column index was found.

    Arguments

    TypeIntentOptionalAttributesName
    class(row_t), intent(in) :: this

    type instance

    integer, intent(in) :: column

    column index

    Return Value type(node_t),pointer

    the node with a column value that matches column

procedure, public :: delete_row

  • private pure subroutine delete_row(this)

    Deletes a given linked list row by recursively iterating over all nodes. Nullifies the pointers and deallocates the elements.

    Arguments

    TypeIntentOptionalAttributesName
    class(row_t), intent(inout) :: this

    type instance

procedure, public :: delete_node_from_row

  • private subroutine delete_node_from_row(this, column)

    Deletes a given node from the current row.

    Arguments

    TypeIntentOptionalAttributesName
    class(row_t), intent(inout) :: this

    type instance

    integer, intent(in) :: column

    column index of node to be deleted

procedure, private :: create_first_node

  • private pure subroutine create_first_node(this, column, element)

    Subroutine to add the first node to the linked list. Allocates a new node and sets both the head and tail to this node.

    Arguments

    TypeIntentOptionalAttributesName
    class(row_t), intent(inout) :: this

    type instance

    integer, intent(in) :: column

    column position of element

    class(*), intent(in) :: element

    the element to be added

procedure, private :: append_node

  • private subroutine append_node(this, column, element)

    Subroutine to append a new node to an already existing list of nodes. A new node is created, appended, and the tail is updated.

    Arguments

    TypeIntentOptionalAttributesName
    class(row_t), intent(inout) :: this

    type instance

    integer, intent(in) :: column

    column position of element

    class(*), intent(in) :: element

    the element to be added