container

package
v0.0.0-...-938d948 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2014 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotInt           = fmt.Errorf("Attempting to insert a non-int type")
	ErrIndexOOB         = fmt.Errorf("Index is out of bounds")
	ErrNotManipulatable = fmt.Errorf("Filtered arrays are not directly manipulatable")
	ErrMustBeObservable = fmt.Errorf("The inner array must satisfy the Observable interface. Consider wrapping it with the ObservableArray type.")
)

Functions

This section is empty.

Types

type Acceptable

type Acceptable func(data interface{}) bool

type Array

type Array interface {
	Insert(index int, data interface{}) error
	Remove(i int) (olddata interface{}, err error)
	Get(index int) interface{}
	Len() int
}

func NewFilteredArray

func NewFilteredArray(inner Array, accept Acceptable) (Array, error)

type BasicArray

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

func (*BasicArray) Get

func (a *BasicArray) Get(index int) interface{}

func (*BasicArray) Insert

func (a *BasicArray) Insert(index int, data interface{}) error

func (*BasicArray) Len

func (a *BasicArray) Len() int

func (*BasicArray) Remove

func (a *BasicArray) Remove(i int) (olddata interface{}, err error)

type BoundsCheckingArray

type BoundsCheckingArray struct {
	Array
}

func (*BoundsCheckingArray) Get

func (b *BoundsCheckingArray) Get(index int) interface{}

func (*BoundsCheckingArray) Insert

func (b *BoundsCheckingArray) Insert(index int, data interface{}) error

func (*BoundsCheckingArray) Remove

func (b *BoundsCheckingArray) Remove(index int) (interface{}, error)

type Compare

type Compare func(a, b interface{}) ComparisonResult

type ComparisonResult

type ComparisonResult int
const (
	Less ComparisonResult = iota
	Equal
	Greater
)

type Fifo

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

func (*Fifo) Len

func (fi *Fifo) Len() int

func (*Fifo) Less

func (fi *Fifo) Less(i, j int) bool

func (*Fifo) Pop

func (fi *Fifo) Pop() interface{}

func (*Fifo) Push

func (fi *Fifo) Push(x interface{})

func (*Fifo) Swap

func (fi *Fifo) Swap(i, j int)

type Heap

type Heap interface {
	Push(interface{})
	Pop() interface{}
	Len() int
}

func NewHeap

func NewHeap(hi heap.Interface) Heap

type InsertedData

type InsertedData struct {
	Index int
}

type IntArray

type IntArray struct {
	BasicArray
}

func (*IntArray) Insert

func (i *IntArray) Insert(index int, data interface{}) error

type Lifo

type Lifo struct {
	Fifo
}

func (*Lifo) Less

func (li *Lifo) Less(i, j int) bool

type Node

type Node struct {
	Data     interface{}
	Children [2]*Node
}

func (*Node) Find

func (n *Node) Find(data interface{}, cmp Compare) (child int, parent, node *Node)

func (*Node) Walk

func (n *Node) Walk(ch chan interface{})

type ObservableArray

type ObservableArray struct {
	util.BasicObservable
	Array
}

func (*ObservableArray) Insert

func (a *ObservableArray) Insert(index int, data interface{}) error

func (*ObservableArray) Remove

func (a *ObservableArray) Remove(i int) (olddata interface{}, err error)

type PriorityQueue

type PriorityQueue struct {
	Lifo
	Priority func(x interface{}) int
}

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

type RemovedData

type RemovedData struct {
	Index int
	Data  interface{}
}

type Tree

type Tree struct {
	Compare Compare
	Root    Node
}

func (*Tree) Add

func (t *Tree) Add(data interface{}) error

func (*Tree) Delete

func (t *Tree) Delete(data interface{}) error

func (*Tree) Find

func (t *Tree) Find(data interface{}) (child int, parent, node *Node)

Jump to

Keyboard shortcuts

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