stacks

package
v0.0.0-...-cc5dc36 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2015 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Copyright 2015 mint.zhao.chiu@gmail.com

Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 mint.zhao.chiu@gmail.com

Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 mint.zhao.chiu@gmail.com

Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayStack

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

func NewArrayStack

func NewArrayStack() *ArrayStack

func (*ArrayStack) Clear

func (stack *ArrayStack) Clear()

Removes all elements from the stack.

func (*ArrayStack) Contains

func (stack *ArrayStack) Contains(elements ...interface{}) bool

not important, just for interface{}

func (*ArrayStack) Elements

func (stack *ArrayStack) Elements() []interface{}

Returns all elements in the stack (LIFO order).

func (*ArrayStack) Empty

func (stack *ArrayStack) Empty() bool

Returns true if stack does not contain any elements.

func (*ArrayStack) Len

func (stack *ArrayStack) Len() int

Returns number of elements within the stack.

func (*ArrayStack) Peek

func (stack *ArrayStack) Peek() (value interface{}, ok bool)

Returns top element on the stack without removing it, or nil if stack is empty. Second return parameter is true, unless the stack was empty and there was nothing to peek.

func (*ArrayStack) Pop

func (stack *ArrayStack) Pop() (value interface{}, ok bool)

Pops (removes) top element on stack and returns it, or nil if stack is empty. Second return parameter is true, unless the stack was empty and there was nothing to pop.

func (*ArrayStack) Push

func (stack *ArrayStack) Push(value interface{})

Pushes a value onto the top of the stack

func (*ArrayStack) String

func (stack *ArrayStack) String() string

type LinkedListStack

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

func NewLinkedListStack

func NewLinkedListStack() *LinkedListStack

Instantiates a new empty stack

func (*LinkedListStack) Clear

func (stack *LinkedListStack) Clear()

Removes all elements from the stack.

func (*LinkedListStack) Contains

func (stack *LinkedListStack) Contains(elements ...interface{}) bool

not important, just for interface{}

func (*LinkedListStack) Elements

func (stack *LinkedListStack) Elements() []interface{}

Returns all elements in the stack (LIFO order).

func (*LinkedListStack) Empty

func (stack *LinkedListStack) Empty() bool

Returns true if stack does not contain any elements.

func (*LinkedListStack) Len

func (stack *LinkedListStack) Len() int

Returns number of elements within the stack.

func (*LinkedListStack) Peek

func (stack *LinkedListStack) Peek() (value interface{}, ok bool)

Returns top element on the stack without removing it, or nil if stack is empty. Second return parameter is true, unless the stack was empty and there was nothing to peek.

func (*LinkedListStack) Pop

func (stack *LinkedListStack) Pop() (value interface{}, ok bool)

Pops (removes) top element on stack and returns it, or nil if stack is empty. Second return parameter is true, unless the stack was empty and there was nothing to pop.

func (*LinkedListStack) Push

func (stack *LinkedListStack) Push(value interface{})

Pushes a value onto the top of the stack

func (*LinkedListStack) String

func (stack *LinkedListStack) String() string

type StackInterface

type StackInterface interface {
	Push(value interface{})
	Pop() (value interface{}, ok bool)
	Peek() (value interface{}, ok bool)
	container.ContainerInterface
}

Jump to

Keyboard shortcuts

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