stack

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 3 Imported by: 1

README

stack

A Go package used for generating linked stacks. It also features some already generated stacks and operations on stacks.

Table of Contents

  1. Table of Contents
  2. Tool
  3. Documentation
  4. Content

Tool

Installation

To install the tool, run the following command:

go get -u github.com/PlayerR9/stack/cmd
Usage

Once imported, you can use the tool to generate the linked stack for your own types. Like so:

import _ "github.com/PlayerR9/stack"

//go:generate go run stack/cmd -name=Foo -type=int

This will generate a linked stack with the name "Foo" of type "int".

The type generated will be in the same package as the tool. Make sure to read the documentation of the tool before using it.

Documentation

This command generates a linked stack with the specified type.

To use it, run the following command:

//go:generate go run stack/cmd -name=<type_name> -type=<type> [ -g=<generics> ] [ -o=<output_file> ]


**Flag: Type Name**

The "type name" flag is used to specify the name of the linked stack struct. If not set, the default name
of "Linked<DataType>Stack" will be used instead; where <DataType> is the data type of the linked stack. Otherwise,
it must be a valid Go identifier and starting with an upper case letter.


**Flag: Type**

The "type" flag is used to specify the type of the linked stack contains. Because it doesn't make
a lot of sense to have a linked stack without a type, this flag must be set.

For instance, running the following command:

//go:generate go run stack/cmd -name=Stack -type=string

will generate a linked stack with the following fields:

type Stack struct {
	// stack of strings
}

Also, it is possible to specify generics by following the value with the generics between square brackets;
like so: "MyType[T,C]"


**Flag: Generics**

This optional flag is used to specify the type(s) of the generics. However, this only applies if at least one
generic type is specified in the type flag. If none, then this flag is ignored.

As an edge case, if this flag is not specified but the type flag contains generics, then
all generics are set to the default value of "any".

As with the fields flag, its argument is specified as a list of key-value pairs where each pair is separated
by a comma (",") and a slash ("/") is used to separate the key and the value. The key indicates the name of
the generic and the value indicates the type of the generic.

For instance, running the following command:

//go:generate go run stack/cmd -type=Stack -type=MyType[T] -g=T/any

will generate a linked stack with the following fields:

type Stack[T any] struct {
   // stack of MyType[T]
}


**Flag: Output File**

This optional flag is used to specify the output file. If not specified, the output will be written to
standard output, that is, the file "<type_name>_stack.go" in the root of the current directory.

Content

Here are all the pregenerated files:

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 BoolStack

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

func NewBoolStack() *BoolStack

NewBoolStack creates a new linked stack.

Returns:

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

func (*BoolStack) Capacity

func (s *BoolStack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*BoolStack) Clear

func (s *BoolStack) Clear()

Clear implements the stack.Stacker interface.

func (*BoolStack) Copy

func (s *BoolStack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*BoolStack) GoString

func (s *BoolStack) GoString() string

GoString implements the stack.Stacker interface.

func (*BoolStack) IsEmpty

func (s *BoolStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*BoolStack) IsFull

func (s *BoolStack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*BoolStack) Iterator

func (s *BoolStack) Iterator() common.Iterater[bool]

Iterator implements the stack.Stacker interface.

func (*BoolStack) Peek

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

Peek implements the stack.Stacker interface.

func (*BoolStack) Pop

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

Pop implements the stack.Stacker interface.

func (*BoolStack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*BoolStack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*BoolStack) Size

func (s *BoolStack) Size() int

Size implements the stack.Stacker interface.

func (*BoolStack) Slice

func (s *BoolStack) Slice() []bool

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type ByteStack

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

func NewByteStack() *ByteStack

NewByteStack creates a new linked stack.

Returns:

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

func (*ByteStack) Capacity

func (s *ByteStack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*ByteStack) Clear

func (s *ByteStack) Clear()

Clear implements the stack.Stacker interface.

func (*ByteStack) Copy

func (s *ByteStack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*ByteStack) GoString

