aot_path_delNode Subroutine

public subroutine aot_path_delNode(me, isEmpty)

The delNode removes the last node from the list of nodes of the given path.

With the optional isEmpty argument, it can be tested, if the list is completely empty after this operation.

Arguments

Type IntentOptional Attributes Name
type(aot_path_type), intent(inout) :: me

Path to delet the last node from

logical, intent(out), optional :: isEmpty

Flag, if resulting path is empty (contains no nodes anymore)


Called by

proc~~aot_path_delnode~~CalledByGraph proc~aot_path_delnode aot_path_delNode proc~aot_fin_path aot_fin_path proc~aot_fin_path->proc~aot_path_delnode proc~aot_init_path aot_init_path proc~aot_init_path->proc~aot_fin_path proc~aot_path_copy aot_path_copy proc~aot_path_copy->proc~aot_fin_path interface~assignment(=) assignment(=) interface~assignment(=)->proc~aot_path_copy

Source Code

  subroutine aot_path_delNode(me, isEmpty)
    !> Path to delet the last node from
    type(aot_path_type), intent(inout) :: me
    !> Flag, if resulting path is empty (contains no nodes anymore)
    logical, intent(out), optional :: isEmpty

    type(aot_path_node_type), pointer :: curNode => NULL()
    logical :: emptyList

    emptyList = .true.

    if (associated(me%GlobalNode)) then
      curNode => me%GlobalNode

      do
        if (associated(curNode%child)) then
          if (associated(curNode%child, me%head)) then
            ! Found second Last Node (its child is the head)
            nullify(curNode%child)
            deallocate(me%head)
            me%head => curNode
            ! The list is not empty, there is at least one
            ! node remaining.
            emptyList = .false.
            ! Leave the loop
            exit
          end if
        else
          ! There is just the global node, no childs yet
          nullify(me%globalNode)
          deallocate(me%head)
          ! Leave the loop
          exit
        end if
        curNode => curNode%child
      end do

    end if

    if (present(isEmpty)) then
      isEmpty = emptyList
    end if

  end subroutine aot_path_delNode