walker

package
v0.0.0-...-25ef478 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0, BSD-2-Clause Imports: 2 Imported by: 0 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Walker

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

Walker implements a generic data structure that simplifies walks over collections or data structures.

func New

func New(revisitElements ...bool) (walker *Walker)

New is the constructor of the Walker. It accepts an optional boolean flag that controls whether the Walker will visit the same Element multiple times.

func (*Walker) HasNext

func (w *Walker) HasNext() bool

HasNext returns true if the Walker has another element that shall be visited.

func (*Walker) Next

func (w *Walker) Next() (nextElement interface{})

Next returns the next element of the walk.

func (*Walker) Push

func (w *Walker) Push(nextElement interface{}) (walker *Walker)

Push adds a new element to the walk, which can consequently be retrieved by calling the Next method.

func (*Walker) Pushed

func (w *Walker) Pushed(element interface{}) bool

Pushed returns true if the passed element was Pushed to the Walker.

func (*Walker) Reset

func (w *Walker) Reset()

Reset removes all queued elements.

func (*Walker) StopWalk

func (w *Walker) StopWalk()

StopWalk aborts the walk and forces HasNext to always return false.

func (*Walker) WalkStopped

func (w *Walker) WalkStopped() bool

WalkStopped returns true if the Walk has been stopped.

Jump to

Keyboard shortcuts

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