Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

44 lines
1.1 KiB

  1. # 1 "/home/admin/SimulationCore2/CSharp/Equipments/MudPathFinding/CStack.f90"
  2. module CStack
  3. use CPath,Only:Path
  4. implicit none
  5. public
  6. type, public :: Stack
  7. type(Path) :: List
  8. contains
  9. procedure :: Clear => Clear
  10. procedure :: Push => Push
  11. procedure :: Pop => Pop
  12. procedure :: DoesHave => DoesHave
  13. end type Stack
  14. contains
  15. subroutine Clear(this)
  16. implicit none
  17. class(Stack), intent(inout) :: this
  18. call this%List%MakeNull()
  19. end subroutine
  20. subroutine Push(this, value)
  21. implicit none
  22. class(Stack), intent(inout) :: this
  23. integer, intent(in) :: value
  24. call this%List%Add(value)
  25. end subroutine
  26. subroutine Pop(this)
  27. implicit none
  28. class(Stack), intent(inout) :: this
  29. call this%List%Remove(this%List%Length())
  30. end subroutine
  31. logical function DoesHave(this, value)
  32. implicit none
  33. class(Stack), intent(in) :: this
  34. integer, intent(in) :: value
  35. DoesHave = this%List%Find(value)
  36. end function
  37. end module CStack