func (s *ByteStack) GoString() string

GoString implements the stack.Stacker interface.

func (*ByteStack) IsEmpty

func (s *ByteStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*ByteStack) IsFull

func (s *ByteStack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*ByteStack) Iterator

func (s *ByteStack) Iterator() common.Iterater[byte]

Iterator implements the stack.Stacker interface.

func (*ByteStack) Peek

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

Peek implements the stack.Stacker interface.

func (*ByteStack) Pop

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

Pop implements the stack.Stacker interface.

func (*ByteStack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*ByteStack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*ByteStack) Size

func (s *ByteStack) Size() int

Size implements the stack.Stacker interface.

func (*ByteStack) Slice

func (s *ByteStack) Slice() []byte

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Complex128Stack

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

func NewComplex128Stack() *Complex128Stack

NewComplex128Stack creates a new linked stack.

Returns:

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

func (*Complex128Stack) Capacity

func (s *Complex128Stack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*Complex128Stack) Clear

func (s *Complex128Stack) Clear()

Clear implements the stack.Stacker interface.

func (*Complex128Stack) Copy

func (s *Complex128Stack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*Complex128Stack) GoString

func (s *Complex128Stack) GoString() string

GoString implements the stack.Stacker interface.

func (*Complex128Stack) IsEmpty

func (s *Complex128Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*Complex128Stack) IsFull

func (s *Complex128Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*Complex128Stack) Iterator

func (s *Complex128Stack) Iterator() common.Iterater[complex128]

Iterator implements the stack.Stacker interface.

func (*Complex128Stack) Peek

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

Peek implements the stack.Stacker interface.

func (*Complex128Stack) Pop

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

Pop implements the stack.Stacker interface.

func (*Complex128Stack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*Complex128Stack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*Complex128Stack) Size

func (s *Complex128Stack) Size() int

Size implements the stack.Stacker interface.

func (*Complex128Stack) Slice

func (s *Complex128Stack) Slice() []complex128

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Complex64Stack

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

func NewComplex64Stack() *Complex64Stack

NewComplex64Stack creates a new linked stack.

Returns:

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

func (*Complex64Stack) Capacity

func (s *Complex64Stack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*Complex64Stack) Clear

func (s *Complex64Stack) Clear()

Clear implements the stack.Stacker interface.

func (*Complex64Stack) Copy

func (s *Complex64Stack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*Complex64Stack) GoString

func (s *Complex64Stack) GoString() string

GoString implements the stack.Stacker interface.

func (*Complex64Stack) IsEmpty

func (s *Complex64Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*Complex64Stack) IsFull

func (s *Complex64Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*Complex64Stack) Iterator

func (s *Complex64Stack) Iterator() common.Iterater[complex64]

Iterator implements the stack.Stacker interface.

func (*Complex64Stack) Peek

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

Peek implements the stack.Stacker interface.

func (*Complex64Stack) Pop

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

Pop implements the stack.Stacker interface.

func (*Complex64Stack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*Complex64Stack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*Complex64Stack) Size

func (s *Complex64Stack) Size() int

Size implements the stack.Stacker interface.

func (*Complex64Stack) Slice

func (s *Complex64Stack) Slice() []complex64

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type ErrorStack

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

func NewErrorStack() *ErrorStack

NewErrorStack creates a new linked stack.

Returns:

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

func (*ErrorStack) Capacity

func (s *ErrorStack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*ErrorStack) Clear

func (s *ErrorStack) Clear()

Clear implements the stack.Stacker interface.

func (*ErrorStack) Copy

func (s *ErrorStack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*ErrorStack) GoString

func (s *ErrorStack) GoString() string

GoString implements the stack.Stacker interface.

func (*ErrorStack) IsEmpty

func (s *ErrorStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*ErrorStack) IsFull

func (s *ErrorStack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*ErrorStack) Iterator

func (s *ErrorStack) Iterator() common.Iterater[error]

Iterator implements the stack.Stacker interface.

