stack

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 5 Imported by: 2

Documentation

Overview

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Code generated with go generate. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayStack

type ArrayStack[T any] struct {
	// contains filtered or unexported fields
}

ArrayStack is a generic type that represents a stack data structure with or without a limited capacity. It is implemented using an array.

func NewArrayStack

func NewArrayStack[T any](values ...T) *ArrayStack[T]

NewArrayStack is a function that creates and returns a new instance of a ArrayStack.

Parameters:

  • values: A variadic parameter of type T, which represents the initial values to be stored in the stack.

Returns:

  • *ArrayStack[T]: A pointer to the newly created ArrayStack.

func (*ArrayStack[T]) Capacity

func (stack *ArrayStack[T]) Capacity() int

Capacity is a method of the ArrayStack type. It is used to return the capacity of the stack.

Returns:

  • int: -1

func (*ArrayStack[T]) Clear

func (stack *ArrayStack[T]) Clear()

Clear is a method of the ArrayStack type. It is used to remove aCommon elements from the stack, making it empty.

func (*ArrayStack[T]) Copy

func (stack *ArrayStack[T]) Copy() *ArrayStack[T]

Copy is a method of the ArrayStack type. It is used to create a shaCommonow copy of the stack.

Returns:

  • uc.Copier: A copy of the stack.

func (*ArrayStack[T]) GoString

func (stack *ArrayStack[T]) GoString() string

GoString implements the fmt.GoStringer interface.

func (*ArrayStack[T]) IsEmpty

func (stack *ArrayStack[T]) IsEmpty() bool

IsEmpty is a method of the ArrayStack type. It is used to check if the stack is empty.

Returns:

  • bool: A boolean value that is true if the stack is empty, and false otherwise.

func (*ArrayStack[T]) IsFull

func (stack *ArrayStack[T]) IsFull() bool

IsFull is a method of the ArrayStack type. It is used to check if the stack is full.

Returns:

  • bool: false

func (*ArrayStack[T]) Peek

func (stack *ArrayStack[T]) Peek() (T, bool)

Peek implements the Stacker interface.

func (*ArrayStack[T]) Pop

func (stack *ArrayStack[T]) Pop() (T, bool)

Pop implements the Stacker interface.

func (*ArrayStack[T]) Push

func (stack *ArrayStack[T]) Push(value T) bool

Push implements the Stacker interface.

Always returns true.

func (*ArrayStack[T]) PushMany

func (stack *ArrayStack[T]) PushMany(values []T) int

PushMany implements the Stacker interface.

func (*ArrayStack[T]) Size

func (stack *ArrayStack[T]) Size() int

Size is a method of the ArrayStack type. It is used to return the number of elements in the stack.

Returns:

  • int: An integer that represents the number of elements in the stack.

func (*ArrayStack[T]) Slice

func (stack *ArrayStack[T]) Slice() []T

Slice is a method of the ArrayStack type. It is used to return a slice of the elements in the stack.

Returns:

  • []T: A slice of the elements in the stack.

type BoolStack added in v0.1.1

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

BoolStack is a stack of bool values implemented without a maximum capacity and using a linked list.

func NewBoolStack added in v0.1.1

func NewBoolStack() *BoolStack

NewBoolStack creates a new linked stack without a maximum capacity.

Returns:

  • *BoolStack: A pointer to the newly created stack. Never returns nil.

func NewLimitedBoolStack added in v0.1.5

func NewLimitedBoolStack(capacity int) *BoolStack

NewLimitedBoolStack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *BoolStack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func (BoolStack) Capacity added in v0.1.1

func (s BoolStack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*BoolStack) Clear added in v0.1.1

func (s *BoolStack) Clear()

Clear implements the stack.Stacker interface.

func (BoolStack) Copy added in v0.1.1

func (s BoolStack) Copy() *BoolStack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *BoolStack: A pointer to the newly created stack. Never returns nil.

func (BoolStack) GoString added in v0.1.1

func (s BoolStack) GoString() string

GoString implements the stack.Stacker interface.

func (BoolStack) IsEmpty added in v0.1.1

