|
123456789101112131415161718192021222324252627282930313233343536373839404142 |
- module CStack
- use CPath
- implicit none
- public
-
- type, public :: Stack
- type(Path) :: List
- contains
- procedure :: Clear => Clear
- procedure :: Push => Push
- procedure :: Pop => Pop
- procedure :: DoesHave => DoesHave
- end type Stack
- contains
-
- subroutine Clear(this)
- implicit none
- class(Stack), intent(inout) :: this
- call this%List%MakeNull()
- end subroutine
-
- subroutine Push(this, value)
- implicit none
- class(Stack), intent(inout) :: this
- integer, intent(in) :: value
- call this%List%Add(value)
- end subroutine
-
- subroutine Pop(this)
- implicit none
- class(Stack), intent(inout) :: this
- call this%List%Remove(this%List%Length())
- end subroutine
-
- logical function DoesHave(this, value)
- implicit none
- class(Stack), intent(in) :: this
- integer, intent(in) :: value
- DoesHave = this%List%Find(value)
- end function
-
- end module CStack
|