func (*ErrorStack) Peek

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

Peek implements the stack.Stacker interface.

func (*ErrorStack) Pop

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

Pop implements the stack.Stacker interface.

func (*ErrorStack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*ErrorStack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*ErrorStack) Size

func (s *ErrorStack) Size() int

Size implements the stack.Stacker interface.

func (*ErrorStack) Slice

func (s *ErrorStack) Slice() []error

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Float32Stack

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

func NewFloat32Stack() *Float32Stack

NewFloat32Stack creates a new linked stack.

Returns:

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

func (*Float32Stack) Capacity

func (s *Float32Stack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*Float32Stack) Clear

func (s *Float32Stack) Clear()

Clear implements the stack.Stacker interface.

func (*Float32Stack) Copy

func (s *Float32Stack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*Float32Stack) GoString

func (s *Float32Stack) GoString() string

GoString implements the stack.Stacker interface.

func (*Float32Stack) IsEmpty

func (s *Float32Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*Float32Stack) IsFull

func (s *Float32Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*Float32Stack) Iterator

func (s *Float32Stack) Iterator() common.Iterater[float32]

Iterator implements the stack.Stacker interface.

func (*Float32Stack) Peek

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

Peek implements the stack.Stacker interface.

func (*Float32Stack) Pop

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

Pop implements the stack.Stacker interface.

func (*Float32Stack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*Float32Stack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*Float32Stack) Size

func (s *Float32Stack) Size() int

Size implements the stack.Stacker interface.

func (*Float32Stack) Slice

func (s *Float32Stack) Slice() []float32

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Float64Stack

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

func NewFloat64Stack() *Float64Stack

NewFloat64Stack creates a new linked stack.

Returns:

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

func (*Float64Stack) Capacity

func (s *Float64Stack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*Float64Stack) Clear

func (s *Float64Stack) Clear()

Clear implements the stack.Stacker interface.

func (*Float64Stack) Copy

func (s *Float64Stack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*Float64Stack) GoString

func (s *Float64Stack) GoString() string

GoString implements the stack.Stacker interface.

func (*Float64Stack) IsEmpty

func (s *Float64Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*Float64Stack) IsFull

func (s *Float64Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*Float64Stack) Iterator

func (s *Float64Stack) Iterator() common.Iterater[float64]

Iterator implements the stack.Stacker interface.

func (*Float64Stack) Peek

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

Peek implements the stack.Stacker interface.

func (*Float64Stack) Pop

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

Pop implements the stack.Stacker interface.

func (*Float64Stack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*Float64Stack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*Float64Stack) Size

func (s *Float64Stack) Size() int

Size implements the stack.Stacker interface.

func (*Float64Stack) Slice

func (s *Float64Stack) Slice() []float64

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Int16Stack

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

func NewInt16Stack() *Int16Stack

NewInt16Stack creates a new linked stack.

Returns:

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

func (*Int16Stack) Capacity

func (s *Int16Stack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*Int16Stack) Clear

func (s *Int16Stack) Clear()

Clear implements the stack.Stacker interface.

func (*Int16Stack) Copy

func (s *Int16Stack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*Int16Stack) GoString

func (s *Int16Stack) GoString() string

GoString implements the stack.Stacker interface.

func (*Int16Stack) IsEmpty

func (s *Int16Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*Int16Stack) IsFull

func (s *Int16Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*Int16Stack) Iterator

func (s *Int16Stack) Iterator() common.Iterater[int16]

Iterator implements the stack.Stacker interface.

func (*Int16Stack) Peek

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

Peek implements the stack.Stacker interface.

func (*Int16Stack) Pop

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

Pop implements the stack.Stacker interface.

func (*Int16Stack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*Int16Stack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*Int16Stack) Size

func (s *Int16Stack) Size() int

Size implements the stack.Stacker interface.

func (*Int16Stack) Slice

func (s *Int16Stack) Slice() []int16

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Int32Stack

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

func NewInt32Stack() *Int32Stack

