stack

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package stack implement a simple fix size FIFO stack

Index

Constants

View Source
const (
	Default_Stack_Size = 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

type Stack struct {
	// contains filtered or unexported fields
}

a fixed size FIFO stack

func NewStack

func NewStack(size int) *Stack

NewStack return a given size stack

func (*Stack) Cap

func (s *Stack) Cap() int

return the stack capacity

func (*Stack) GetBottom

func (s *Stack) GetBottom() interface{}

Get the item at the bottom of stack

func (*Stack) GetTop

func (s *Stack) GetTop() interface{}

Get the item at the top of stack but don't remove it from stack

func (*Stack) IsEmpty

func (s *Stack) IsEmpty() bool

Check if the stack is empty

func (*Stack) IsFull

func (s *Stack) IsFull() bool

Check if the stack is full

func (*Stack) Len

func (s *Stack) Len() int

return the stack length

func (*Stack) Pop

func (s *Stack) Pop() interface{}

Pop a item from stack

func (*Stack) Push

func (s *Stack) Push(item interface{}) (isSuccess bool)

Push a new item into stack

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL