Documentation ¶
Index ¶
- type Walker
- func (w *Walker) HasNext() bool
- func (w *Walker) Next() (nextElement interface{})
- func (w *Walker) Push(nextElement interface{}) (walker *Walker)
- func (w *Walker) PushFront(nextElement interface{}) (walker *Walker)
- func (w *Walker) Pushed(element interface{}) bool
- func (w *Walker) Reset()
- func (w *Walker) StopWalk()
- func (w *Walker) WalkStopped() bool
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 ¶
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 ¶
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 ¶
Push adds a new element to the walk, which can consequently be retrieved by calling the Next method.
func (*Walker) PushFront ¶
PushFront adds a new element to the front of the queue, which can consequently be retrieved by calling the Next method.
func (*Walker) StopWalk ¶
func (w *Walker) StopWalk()
StopWalk aborts the walk and forces HasNext to always return false.
func (*Walker) WalkStopped ¶
WalkStopped returns true if the Walk has been stopped.