NewInt32Stack creates a new linked stack.

Returns:

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

func (*Int32Stack) Capacity

func (s *Int32Stack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*Int32Stack) Clear

func (s *Int32Stack) Clear()

Clear implements the stack.Stacker interface.

func (*Int32Stack) Copy

func (s *Int32Stack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*Int32Stack) GoString

func (s *Int32Stack) GoString() string

GoString implements the stack.Stacker interface.

func (*Int32Stack) IsEmpty

func (s *Int32Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*Int32Stack) IsFull

func (s *Int32Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*Int32Stack) Iterator

func (s *Int32Stack) Iterator() common.Iterater[int32]

Iterator implements the stack.Stacker interface.

func (*Int32Stack) Peek

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

Peek implements the stack.Stacker interface.

func (*Int32Stack) Pop

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

Pop implements the stack.Stacker interface.

func (*Int32Stack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*Int32Stack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*Int32Stack) Size

func (s *Int32Stack) Size() int

Size implements the stack.Stacker interface.

func (*Int32Stack) Slice

func (s *Int32Stack) Slice() []int32

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Int64Stack

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

func NewInt64Stack() *Int64Stack

NewInt64Stack creates a new linked stack.

Returns:

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

func (*Int64Stack) Capacity

func (s *Int64Stack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*Int64Stack) Clear

func (s *Int64Stack) Clear()

Clear implements the stack.Stacker interface.

func (*Int64Stack) Copy

func (s *Int64Stack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*Int64Stack) GoString

func (s *Int64Stack) GoString() string

GoString implements the stack.Stacker interface.

func (*Int64Stack) IsEmpty

func (s *Int64Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*Int64Stack) IsFull

func (s *Int64Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*Int64Stack) Iterator

func (s *Int64Stack) Iterator() common.Iterater[int64]

Iterator implements the stack.Stacker interface.

func (*Int64Stack) Peek

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

Peek implements the stack.Stacker interface.

func (*Int64Stack) Pop

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

Pop implements the stack.Stacker interface.

func (*Int64Stack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*Int64Stack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*Int64Stack) Size

func (s *Int64Stack) Size() int

Size implements the stack.Stacker interface.

func (*Int64Stack) Slice

func (s *Int64Stack) Slice() []int64

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Int8Stack

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

func NewInt8Stack() *Int8Stack

NewInt8Stack creates a new linked stack.

Returns:

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

func (*Int8Stack) Capacity

func (s *Int8Stack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*Int8Stack) Clear

func (s *Int8Stack) Clear()

Clear implements the stack.Stacker interface.

func (*Int8Stack) Copy

func (s *Int8Stack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*Int8Stack) GoString

func (s *Int8Stack) GoString() string

GoString implements the stack.Stacker interface.

func (*Int8Stack) IsEmpty

func (s *Int8Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*Int8Stack) IsFull

func (s *Int8Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*Int8Stack) Iterator

func (s *Int8Stack) Iterator() common.Iterater[int8]

Iterator implements the stack.Stacker interface.

func (*Int8Stack) Peek

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

Peek implements the stack.Stacker interface.

func (*Int8Stack) Pop

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

Pop implements the stack.Stacker interface.

func (*Int8Stack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*Int8Stack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*Int8Stack) Size

func (s *Int8Stack) Size() int

Size implements the stack.Stacker interface.

func (*Int8Stack) Slice

func (s *Int8Stack) Slice() []int8

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type IntStack

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

func NewIntStack() *IntStack

NewIntStack creates a new linked stack.

Returns:

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

func (*IntStack) Capacity

func (s *IntStack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*IntStack) Clear

func (s *IntStack) Clear()

Clear implements the stack.Stacker interface.

func (*IntStack) Copy

func (s *IntStack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*IntStack) GoString

func (s *IntStack) GoString() string

GoString implements the stack.Stacker interface.

func (*IntStack) IsEmpty

func (s *IntStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*IntStack) IsFull

func (s *IntStack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*IntStack) Iterator

