branch

package
v0.0.0-...-24dab48 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2015 License: MIT, MIT Imports: 0 Imported by: 0

Documentation

Overview

Package branch implements a custom doubly linked list from https://golang.org/src/container/list/list.go for creating a limited tree structure for scpwm-euclid containing monitor/desktop/client iterations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Branch

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

func New

func New(id string) *Branch

New returns an initialized branch.

func (*Branch) Back

func (b *Branch) Back() *Element

Back returns the last element of branch l or nil.

func (*Branch) Front

func (b *Branch) Front() *Element

Front returns the first element of branch b or nil.

func (*Branch) Init

func (b *Branch) Init(id string) *Branch

Init initializes or clears branch b.

func (*Branch) InsertAfter

func (b *Branch) InsertAfter(v interface{}, mark *Element) *Element

InsertAfter inserts a new element e with value v immediately after mark and returns e. If mark is not an element of b, the branch is not modified.

func (*Branch) InsertBefore

func (b *Branch) InsertBefore(v interface{}, mark *Element) *Element

InsertBefore inserts a new element e with value v immediately before mark and returns e. If mark is not an element of b, the branch is not modified.

func (*Branch) Len

func (b *Branch) Len() int

Len returns the number of elements of branch b. The complexity is O(1).

func (*Branch) MoveAfter

func (b *Branch) MoveAfter(e, mark *Element)

MoveAfter moves element e to its new position after mark. If e or mark is not an element of b, or e == mark, the branch is not modified.

func (*Branch) MoveBefore

func (b *Branch) MoveBefore(e, mark *Element)

MoveBefore moves element e to its new position before mark. If e or mark is not an element of b, or e == mark, the branch is not modified.

func (*Branch) MoveToBack

func (b *Branch) MoveToBack(e *Element)

MoveToBack moves element e to the back of branch b. If e is not an element of b, the branch is not modified.

func (*Branch) MoveToFront

func (b *Branch) MoveToFront(e *Element)

MoveToFront moves element e to the front of branch l. If e is not an element of l, the branch is not modified.

func (*Branch) PushBack

func (b *Branch) PushBack(v interface{}) *Element

PushBack inserts a new element e with value v at the back of branch b and returns e.

func (*Branch) PushBackBranch

func (b *Branch) PushBackBranch(other *Branch)

PushBackBranch inserts a copy of an other branch at the back of branch b. The branchs b and other may be the same.

func (*Branch) PushFront

func (b *Branch) PushFront(v interface{}) *Element

PushFront inserts a new element e with value v at the front of branch b and returns e.

func (*Branch) PushFrontBranch

func (b *Branch) PushFrontBranch(other *Branch)

PushFrontBranch inserts a copy of an other branch at the front of branch b. The branchs b and other may be the same.

func (*Branch) Remove

func (b *Branch) Remove(e *Element) interface{}

Remove removes e from b if e is an element of branch b. It returns the element value e.Value.

type Element

type Element struct {
	Value interface{}
	// contains filtered or unexported fields
}

func (*Element) Next

func (e *Element) Next() *Element

Next returns the next branch element or nil.

func (*Element) NextContinuous

func (e *Element) NextContinuous() *Element

NextContinuous returns the next *Element continuously, looping to the front when the root is reached.

func (*Element) Prev

func (e *Element) Prev() *Element

Prev returns the previous branch element or nil.

func (*Element) PrevContinuous

func (e *Element) PrevContinuous() *Element

PrevContinuous returns the previous *Element continuously, looping to the back when the root is reached.

Jump to

Keyboard shortcuts

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