vector

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(v Vector, filename string) error

func Less

func Less(v1, v2 *Element) bool

Less returns wether v1 is smaller than v2 based on the keys.

Types

type Allocate

type Allocate struct {
	Vector func(int, func(line string) (key.Key, error)) Vector
	Key    func(line string) (key.Key, error)
}

func DefaultVector

func DefaultVector(allocateKey func(line string) (key.Key, error)) *Allocate

type Element

type Element struct {
	Key  key.Key
	Line string
}

type SliceVec

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

func (*SliceVec) FrontShift

func (v *SliceVec) FrontShift()

func (*SliceVec) Get

func (v *SliceVec) Get(i int) *Element

func (*SliceVec) Len

func (v *SliceVec) Len() int

func (*SliceVec) PushBack

func (v *SliceVec) PushBack(line string) error

func (*SliceVec) Reset

func (v *SliceVec) Reset()

func (*SliceVec) Sort

func (v *SliceVec) Sort()

type Vector

type Vector interface {
	// Get Access i-th element
	Get(i int) *Element
	// PushBack Add item at the end
	PushBack(line string) error
	// FrontShift Remove the first element
	FrontShift()
	// Len Length of the Vector
	Len() int
	// Reset Clear the content in the vector
	Reset()
	// Sort sort the vector in ascending order
	Sort()
}

func AllocateSlice

func AllocateSlice(size int, allocateKey func(line string) (key.Key, error)) Vector

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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