func (s *IntStack) Iterator() common.Iterater[int]

Iterator implements the stack.Stacker interface.

func (*IntStack) Peek

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

Peek implements the stack.Stacker interface.

func (*IntStack) Pop

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

Pop implements the stack.Stacker interface.

func (*IntStack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*IntStack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*IntStack) Size

func (s *IntStack) Size() int

Size implements the stack.Stacker interface.

func (*IntStack) Slice

func (s *IntStack) Slice() []int

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type LinkedStack

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 NewLinkedStack

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

NewLinkedStack creates a new linked stack.

Returns:

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

func (*LinkedStack[T]) Capacity

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

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*LinkedStack[T]) Clear

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

Clear implements the stack.Stacker interface.

func (*LinkedStack[T]) Copy

func (s *LinkedStack[T]) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*LinkedStack[T]) GoString

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

GoString implements the stack.Stacker interface.

func (*LinkedStack[T]) IsEmpty

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

IsEmpty implements the stack.Stacker interface.

func (*LinkedStack[T]) IsFull

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

IsFull implements the stack.Stacker interface.

Always returns false.

func (*LinkedStack[T]) Iterator

func (s *LinkedStack[T]) Iterator() common.Iterater[T]

Iterator implements the stack.Stacker interface.

func (*LinkedStack[T]) Peek

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

Peek implements the stack.Stacker interface.

func (*LinkedStack[T]) Pop

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

Pop implements the stack.Stacker interface.

func (*LinkedStack[T]) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*LinkedStack[T]) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*LinkedStack[T]) Size

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

Size implements the stack.Stacker interface.

func (*LinkedStack[T]) Slice

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

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type RuneStack

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 NewRuneStack

func NewRuneStack() *RuneStack

NewRuneStack creates a new linked stack.

Returns:

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

func (*RuneStack) Capacity

func (s *RuneStack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*RuneStack) Clear

func (s *RuneStack) Clear()

Clear implements the stack.Stacker interface.

func (*RuneStack) Copy

func (s *RuneStack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*RuneStack) GoString

func (s *RuneStack) GoString() string

GoString implements the stack.Stacker interface.

func (*RuneStack) IsEmpty

func (s *RuneStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*RuneStack) IsFull

func (s *RuneStack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*RuneStack) Iterator

func (s *RuneStack) Iterator() common.Iterater[rune]

Iterator implements the stack.Stacker interface.

func (*RuneStack) Peek

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

Peek implements the stack.Stacker interface.

func (*RuneStack) Pop

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

Pop implements the stack.Stacker interface.

func (*RuneStack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*RuneStack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*RuneStack) Size

func (s *RuneStack) Size() int

Size implements the stack.Stacker interface.

func (*RuneStack) Slice

func (s *RuneStack) Slice() []rune

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type StringStack

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 NewStringStack

func NewStringStack() *StringStack

NewStringStack creates a new linked stack.

Returns:

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

func (*StringStack) Capacity

func (s *StringStack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*StringStack) Clear

func (s *StringStack) Clear()

Clear implements the stack.Stacker interface.

func (*StringStack) Copy

func (s *StringStack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*StringStack) GoString

func (s *StringStack) GoString() string

GoString implements the stack.Stacker interface.

func (*StringStack) IsEmpty

func (s *StringStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*StringStack) IsFull

func (s *StringStack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*StringStack) Iterator

func (s *StringStack) Iterator() common.Iterater[string]

Iterator implements the stack.Stacker interface.

func (*StringStack) Peek

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

Peek implements the stack.Stacker interface.

func (*StringStack) Pop

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

Pop implements the stack.Stacker interface.

func (*StringStack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*StringStack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*StringStack) Size

func (s *StringStack) Size() int

Size implements the stack.Stacker interface.

func (*StringStack) Slice

func (s *StringStack) Slice() []string

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Uint16Stack

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 NewUint16Stack

func NewUint16Stack() *Uint16Stack

NewUint16Stack creates a new linked stack.