func (s BoolStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (BoolStack) IsFull added in v0.1.1

func (s BoolStack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (BoolStack) Peek added in v0.1.1

func (s BoolStack) Peek() (bool, bool)

Peek implements the stack.Stacker interface.

func (*BoolStack) Pop added in v0.1.1

func (s *BoolStack) Pop() (bool, bool)

Pop implements the stack.Stacker interface.

func (*BoolStack) Push added in v0.1.1

func (s *BoolStack) Push(value bool) bool

Push implements the stack.Stacker interface.

func (*BoolStack) PushMany added in v0.1.1

func (s *BoolStack) PushMany(values []bool) int

PushMany implements the stack.Stacker interface.

func (BoolStack) Size added in v0.1.1

func (s BoolStack) Size() int

Size implements the stack.Stacker interface.

func (BoolStack) Slice added in v0.1.1

func (s BoolStack) Slice() []bool

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type ByteStack added in v0.1.1

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

ByteStack is a stack of byte values implemented without a maximum capacity and using a linked list.

func NewByteStack added in v0.1.1

func NewByteStack() *ByteStack

NewByteStack creates a new linked stack without a maximum capacity.

Returns:

  • *ByteStack: A pointer to the newly created stack. Never returns nil.

func NewLimitedByteStack added in v0.1.5

func NewLimitedByteStack(capacity int) *ByteStack

NewLimitedByteStack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *ByteStack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func (ByteStack) Capacity added in v0.1.1

func (s ByteStack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*ByteStack) Clear added in v0.1.1

func (s *ByteStack) Clear()

Clear implements the stack.Stacker interface.

func (ByteStack) Copy added in v0.1.1

func (s ByteStack) Copy() *ByteStack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *ByteStack: A pointer to the newly created stack. Never returns nil.

func (ByteStack) GoString added in v0.1.1

func (s ByteStack) GoString() string

GoString implements the stack.Stacker interface.

func (ByteStack) IsEmpty added in v0.1.1

func (s ByteStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (ByteStack) IsFull added in v0.1.1

func (s ByteStack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (ByteStack) Peek added in v0.1.1

func (s ByteStack) Peek() (byte, bool)

Peek implements the stack.Stacker interface.

func (*ByteStack) Pop added in v0.1.1

func (s *ByteStack) Pop() (byte, bool)

Pop implements the stack.Stacker interface.

func (*ByteStack) Push added in v0.1.1

func (s *ByteStack) Push(value byte) bool

Push implements the stack.Stacker interface.

func (*ByteStack) PushMany added in v0.1.1

func (s *ByteStack) PushMany(values []byte) int

PushMany implements the stack.Stacker interface.

func (ByteStack) Size added in v0.1.1

func (s ByteStack) Size() int

Size implements the stack.Stacker interface.

func (ByteStack) Slice added in v0.1.1

func (s ByteStack) Slice() []byte

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Complex128Stack added in v0.1.1

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

Complex128Stack is a stack of complex128 values implemented without a maximum capacity and using a linked list.

func NewComplex128Stack added in v0.1.1

func NewComplex128Stack() *Complex128Stack

NewComplex128Stack creates a new linked stack without a maximum capacity.

Returns:

  • *Complex128Stack: A pointer to the newly created stack. Never returns nil.

func NewLimitedComplex128Stack added in v0.1.5

func NewLimitedComplex128Stack(capacity int) *Complex128Stack

NewLimitedComplex128Stack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *Complex128Stack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func (Complex128Stack) Capacity added in v0.1.1

func (s Complex128Stack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*Complex128Stack) Clear added in v0.1.1

func (s *Complex128Stack) Clear()

Clear implements the stack.Stacker interface.

func (Complex128Stack) Copy added in v0.1.1

func (s Complex128Stack) Copy() *Complex128Stack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *Complex128Stack: A pointer to the newly created stack. Never returns nil.

func (Complex128Stack) GoString added in v0.1.1

func (s Complex128Stack) GoString() string

GoString implements the stack.Stacker interface.

func (Complex128Stack) IsEmpty added in v0.1.1

func (s Complex128Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (Complex128Stack) IsFull added in v0.1.1

func (s Complex128Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (Complex128Stack) Peek added in v0.1.1

func (s Complex128Stack) Peek() (complex128, bool)

Peek implements the stack.Stacker interface.

func (*Complex128Stack) Pop added in v0.1.1

func (s *Complex128Stack) Pop() (complex128, bool)

Pop implements the stack.Stacker interface.

func (*Complex128Stack) Push added in v0.1.1

func (s *Complex128Stack) Push(value complex128) bool

Push implements the stack.Stacker interface.

func (*Complex128Stack) PushMany added in v0.1.1

func (s *Complex128Stack) PushMany(values []complex128) int

PushMany implements the stack.Stacker interface.

func (Complex128Stack) Size added in v0.1.1

func (s Complex128Stack) Size() int

Size implements the stack.Stacker interface.

func (Complex128Stack) Slice added in v0.1.1

func (s Complex128Stack) Slice() []complex128

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Complex64Stack added in v0.1.1

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

Complex64Stack is a stack of complex64 values implemented without a maximum capacity and using a linked list.

func NewComplex64Stack added in v0.1.1

func NewComplex64Stack() *Complex64Stack

NewComplex64Stack creates a new linked stack without a maximum capacity.

Returns:

  • *Complex64Stack: A pointer to the newly created stack. Never returns nil.

func NewLimitedComplex64Stack added in v0.1.5

func NewLimitedComplex64Stack(capacity int) *Complex64Stack

NewLimitedComplex64Stack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *Complex64Stack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func (Complex64Stack) Capacity added in v0.1.1

func (s Complex64Stack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*Complex64Stack) Clear added in v0.1.1

func (s *Complex64Stack) Clear()

Clear implements the stack.Stacker interface.

func (Complex64Stack) Copy added in v0.1.1

func (s Complex64Stack) Copy() *Complex64Stack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *Complex64Stack: A pointer to the newly created stack. Never returns nil.

func (Complex64Stack) GoString added in v0.1.1

func (s Complex64Stack) GoString() string

GoString implements the stack.Stacker interface.

func (Complex64Stack) IsEmpty added in v0.1.1

func (s Complex64Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (Complex64Stack) IsFull added in v0.1.1

func (s Complex64Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (Complex64Stack) Peek added in v0.1.1

func (s Complex64Stack) Peek() (complex64, bool)

Peek implements the stack.Stacker interface.

func (*Complex64Stack) Pop added in v0.1.1

func (s *Complex64Stack) Pop() (complex64, bool)

Pop implements the stack.Stacker interface.

func (*Complex64Stack) Push added in v0.1.1

func (s *Complex64Stack) Push(value complex64) bool

Push implements the stack.Stacker interface.

func (*Complex64Stack) PushMany added in v0.1.1

func (s *Complex64Stack) PushMany(values []complex64) int

PushMany implements the stack.Stacker interface.

func (Complex64Stack) Size added in v0.1.1

func (s Complex64Stack) Size() int

Size implements the stack.Stacker interface.

func (Complex64Stack) Slice added in v0.1.1

func (s Complex64Stack) Slice() []complex64

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type ErrorStack added in v0.1.1

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

ErrorStack is a stack of error values implemented without a maximum capacity and using a linked list.

func NewErrorStack added in v0.1.1

func NewErrorStack() *ErrorStack

NewErrorStack creates a new linked stack without a maximum capacity.

Returns:

  • *ErrorStack: A pointer to the newly created stack. Never returns nil.

func NewLimitedErrorStack added in v0.1.5

func NewLimitedErrorStack(capacity int) *ErrorStack

NewLimitedErrorStack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *ErrorStack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func (ErrorStack) Capacity added in v0.1.1

func (s ErrorStack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*ErrorStack) Clear added in v0.1.1

func (s *ErrorStack) Clear()

Clear implements the stack.Stacker interface.

func (ErrorStack) Copy added in v0.1.1

func (s ErrorStack) Copy() *ErrorStack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *ErrorStack: A pointer to the newly created stack. Never returns nil.

func (ErrorStack) GoString added in v0.1.1

func (s ErrorStack) GoString() string

GoString implements the stack.Stacker interface.

func (ErrorStack) IsEmpty added in v0.1.1

func (s ErrorStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (ErrorStack) IsFull added in v0.1.1

func (s ErrorStack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (ErrorStack) Peek added in v0.1.1

func (s ErrorStack) Peek() (error, bool)

Peek implements the stack.Stacker interface.

func (*ErrorStack) Pop added in v0.1.1

func (s *ErrorStack) Pop() (error, bool)

Pop implements the stack.Stacker interface.

func (*ErrorStack) Push added in v0.1.1

func (s *ErrorStack) Push(value error) bool

Push implements the stack.Stacker interface.

func (*ErrorStack) PushMany added in v0.1.1

func (s *ErrorStack) PushMany(values []error) int

PushMany implements the stack.Stacker interface.

func (ErrorStack) Size added in v0.1.1

func (s ErrorStack) Size() int

Size implements the stack.Stacker interface.

func (ErrorStack) Slice added in v0.1.1

func (s ErrorStack) Slice() []error

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Float32Stack added in v0.1.1

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

Float32Stack is a stack of float32 values implemented without a maximum capacity and using a linked list.

func NewFloat32Stack added in v0.1.1

func NewFloat32Stack() *Float32Stack

NewFloat32Stack creates a new linked stack without a maximum capacity.

Returns:

  • *Float32Stack: A pointer to the newly created stack. Never returns nil.

func NewLimitedFloat32Stack added in v0.1.5

func NewLimitedFloat32Stack(capacity int) *Float32Stack

NewLimitedFloat32Stack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *Float32Stack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func (Float32Stack) Capacity added in v0.1.1

func (s Float32Stack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*Float32Stack) Clear added in v0.1.1

func (s *Float32Stack) Clear()

Clear implements the stack.Stacker interface.

func (Float32Stack) Copy added in v0.1.1

func (s Float32Stack) Copy() *Float32Stack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *Float32Stack: A pointer to the newly created stack. Never returns nil.

func (Float32Stack) GoString added in v0.1.1

func (s Float32Stack) GoString() string

GoString implements the stack.Stacker interface.

func (Float32Stack) IsEmpty added in v0.1.1

func (s Float32Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (Float32Stack) IsFull added in v0.1.1

func (s Float32Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (Float32Stack) Peek added in v0.1.1

func (s Float32Stack) Peek() (float32, bool)

Peek implements the stack.Stacker interface.

func (*Float32Stack) Pop added in v0.1.1

func (s *Float32Stack) Pop() (float32, bool)

Pop implements the stack.Stacker interface.

func (*Float32Stack) Push added in v0.1.1

func (s *Float32Stack) Push(value float32) bool

Push implements the stack.Stacker interface.

func (*Float32Stack) PushMany added in v0.1.1

func (s *Float32Stack) PushMany(values []float32) int

PushMany implements the stack.Stacker interface.

func (Float32Stack) Size added in v0.1.1

func (s Float32Stack) Size() int

Size implements the stack.Stacker interface.

func (Float32Stack) Slice added in v0.1.1

func (s Float32Stack) Slice() []float32

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Float64Stack added in v0.1.1

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

Float64Stack is a stack of float64 values implemented without a maximum capacity and using a linked list.

func NewFloat64Stack added in v0.1.1

func NewFloat64Stack() *Float64Stack

NewFloat64Stack creates a new linked stack without a maximum capacity.

Returns:

  • *Float64Stack: A pointer to the newly created stack. Never returns nil.

func NewLimitedFloat64Stack added in v0.1.5

func NewLimitedFloat64Stack(capacity int) *Float64Stack

NewLimitedFloat64Stack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *Float64Stack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func (Float64Stack) Capacity added in v0.1.1

func (s Float64Stack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*Float64Stack) Clear added in v0.1.1

func (s *Float64Stack) Clear()

Clear implements the stack.Stacker interface.

func (Float64Stack) Copy added in v0.1.1

func (s Float64Stack) Copy() *Float64Stack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *Float64Stack: A pointer to the newly created stack. Never returns nil.

func (Float64Stack) GoString added in v0.1.1

func (s Float64Stack) GoString() string

GoString implements the stack.Stacker interface.

func (Float64Stack) IsEmpty added in v0.1.1

func (s Float64Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (Float64Stack) IsFull added in v0.1.1

func (s Float64Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (Float64Stack) Peek added in v0.1.1

func (s Float64Stack) Peek() (float64, bool)

Peek implements the stack.Stacker interface.

func (*Float64Stack) Pop added in v0.1.1

func (s *Float64Stack) Pop() (float64, bool)

Pop implements the stack.Stacker interface.

func (*Float64Stack) Push added in v0.1.1

func (s *Float64Stack) Push(value float64) bool

Push implements the stack.Stacker interface.

func (*Float64Stack) PushMany added in v0.1.1

func (s *Float64Stack) PushMany(values []float64) int

PushMany implements the stack.Stacker interface.

func (Float64Stack) Size added in v0.1.1

func (s Float64Stack) Size() int

Size implements the stack.Stacker interface.

func (Float64Stack) Slice added in v0.1.1

func (s Float64Stack) Slice() []float64

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Int16Stack added in v0.1.1

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

Int16Stack is a stack of int16 values implemented without a maximum capacity and using a linked list.

func NewInt16Stack added in v0.1.1

func NewInt16Stack() *Int16Stack

NewInt16Stack creates a new linked stack without a maximum capacity.

Returns:

  • *Int16Stack: A pointer to the newly created stack. Never returns nil.

func NewLimitedInt16Stack added in v0.1.5

func NewLimitedInt16Stack(capacity int) *Int16Stack

NewLimitedInt16Stack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *Int16Stack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func (Int16Stack) Capacity added in v0.1.1

func (s Int16Stack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*Int16Stack) Clear added in v0.1.1

func (s *Int16Stack) Clear()

Clear implements the stack.Stacker interface.

func (Int16Stack) Copy added in v0.1.1

func (s Int16Stack) Copy() *Int16Stack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *Int16Stack: A pointer to the newly created stack. Never returns nil.

func (Int16Stack) GoString added in v0.1.1

func (s Int16Stack) GoString() string

GoString implements the stack.Stacker interface.

func (Int16Stack) IsEmpty added in v0.1.1

func (s Int16Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (Int16Stack) IsFull added in v0.1.1

func (s Int16Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (Int16Stack) Peek added in v0.1.1

func (s Int16Stack) Peek() (int16, bool)

Peek implements the stack.Stacker interface.

func (*Int16Stack) Pop added in v0.1.1

func (s *Int16Stack) Pop() (int16, bool)

Pop implements the stack.Stacker interface.

func (*Int16Stack) Push added in v0.1.1

func (s *Int16Stack) Push(value int16) bool

Push implements the stack.Stacker interface.

func (*Int16Stack) PushMany added in v0.1.1

func (s *Int16Stack) PushMany(values []int16) int

PushMany implements the stack.Stacker interface.

func (Int16Stack) Size added in v0.1.1

func (s Int16Stack) Size() int

Size implements the stack.Stacker interface.

func (Int16Stack) Slice added in v0.1.1

func (s Int16Stack) Slice() []int16

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Int32Stack added in v0.1.1

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

Int32Stack is a stack of int32 values implemented without a maximum capacity and using a linked list.

func NewInt32Stack added in v0.1.1

func NewInt32Stack() *Int32Stack

NewInt32Stack creates a new linked stack without a maximum capacity.

Returns:

  • *Int32Stack: A pointer to the newly created stack. Never returns nil.

func NewLimitedInt32Stack added in v0.1.5

func NewLimitedInt32Stack(capacity int) *Int32Stack

NewLimitedInt32Stack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *Int32Stack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func (Int32Stack) Capacity added in v0.1.1

func (s Int32Stack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*Int32Stack) Clear added in v0.1.1

func (s *Int32Stack) Clear()

Clear implements the stack.Stacker interface.

func (Int32Stack) Copy added in v0.1.1

func (s Int32Stack) Copy() *Int32Stack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *Int32Stack: A pointer to the newly created stack. Never returns nil.

func (Int32Stack) GoString added in v0.1.1

func (s Int32Stack) GoString() string

GoString implements the stack.Stacker interface.

func (Int32Stack) IsEmpty added in v0.1.1

func (s Int32Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (Int32Stack) IsFull added in v0.1.1

func (s Int32Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (Int32Stack) Peek added in v0.1.1

func (s Int32Stack) Peek() (int32, bool)

Peek implements the stack.Stacker interface.

func (*Int32Stack) Pop added in v0.1.1

func (s *Int32Stack) Pop() (int32, bool)

Pop implements the stack.Stacker interface.

func (*Int32Stack) Push added in v0.1.1

func (s *Int32Stack) Push(value int32) bool

Push implements the stack.Stacker interface.

func (*Int32Stack) PushMany added in v0.1.1

func (s *Int32Stack) PushMany(values []int32) int

PushMany implements the stack.Stacker interface.

func (Int32Stack) Size added in v0.1.1

func (s Int32Stack) Size() int

Size implements the stack.Stacker interface.

func (Int32Stack) Slice added in v0.1.1

func (s Int32Stack) Slice() []int32

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Int64Stack added in v0.1.1

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

Int64Stack is a stack of int64 values implemented without a maximum capacity and using a linked list.

func NewInt64Stack added in v0.1.1

func NewInt64Stack() *Int64Stack

NewInt64Stack creates a new linked stack without a maximum capacity.

Returns:

  • *Int64Stack: A pointer to the newly created stack. Never returns nil.

func NewLimitedInt64Stack added in v0.1.5

func NewLimitedInt64Stack(capacity int) *Int64Stack

NewLimitedInt64Stack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *Int64Stack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func (Int64Stack) Capacity added in v0.1.1

func (s Int64Stack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*Int64Stack) Clear added in v0.1.1

func (s *Int64Stack) Clear()

Clear implements the stack.Stacker interface.

func (Int64Stack) Copy added in v0.1.1

func (s Int64Stack) Copy() *Int64Stack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *Int64Stack: A pointer to the newly created stack. Never returns nil.

func (Int64Stack) GoString added in v0.1.1

func (s Int64Stack) GoString() string

GoString implements the stack.Stacker interface.

func (Int64Stack) IsEmpty added in v0.1.1

func (s Int64Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (Int64Stack) IsFull added in v0.1.1

func (s Int64Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (Int64Stack) Peek added in v0.1.1

func (s Int64Stack) Peek() (int64, bool)

Peek implements the stack.Stacker interface.

func (*Int64Stack) Pop added in v0.1.1

func (s *Int64Stack) Pop() (int64, bool)

Pop implements the stack.Stacker interface.

func (*Int64Stack) Push added in v0.1.1

func (s *Int64Stack) Push(value int64) bool

Push implements the stack.Stacker interface.

func (*Int64Stack) PushMany added in v0.1.1

func (s *Int64Stack) PushMany(values []int64) int

PushMany implements the stack.Stacker interface.

func (Int64Stack) Size added in v0.1.1

func (s Int64Stack) Size() int

Size implements the stack.Stacker interface.

func (Int64Stack) Slice added in v0.1.1

func (s Int64Stack) Slice() []int64

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Int8Stack added in v0.1.1

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

Int8Stack is a stack of int8 values implemented without a maximum capacity and using a linked list.

func NewInt8Stack added in v0.1.1

func NewInt8Stack() *Int8Stack

NewInt8Stack creates a new linked stack without a maximum capacity.

Returns:

  • *Int8Stack: A pointer to the newly created stack. Never returns nil.

func NewLimitedInt8Stack added in v0.1.5

func NewLimitedInt8Stack(capacity int) *Int8Stack

NewLimitedInt8Stack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *Int8Stack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func (Int8Stack) Capacity added in v0.1.1

func (s Int8Stack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*Int8Stack) Clear added in v0.1.1

func (s *Int8Stack) Clear()

Clear implements the stack.Stacker interface.

func (Int8Stack) Copy added in v0.1.1

func (s Int8Stack) Copy() *Int8Stack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *Int8Stack: A pointer to the newly created stack. Never returns nil.

func (Int8Stack) GoString added in v0.1.1

func (s Int8Stack) GoString() string

GoString implements the stack.Stacker interface.

func (Int8Stack) IsEmpty added in v0.1.1

func (s Int8Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (Int8Stack) IsFull added in v0.1.1

func (s Int8Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (Int8Stack) Peek added in v0.1.1

func (s Int8Stack) Peek() (int8, bool)

Peek implements the stack.Stacker interface.

func (*Int8Stack) Pop added in v0.1.1

func (s *Int8Stack) Pop() (int8, bool)

Pop implements the stack.Stacker interface.

func (*Int8Stack) Push added in v0.1.1

func (s *Int8Stack) Push(value int8) bool

Push implements the stack.Stacker interface.

func (*Int8Stack) PushMany added in v0.1.1

func (s *Int8Stack) PushMany(values []int8) int

PushMany implements the stack.Stacker interface.

func (Int8Stack) Size added in v0.1.1

func (s Int8Stack) Size() int

Size implements the stack.Stacker interface.

func (Int8Stack) Slice added in v0.1.1

func (s Int8Stack) Slice() []int8

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type IntStack added in v0.1.1

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

IntStack is a stack of int values implemented without a maximum capacity and using a linked list.

func NewIntStack added in v0.1.1

func NewIntStack() *IntStack

NewIntStack creates a new linked stack without a maximum capacity.

Returns:

  • *IntStack: A pointer to the newly created stack. Never returns nil.

func NewLimitedIntStack added in v0.1.5

func NewLimitedIntStack(capacity int) *IntStack

NewLimitedIntStack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *IntStack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func (IntStack) Capacity added in v0.1.1

func (s IntStack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*IntStack) Clear added in v0.1.1

func (s *IntStack) Clear()

Clear implements the stack.Stacker interface.

func (IntStack) Copy added in v0.1.1

func (s IntStack) Copy() *IntStack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *IntStack: A pointer to the newly created stack. Never returns nil.

func (IntStack) GoString added in v0.1.1

func (s IntStack) GoString() string

GoString implements the stack.Stacker interface.

func (IntStack) IsEmpty added in v0.1.1

func (s IntStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (IntStack) IsFull added in v0.1.1

func (s IntStack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (IntStack) Peek added in v0.1.1

func (s IntStack) Peek() (int, bool)

Peek implements the stack.Stacker interface.

func (*IntStack) Pop added in v0.1.1

func (s *IntStack) Pop() (int, bool)

Pop implements the stack.Stacker interface.

func (*IntStack) Push added in v0.1.1

func (s *IntStack) Push(value int) bool

Push implements the stack.Stacker interface.

func (*IntStack) PushMany added in v0.1.1

func (s *IntStack) PushMany(values []int) int

PushMany implements the stack.Stacker interface.

func (IntStack) Size added in v0.1.1

func (s IntStack) Size() int

Size implements the stack.Stacker interface.

func (IntStack) Slice added in v0.1.1

func (s IntStack) Slice() []int

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type LimitedArrayStack

type LimitedArrayStack[T any] struct {
	// contains filtered or unexported fields
}

LimitedArrayStack is a generic type that represents a stack data structure with or without a limited capacity. It is implemented using an array.

func NewLimitedArrayStack

func NewLimitedArrayStack[T any](values ...T) *LimitedArrayStack[T]

NewLimitedArrayStack is a function that creates and returns a new instance of a LimitedArrayStack.

Parameters:

  • values: A variadic parameter of type T, which represents the initial values to be stored in the stack.

Returns:

  • *LimitedArrayStack[T]: A pointer to the newly created LimitedArrayStack.

func (*LimitedArrayStack[T]) Capacity

func (stack *LimitedArrayStack[T]) Capacity() int

Capacity is a method of the LimitedArrayStack type. It is used to return the maximum number of elements the stack can hold.

Returns:

  • optional.Int: An optional integer that represents the maximum number of elements the stack can hold.

func (*LimitedArrayStack[T]) Clear

func (stack *LimitedArrayStack[T]) Clear()

Clear is a method of the LimitedArrayStack type. It is used to remove all elements from the stack, making it empty.

func (*LimitedArrayStack[T]) Copy

func (stack *LimitedArrayStack[T]) Copy() *LimitedArrayStack[T]

Copy is a method of the LimitedArrayStack type. It is used to create a shallow copy of the stack.

Returns:

  • *LimitedArrayStack[T]: A copy of the stack.

func (*LimitedArrayStack[T]) GoString

func (stack *LimitedArrayStack[T]) GoString() string

GoString implements the fmt.GoStringer interface.

func (*LimitedArrayStack[T]) IsEmpty

func (stack *LimitedArrayStack[T]) IsEmpty() bool

IsEmpty is a method of the LimitedArrayStack type. It is used to check if the stack is empty.

Returns:

  • bool: A boolean value that is true if the stack is empty, and false otherwise.

func (*LimitedArrayStack[T]) IsFull

func (stack *LimitedArrayStack[T]) IsFull() (isFull bool)

IsFull is a method of the LimitedArrayStack type. It is used to check if the stack is full, i.e., if it has reached its maximum capacity.

Returns:

  • isFull: A boolean value that is true if the stack is full, and false otherwise.

func (*LimitedArrayStack[T]) Peek

func (stack *LimitedArrayStack[T]) Peek() (T, bool)

Peek implements the Stacker interface.

func (*LimitedArrayStack[T]) Pop

func (stack *LimitedArrayStack[T]) Pop() (T, bool)

Pop implements the Stacker interface.

func (*LimitedArrayStack[T]) Push

func (stack *LimitedArrayStack[T]) Push(value T) bool

Push implements the Stacker interface.

func (*LimitedArrayStack[T]) PushMany

func (stack *LimitedArrayStack[T]) PushMany(values []T) int

PushMany implements the Stacker interface.

func (*LimitedArrayStack[T]) Size

func (stack *LimitedArrayStack[T]) Size() int

Size is a method of the LimitedArrayStack type. It is used to return the number of elements in the stack.

Returns:

  • int: An integer that represents the number of elements in the stack.

func (*LimitedArrayStack[T]) Slice

func (stack *LimitedArrayStack[T]) Slice() []T

Slice is a method of the LimitedArrayStack type. It is used to return a slice of the elements in the stack.

Returns:

  • []T: A slice of the elements in the stack.

type LinkedStack added in v0.1.1

type LinkedStack[T any] struct {
	// contains filtered or unexported fields
}

LinkedStack is a stack of T values implemented without a maximum capacity and using a linked list.

func NewLimitedLinkedStack

func NewLimitedLinkedStack[T any](capacity int) *LinkedStack[T]

NewLimitedLinkedStack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *LinkedStack[T]: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func NewLinkedStack added in v0.1.1

func NewLinkedStack[T any]() *LinkedStack[T]

NewLinkedStack creates a new linked stack without a maximum capacity.

Returns:

  • *LinkedStack[T]: A pointer to the newly created stack. Never returns nil.

func (LinkedStack[T]) Capacity added in v0.1.1

func (s LinkedStack[T]) Capacity() int

Capacity implements the stack.Stacker interface.

func (*LinkedStack[T]) Clear added in v0.1.1

func (s *LinkedStack[T]) Clear()

Clear implements the stack.Stacker interface.

func (LinkedStack[T]) Copy added in v0.1.1

func (s LinkedStack[T]) Copy() *LinkedStack[T]

Copy is a method that returns a deep copy of the stack.

Returns:

  • *LinkedStack[T]: A pointer to the newly created stack. Never returns nil.

func (LinkedStack[T]) GoString added in v0.1.1

func (s LinkedStack[T]) GoString() string

GoString implements the stack.Stacker interface.

func (LinkedStack[T]) IsEmpty added in v0.1.1

func (s LinkedStack[T]) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (LinkedStack[T]) IsFull added in v0.1.1

func (s LinkedStack[T]) IsFull() bool

IsFull implements the stack.Stacker interface.

func (LinkedStack[T]) Peek added in v0.1.1

func (s LinkedStack[T]) Peek() (T, bool)

Peek implements the stack.Stacker interface.

func (*LinkedStack[T]) Pop added in v0.1.1

func (s *LinkedStack[T]) Pop() (T, bool)

Pop implements the stack.Stacker interface.

func (*LinkedStack[T]) Push added in v0.1.1

func (s *LinkedStack[T]) Push(value T) bool

Push implements the stack.Stacker interface.

func (*LinkedStack[T]) PushMany added in v0.1.1

func (s *LinkedStack[T]) PushMany(values []T) int

PushMany implements the stack.Stacker interface.

func (LinkedStack[T]) Size added in v0.1.1

func (s LinkedStack[T]) Size() int

Size implements the stack.Stacker interface.

func (LinkedStack[T]) Slice added in v0.1.1

func (s LinkedStack[T]) Slice() []T

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type RefusableStack added in v0.1.6

type RefusableStack[T any] struct {
	// contains filtered or unexported fields
}

RefusableStack is a stack that can be refused.

func NewRefusableStack added in v0.1.6

func NewRefusableStack[T any]() *RefusableStack[T]

NewRefusableStack creates a new refusable stack.

Returns:

  • *RefusableStack: The new refusable stack. Never returns nil.

func (*RefusableStack[T]) Accept added in v0.1.6

func (s *RefusableStack[T]) Accept()

Accept accepts the current state. Use it when you know you don't need any previous state.

func (*RefusableStack[T]) IsEmpty added in v0.1.6

func (s *RefusableStack[T]) IsEmpty() bool

IsEmpty implements the Stacker interface.

func (*RefusableStack[T]) Peek added in v0.1.6

func (s *RefusableStack[T]) Peek() (T, bool)

Peek implements the Stacker interface.

func (*RefusableStack[T]) Pop added in v0.1.6

func (s *RefusableStack[T]) Pop() (T, bool)

Pop implements the Stacker interface.

func (*RefusableStack[T]) Popped added in v0.1.6

func (s *RefusableStack[T]) Popped() []T

Popped returns the elements that have been popped from the stack.

Returns:

  • []T: The popped elements.

The first element of the returned slice is the top of the stack.

func (*RefusableStack[T]) Push added in v0.1.6

func (s *RefusableStack[T]) Push(elem T)

Push implements the Stacker interface.

func (*RefusableStack[T]) Refuse added in v0.1.6

func (s *RefusableStack[T]) Refuse()

Refuse allows to returned to the state before the last accept call.

func (*RefusableStack[T]) Reset added in v0.1.6

func (s *RefusableStack[T]) Reset()

Reset implements the Stacker interface.

func (*RefusableStack[T]) Size added in v0.1.6

func (s *RefusableStack[T]) Size() int

Size implements the Stacker interface.

type RuneStack added in v0.1.1

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

RuneStack is a stack of rune values implemented without a maximum capacity and using a linked list.

func NewLimitedRuneStack added in v0.1.5

func NewLimitedRuneStack(capacity int) *RuneStack

NewLimitedRuneStack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *RuneStack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func NewRuneStack added in v0.1.1

func NewRuneStack() *RuneStack

NewRuneStack creates a new linked stack without a maximum capacity.

Returns:

  • *RuneStack: A pointer to the newly created stack. Never returns nil.

func (RuneStack) Capacity added in v0.1.1

func (s RuneStack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*RuneStack) Clear added in v0.1.1

func (s *RuneStack) Clear()

Clear implements the stack.Stacker interface.

func (RuneStack) Copy added in v0.1.1

func (s RuneStack) Copy() *RuneStack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *RuneStack: A pointer to the newly created stack. Never returns nil.

func (RuneStack) GoString added in v0.1.1

func (s RuneStack) GoString() string

GoString implements the stack.Stacker interface.

func (RuneStack) IsEmpty added in v0.1.1

func (s RuneStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (RuneStack) IsFull added in v0.1.1

func (s RuneStack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (RuneStack) Peek added in v0.1.1

func (s RuneStack) Peek() (rune, bool)

Peek implements the stack.Stacker interface.

func (*RuneStack) Pop added in v0.1.1

func (s *RuneStack) Pop() (rune, bool)

Pop implements the stack.Stacker interface.

func (*RuneStack) Push added in v0.1.1

func (s *RuneStack) Push(value rune) bool

Push implements the stack.Stacker interface.

func (*RuneStack) PushMany added in v0.1.1

func (s *RuneStack) PushMany(values []rune) int

PushMany implements the stack.Stacker interface.

func (RuneStack) Size added in v0.1.1

func (s RuneStack) Size() int

Size implements the stack.Stacker interface.

func (RuneStack) Slice added in v0.1.1

func (s RuneStack) Slice() []rune

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type StackNode

type StackNode[T any] struct {
	// value is the value stored in the node.
	Value T
	// contains filtered or unexported fields
}

StackNode represents a node in a linked list.

func NewStackNode

func NewStackNode[T any](value T) *StackNode[T]

NewStackNode is a constructor function that creates a new linkedNode with the given value.

Parameters:

  • value: The value to store in the linkedNode.

Returns:

  • *linkedNode: A pointer to the newly created linkedNode.

func (*StackNode[T]) Next

func (node *StackNode[T]) Next() *StackNode[T]

Next is a method that returns the next linkedNode in the list.

Returns:

  • *linkedNode: A pointer to the next linkedNode in the list.

func (*StackNode[T]) SetNext

func (node *StackNode[T]) SetNext(next *StackNode[T])

SetNext is a method that sets the next linkedNode in the list.

Parameters:

  • next: A pointer to the next linkedNode in the list.

type Stacker

type Stacker[T any] interface {
	// Push is a method that adds a value of type T to the end of the stack.
	//
	// Parameters:
	//   - value: The value of type T to add to the stack.
	//
	// Returns:
	//   - bool: True if the value was successfully added to the stack, false otherwise.
	Push(value T) bool

	// PushMany is a method that adds multiple values of type T to the end of the stack.
	//
	// Parameters:
	//   - values: The values of type T to add to the stack.
	//
	// Returns:
	//   - int: The number of values that were successfully added to the stack.
	PushMany(values []T) int

	// Pop is a method that pops an element from the stack and returns it.
	//
	// Returns:
	//   - T: The value of type T that was popped.
	//   - bool: True if the value was successfully popped, false otherwise.
	Pop() (T, bool)

	// Peek is a method that returns the value at the front of the stack without removing
	// it.
	//
	// Returns:
	//   - T: The value of type T at the front of the stack.
	//   - bool: True if the value was successfully peeked, false otherwise.
	Peek() (T, bool)

	// IsEmpty is a method that checks whether the list is empty.
	//
	// Returns:
	//
	//   - bool: True if the list is empty, false otherwise.
	IsEmpty() bool

	// Size method returns the number of elements currently in the list.
	//
	// Returns:
	//
	//   - int: The number of elements in the list.
	Size() int

	// Clear method is used to remove all elements from the list, making it empty.
	Clear()

	// Capacity is a method that returns the maximum number of elements that the list can hold.
	//
	// Returns:
	//
	//   - int: The maximum number of elements that the list can hold. -1 if there is no limit.
	Capacity() int

	// IsFull is a method that checks whether the list is full.
	//
	// Returns:
	//   - bool: True if the list is full, false otherwise.
	IsFull() bool

	// Slice is a method that returns a slice of the values in the stack.
	//
	// Returns:
	// 	- []T: A slice of the values in the stack.
	Slice() []T

	fmt.GoStringer
}

Stacker is an interface that defines methods for a stack data structure.

type StringStack added in v0.1.1

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

StringStack is a stack of string values implemented without a maximum capacity and using a linked list.

func NewLimitedStringStack added in v0.1.5

func NewLimitedStringStack(capacity int) *StringStack

NewLimitedStringStack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *StringStack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func NewStringStack added in v0.1.1

func NewStringStack() *StringStack

NewStringStack creates a new linked stack without a maximum capacity.

Returns:

  • *StringStack: A pointer to the newly created stack. Never returns nil.

func (StringStack) Capacity added in v0.1.1

func (s StringStack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*StringStack) Clear added in v0.1.1

func (s *StringStack) Clear()

Clear implements the stack.Stacker interface.

func (StringStack) Copy added in v0.1.1

func (s StringStack) Copy() *StringStack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *StringStack: A pointer to the newly created stack. Never returns nil.

func (StringStack) GoString added in v0.1.1

func (s StringStack) GoString() string

GoString implements the stack.Stacker interface.

func (StringStack) IsEmpty added in v0.1.1

func (s StringStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (StringStack) IsFull added in v0.1.1

func (s StringStack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (StringStack) Peek added in v0.1.1

func (s StringStack) Peek() (string, bool)

Peek implements the stack.Stacker interface.

func (*StringStack) Pop added in v0.1.1

func (s *StringStack) Pop() (string, bool)

Pop implements the stack.Stacker interface.

func (*StringStack) Push added in v0.1.1

func (s *StringStack) Push(value string) bool

Push implements the stack.Stacker interface.

func (*StringStack) PushMany added in v0.1.1

func (s *StringStack) PushMany(values []string) int

PushMany implements the stack.Stacker interface.

func (StringStack) Size added in v0.1.1

func (s StringStack) Size() int

Size implements the stack.Stacker interface.

func (StringStack) Slice added in v0.1.1

func (s StringStack) Slice() []string

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Uint16Stack added in v0.1.1

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

Uint16Stack is a stack of uint16 values implemented without a maximum capacity and using a linked list.

func NewLimitedUint16Stack added in v0.1.5

func NewLimitedUint16Stack(capacity int) *Uint16Stack

NewLimitedUint16Stack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *Uint16Stack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func NewUint16Stack added in v0.1.1

func NewUint16Stack() *Uint16Stack

NewUint16Stack creates a new linked stack without a maximum capacity.

Returns:

  • *Uint16Stack: A pointer to the newly created stack. Never returns nil.

func (Uint16Stack) Capacity added in v0.1.1

func (s Uint16Stack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*Uint16Stack) Clear added in v0.1.1

func (s *Uint16Stack) Clear()

Clear implements the stack.Stacker interface.

func (Uint16Stack) Copy added in v0.1.1

func (s Uint16Stack) Copy() *Uint16Stack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *Uint16Stack: A pointer to the newly created stack. Never returns nil.

func (Uint16Stack) GoString added in v0.1.1

func (s Uint16Stack) GoString() string

GoString implements the stack.Stacker interface.

func (Uint16Stack) IsEmpty added in v0.1.1

func (s Uint16Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (Uint16Stack) IsFull added in v0.1.1

func (s Uint16Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (Uint16Stack) Peek added in v0.1.1

func (s Uint16Stack) Peek() (uint16, bool)

Peek implements the stack.Stacker interface.

func (*Uint16Stack) Pop added in v0.1.1

func (s *Uint16Stack) Pop() (uint16, bool)

Pop implements the stack.Stacker interface.

func (*Uint16Stack) Push added in v0.1.1

func (s *Uint16Stack) Push(value uint16) bool

Push implements the stack.Stacker interface.

func (*Uint16Stack) PushMany added in v0.1.1

func (s *Uint16Stack) PushMany(values []uint16) int

PushMany implements the stack.Stacker interface.

func (Uint16Stack) Size added in v0.1.1

func (s Uint16Stack) Size() int

Size implements the stack.Stacker interface.

func (Uint16Stack) Slice added in v0.1.1

func (s Uint16Stack) Slice() []uint16

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Uint32Stack added in v0.1.1

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

Uint32Stack is a stack of uint32 values implemented without a maximum capacity and using a linked list.

func NewLimitedUint32Stack added in v0.1.5

func NewLimitedUint32Stack(capacity int) *Uint32Stack

NewLimitedUint32Stack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *Uint32Stack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func NewUint32Stack added in v0.1.1

func NewUint32Stack() *Uint32Stack

NewUint32Stack creates a new linked stack without a maximum capacity.

Returns:

  • *Uint32Stack: A pointer to the newly created stack. Never returns nil.

func (Uint32Stack) Capacity added in v0.1.1

func (s Uint32Stack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*Uint32Stack) Clear added in v0.1.1

func (s *Uint32Stack) Clear()

Clear implements the stack.Stacker interface.

func (Uint32Stack) Copy added in v0.1.1

func (s Uint32Stack) Copy() *Uint32Stack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *Uint32Stack: A pointer to the newly created stack. Never returns nil.

func (Uint32Stack) GoString added in v0.1.1

func (s Uint32Stack) GoString() string

GoString implements the stack.Stacker interface.

func (Uint32Stack) IsEmpty added in v0.1.1

func (s Uint32Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (Uint32Stack) IsFull added in v0.1.1

func (s Uint32Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (Uint32Stack) Peek added in v0.1.1

func (s Uint32Stack) Peek() (uint32, bool)

Peek implements the stack.Stacker interface.

func (*Uint32Stack) Pop added in v0.1.1

func (s *Uint32Stack) Pop() (uint32, bool)

Pop implements the stack.Stacker interface.

func (*Uint32Stack) Push added in v0.1.1

func (s *Uint32Stack) Push(value uint32) bool

Push implements the stack.Stacker interface.

func (*Uint32Stack) PushMany added in v0.1.1

func (s *Uint32Stack) PushMany(values []uint32) int

PushMany implements the stack.Stacker interface.

func (Uint32Stack) Size added in v0.1.1

func (s Uint32Stack) Size() int

Size implements the stack.Stacker interface.

func (Uint32Stack) Slice added in v0.1.1

func (s Uint32Stack) Slice() []uint32

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Uint64Stack added in v0.1.1

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

Uint64Stack is a stack of uint64 values implemented without a maximum capacity and using a linked list.

func NewLimitedUint64Stack added in v0.1.5

func NewLimitedUint64Stack(capacity int) *Uint64Stack

NewLimitedUint64Stack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *Uint64Stack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func NewUint64Stack added in v0.1.1

func NewUint64Stack() *Uint64Stack

NewUint64Stack creates a new linked stack without a maximum capacity.

Returns:

  • *Uint64Stack: A pointer to the newly created stack. Never returns nil.

func (Uint64Stack) Capacity added in v0.1.1

func (s Uint64Stack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*Uint64Stack) Clear added in v0.1.1

func (s *Uint64Stack) Clear()

Clear implements the stack.Stacker interface.

func (Uint64Stack) Copy added in v0.1.1

func (s Uint64Stack) Copy() *Uint64Stack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *Uint64Stack: A pointer to the newly created stack. Never returns nil.

func (Uint64Stack) GoString added in v0.1.1

func (s Uint64Stack) GoString() string

GoString implements the stack.Stacker interface.

func (Uint64Stack) IsEmpty added in v0.1.1

func (s Uint64Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (Uint64Stack) IsFull added in v0.1.1

func (s Uint64Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (Uint64Stack) Peek added in v0.1.1

func (s Uint64Stack) Peek() (uint64, bool)

Peek implements the stack.Stacker interface.

func (*Uint64Stack) Pop added in v0.1.1

func (s *Uint64Stack) Pop() (uint64, bool)

Pop implements the stack.Stacker interface.

func (*Uint64Stack) Push added in v0.1.1

func (s *Uint64Stack) Push(value uint64) bool

Push implements the stack.Stacker interface.

func (*Uint64Stack) PushMany added in v0.1.1

func (s *Uint64Stack) PushMany(values []uint64) int

PushMany implements the stack.Stacker interface.

func (Uint64Stack) Size added in v0.1.1

func (s Uint64Stack) Size() int

Size implements the stack.Stacker interface.

func (Uint64Stack) Slice added in v0.1.1

func (s Uint64Stack) Slice() []uint64

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Uint8Stack added in v0.1.1

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

Uint8Stack is a stack of uint8 values implemented without a maximum capacity and using a linked list.

func NewLimitedUint8Stack added in v0.1.5

func NewLimitedUint8Stack(capacity int) *Uint8Stack

NewLimitedUint8Stack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *Uint8Stack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func NewUint8Stack added in v0.1.1

func NewUint8Stack() *Uint8Stack

NewUint8Stack creates a new linked stack without a maximum capacity.

Returns:

  • *Uint8Stack: A pointer to the newly created stack. Never returns nil.

func (Uint8Stack) Capacity added in v0.1.1

func (s Uint8Stack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*Uint8Stack) Clear added in v0.1.1

func (s *Uint8Stack) Clear()

Clear implements the stack.Stacker interface.

func (Uint8Stack) Copy added in v0.1.1

func (s Uint8Stack) Copy() *Uint8Stack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *Uint8Stack: A pointer to the newly created stack. Never returns nil.

func (Uint8Stack) GoString added in v0.1.1

func (s Uint8Stack) GoString() string

GoString implements the stack.Stacker interface.

func (Uint8Stack) IsEmpty added in v0.1.1

func (s Uint8Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (Uint8Stack) IsFull added in v0.1.1

func (s Uint8Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (Uint8Stack) Peek added in v0.1.1

func (s Uint8Stack) Peek() (uint8, bool)

Peek implements the stack.Stacker interface.

func (*Uint8Stack) Pop added in v0.1.1

func (s *Uint8Stack) Pop() (uint8, bool)

Pop implements the stack.Stacker interface.

func (*Uint8Stack) Push added in v0.1.1

func (s *Uint8Stack) Push(value uint8) bool

Push implements the stack.Stacker interface.

func (*Uint8Stack) PushMany added in v0.1.1

func (s *Uint8Stack) PushMany(values []uint8) int

PushMany implements the stack.Stacker interface.

func (Uint8Stack) Size added in v0.1.1

func (s Uint8Stack) Size() int

Size implements the stack.Stacker interface.

func (Uint8Stack) Slice added in v0.1.1

func (s Uint8Stack) Slice() []uint8

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type UintStack added in v0.1.1

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

UintStack is a stack of uint values implemented without a maximum capacity and using a linked list.

func NewLimitedUintStack added in v0.1.5

func NewLimitedUintStack(capacity int) *UintStack

NewLimitedUintStack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *UintStack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func NewUintStack added in v0.1.1

func NewUintStack() *UintStack

NewUintStack creates a new linked stack without a maximum capacity.

Returns:

  • *UintStack: A pointer to the newly created stack. Never returns nil.

func (UintStack) Capacity added in v0.1.1

func (s UintStack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*UintStack) Clear added in v0.1.1

func (s *UintStack) Clear()

Clear implements the stack.Stacker interface.

func (UintStack) Copy added in v0.1.1

func (s UintStack) Copy() *UintStack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *UintStack: A pointer to the newly created stack. Never returns nil.

func (UintStack) GoString added in v0.1.1

func (s UintStack) GoString() string

GoString implements the stack.Stacker interface.

func (UintStack) IsEmpty added in v0.1.1

func (s UintStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (UintStack) IsFull added in v0.1.1

func (s UintStack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (UintStack) Peek added in v0.1.1

func (s UintStack) Peek() (uint, bool)

Peek implements the stack.Stacker interface.

func (*UintStack) Pop added in v0.1.1

func (s *UintStack) Pop() (uint, bool)

Pop implements the stack.Stacker interface.

func (*UintStack) Push added in v0.1.1

func (s *UintStack) Push(value uint) bool

Push implements the stack.Stacker interface.

func (*UintStack) PushMany added in v0.1.1

func (s *UintStack) PushMany(values []uint) int

PushMany implements the stack.Stacker interface.

func (UintStack) Size added in v0.1.1

func (s UintStack) Size() int

Size implements the stack.Stacker interface.

func (UintStack) Slice added in v0.1.1

func (s UintStack) Slice() []uint

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type UintptrStack added in v0.1.1

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

UintptrStack is a stack of uintptr values implemented without a maximum capacity and using a linked list.

func NewLimitedUintptrStack added in v0.1.5

func NewLimitedUintptrStack(capacity int) *UintptrStack

NewLimitedUintptrStack creates a new linked stack with a limited capacity.

Parameters:

  • capacity: The maximum number of elements the stack can hold.

Returns:

  • *UintptrStack: A pointer to the newly created stack. Never returns nil.

If capacity is less than 0, the stack will be unlimited.

func NewUintptrStack added in v0.1.1

func NewUintptrStack() *UintptrStack

NewUintptrStack creates a new linked stack without a maximum capacity.

Returns:

  • *UintptrStack: A pointer to the newly created stack. Never returns nil.

func (UintptrStack) Capacity added in v0.1.1

func (s UintptrStack) Capacity() int

Capacity implements the stack.Stacker interface.

func (*UintptrStack) Clear added in v0.1.1

func (s *UintptrStack) Clear()

Clear implements the stack.Stacker interface.

func (UintptrStack) Copy added in v0.1.1

func (s UintptrStack) Copy() *UintptrStack

Copy is a method that returns a deep copy of the stack.

Returns:

  • *UintptrStack: A pointer to the newly created stack. Never returns nil.

func (UintptrStack) GoString added in v0.1.1

func (s UintptrStack) GoString() string

GoString implements the stack.Stacker interface.

func (UintptrStack) IsEmpty added in v0.1.1

func (s UintptrStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (UintptrStack) IsFull added in v0.1.1

func (s UintptrStack) IsFull() bool

IsFull implements the stack.Stacker interface.

func (UintptrStack) Peek added in v0.1.1

func (s UintptrStack) Peek() (uintptr, bool)

Peek implements the stack.Stacker interface.

func (*UintptrStack) Pop added in v0.1.1

func (s *UintptrStack) Pop() (uintptr, bool)

Pop implements the stack.Stacker interface.

func (*UintptrStack) Push added in v0.1.1

func (s *UintptrStack) Push(value uintptr) bool

Push implements the stack.Stacker interface.

func (*UintptrStack) PushMany added in v0.1.1

func (s *UintptrStack) PushMany(values []uintptr) int

PushMany implements the stack.Stacker interface.

func (UintptrStack) Size added in v0.1.1

func (s UintptrStack) Size() int

Size implements the stack.Stacker interface.

func (UintptrStack) Slice added in v0.1.1

func (s UintptrStack) Slice() []uintptr

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

Jump to

Keyboard shortcuts

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