containers

package
v0.0.0-...-6541b2f Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2014 License: Apache-2.0 Imports: 0 Imported by: 1

Documentation

Overview

Package containers contains implementations of several containers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array interface {
	// Return element at specified position
	At(uint) *interface{}
	// Set the size
	SetSize(uint)
	// Return size (number of elements)
	Size() uint
}

func NewDynamicArray

func NewDynamicArray(clusterSize uint) Array

NewDynamicArray() returns a containers.DynamicArray implementation of the containers.Array interface.

type ArrayStack

type ArrayStack interface {
	Array
	Stack
}

type DynamicArray

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

DynamicArray implements the containers.Array interface. Resizing a DynamicArray does not involve copying. DynamicArray is also a sparse array. Portions of the array are allocated chunks of the "clusterSize" parameter passed to the constructor. The larger the cluster size, the faster the access. Currently, shrinking is not very efficient for large cluster sizes; therefore, PopBack() also is not very efficient.

func (*DynamicArray) At

func (da *DynamicArray) At(i uint) *interface{}

func (*DynamicArray) SetSize

func (da *DynamicArray) SetSize(newSize uint)

func (*DynamicArray) Size

func (da *DynamicArray) Size() uint

type Stack

type Stack interface {
	PushBack(v interface{})
	PushFront(v interface{})
	PopBack() interface{}
	PopFront() interface{}
}

type StackArrayDecorator

type StackArrayDecorator struct {
	Array
}

func (StackArrayDecorator) PopBack

func (sad StackArrayDecorator) PopBack() interface{}

func (StackArrayDecorator) PopFront

func (sad StackArrayDecorator) PopFront() interface{}

func (StackArrayDecorator) PushBack

func (sad StackArrayDecorator) PushBack(v interface{})

func (StackArrayDecorator) PushFront

func (sad StackArrayDecorator) PushFront(v interface{})

Jump to

Keyboard shortcuts

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