Returns:

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

func (*Uint16Stack) Capacity

func (s *Uint16Stack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*Uint16Stack) Clear

func (s *Uint16Stack) Clear()

Clear implements the stack.Stacker interface.

func (*Uint16Stack) Copy

func (s *Uint16Stack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*Uint16Stack) GoString

func (s *Uint16Stack) GoString() string

GoString implements the stack.Stacker interface.

func (*Uint16Stack) IsEmpty

func (s *Uint16Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*Uint16Stack) IsFull

func (s *Uint16Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*Uint16Stack) Iterator

func (s *Uint16Stack) Iterator() common.Iterater[uint16]

Iterator implements the stack.Stacker interface.

func (*Uint16Stack) Peek

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

Peek implements the stack.Stacker interface.

func (*Uint16Stack) Pop

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

Pop implements the stack.Stacker interface.

func (*Uint16Stack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*Uint16Stack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*Uint16Stack) Size

func (s *Uint16Stack) Size() int

Size implements the stack.Stacker interface.

func (*Uint16Stack) Slice

func (s *Uint16Stack) Slice() []uint16

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Uint32Stack

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 NewUint32Stack

func NewUint32Stack() *Uint32Stack

NewUint32Stack creates a new linked stack.

Returns:

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

func (*Uint32Stack) Capacity

func (s *Uint32Stack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*Uint32Stack) Clear

func (s *Uint32Stack) Clear()

Clear implements the stack.Stacker interface.

func (*Uint32Stack) Copy

func (s *Uint32Stack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*Uint32Stack) GoString

func (s *Uint32Stack) GoString() string

GoString implements the stack.Stacker interface.

func (*Uint32Stack) IsEmpty

func (s *Uint32Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*Uint32Stack) IsFull

func (s *Uint32Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*Uint32Stack) Iterator

func (s *Uint32Stack) Iterator() common.Iterater[uint32]

Iterator implements the stack.Stacker interface.

func (*Uint32Stack) Peek

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

Peek implements the stack.Stacker interface.

func (*Uint32Stack) Pop

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

Pop implements the stack.Stacker interface.

func (*Uint32Stack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*Uint32Stack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*Uint32Stack) Size

func (s *Uint32Stack) Size() int

Size implements the stack.Stacker interface.

func (*Uint32Stack) Slice

func (s *Uint32Stack) Slice() []uint32

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Uint64Stack

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 NewUint64Stack

func NewUint64Stack() *Uint64Stack

NewUint64Stack creates a new linked stack.

Returns:

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

func (*Uint64Stack) Capacity

func (s *Uint64Stack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*Uint64Stack) Clear

func (s *Uint64Stack) Clear()

Clear implements the stack.Stacker interface.

func (*Uint64Stack) Copy

func (s *Uint64Stack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*Uint64Stack) GoString

func (s *Uint64Stack) GoString() string

GoString implements the stack.Stacker interface.

func (*Uint64Stack) IsEmpty

func (s *Uint64Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*Uint64Stack) IsFull

func (s *Uint64Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*Uint64Stack) Iterator

func (s *Uint64Stack) Iterator() common.Iterater[uint64]

Iterator implements the stack.Stacker interface.

func (*Uint64Stack) Peek

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

Peek implements the stack.Stacker interface.

func (*Uint64Stack) Pop

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

Pop implements the stack.Stacker interface.

func (*Uint64Stack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*Uint64Stack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*Uint64Stack) Size

func (s *Uint64Stack) Size() int

Size implements the stack.Stacker interface.

func (*Uint64Stack) Slice

func (s *Uint64Stack) Slice() []uint64

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type Uint8Stack

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 NewUint8Stack

func NewUint8Stack() *Uint8Stack

NewUint8Stack creates a new linked stack.

Returns:

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

func (*Uint8Stack) Capacity

func (s *Uint8Stack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*Uint8Stack) Clear

func (s *Uint8Stack) Clear()

Clear implements the stack.Stacker interface.

func (*Uint8Stack) Copy

func (s *Uint8Stack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*Uint8Stack) GoString

func (s *Uint8Stack) GoString() string

GoString implements the stack.Stacker interface.

func (*Uint8Stack) IsEmpty

func (s *Uint8Stack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*Uint8Stack) IsFull

func (s *Uint8Stack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*Uint8Stack) Iterator

func (s *Uint8Stack) Iterator() common.Iterater[uint8]

Iterator implements the stack.Stacker interface.

func (*Uint8Stack) Peek

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

Peek implements the stack.Stacker interface.

func (*Uint8Stack) Pop

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

Pop implements the stack.Stacker interface.

func (*Uint8Stack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*Uint8Stack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*Uint8Stack) Size

func (s *Uint8Stack) Size() int

Size implements the stack.Stacker interface.

func (*Uint8Stack) Slice

func (s *Uint8Stack) Slice() []uint8

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type UintStack

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 NewUintStack

func NewUintStack() *UintStack

NewUintStack creates a new linked stack.

Returns:

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

func (*UintStack) Capacity

func (s *UintStack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*UintStack) Clear

func (s *UintStack) Clear()

Clear implements the stack.Stacker interface.

func (*UintStack) Copy

func (s *UintStack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*UintStack) GoString

func (s *UintStack) GoString() string

GoString implements the stack.Stacker interface.

func (*UintStack) IsEmpty

func (s *UintStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*UintStack) IsFull

func (s *UintStack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*UintStack) Iterator

func (s *UintStack) Iterator() common.Iterater[uint]

Iterator implements the stack.Stacker interface.

func (*UintStack) Peek

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

Peek implements the stack.Stacker interface.

func (*UintStack) Pop

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

Pop implements the stack.Stacker interface.

func (*UintStack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*UintStack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*UintStack) Size

func (s *UintStack) Size() int

Size implements the stack.Stacker interface.

func (*UintStack) Slice

func (s *UintStack) Slice() []uint

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

type UintptrStack

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 NewUintptrStack

func NewUintptrStack() *UintptrStack

NewUintptrStack creates a new linked stack.

Returns:

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

func (*UintptrStack) Capacity

func (s *UintptrStack) Capacity() int

Capacity implements the stack.Stacker interface.

Always returns -1.

func (*UintptrStack) Clear

func (s *UintptrStack) Clear()

Clear implements the stack.Stacker interface.

func (*UintptrStack) Copy

func (s *UintptrStack) Copy() common.Copier

Copy implements the stack.Stacker interface.

The copy is a shallow copy.

func (*UintptrStack) GoString

func (s *UintptrStack) GoString() string

GoString implements the stack.Stacker interface.

func (*UintptrStack) IsEmpty

func (s *UintptrStack) IsEmpty() bool

IsEmpty implements the stack.Stacker interface.

func (*UintptrStack) IsFull

func (s *UintptrStack) IsFull() bool

IsFull implements the stack.Stacker interface.

Always returns false.

func (*UintptrStack) Iterator

func (s *UintptrStack) Iterator() common.Iterater[uintptr]

Iterator implements the stack.Stacker interface.

func (*UintptrStack) Peek

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

Peek implements the stack.Stacker interface.

func (*UintptrStack) Pop

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

Pop implements the stack.Stacker interface.

func (*UintptrStack) Push

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

Push implements the stack.Stacker interface.

Always returns true.

func (*UintptrStack) PushMany

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

PushMany implements the stack.Stacker interface.

Always returns the number of values pushed onto the stack.

func (*UintptrStack) Size

func (s *UintptrStack) Size() int

Size implements the stack.Stacker interface.

func (*UintptrStack) Slice

func (s *UintptrStack) Slice() []uintptr

Slice implements the stack.Stacker interface.

The 0th element is the top of the stack.

Directories

Path Synopsis
This command generates a linked stack with the specified type.
This command generates a linked stack with the specified type.

Jump to

Keyboard shortcuts

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