doublearray

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Code generated by sed. DO NOT EDIT

Code generated by sed. DO NOT EDIT

Code generated by sed. DO NOT EDIT

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotAChild    = errors.New("not a child")
	ErrNotATerminal = errors.New("not a terminal")
)
View Source
var (
	ErrOutofRange = errors.New("index out of range")
	ErrBadAlign   = errors.New("bad align")
)

Functions

func WalkLeaf

func WalkLeaf(da Nodes, yield func(word.Word, uint32) error) error

WalkLeaf : Enumerate the leaf nodes. This is for testing purposes, so it does not work efficiently.

Types

type Builder

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

func NewBuilder

func NewBuilder(opt ...Option) *Builder

func (*Builder) Build

func (b *Builder) Build(da *DoubleArray, ks Walker) error

type Bytes

type Bytes struct{}

func (Bytes) CommonPrefixSearch

func (Bytes) CommonPrefixSearch(da Nodes, cs []byte) ([]node.Index, error)

func (Bytes) ExactMatchSearch

func (Bytes) ExactMatchSearch(da Nodes, cs []byte) (node.Index, error)

type BytesDict

type BytesDict bytes.Dict

func (BytesDict) CommonPrefixSearch

func (s BytesDict) CommonPrefixSearch(da Nodes, cs []byte) ([]node.Index, error)

func (BytesDict) ExactMatchSearch

func (s BytesDict) ExactMatchSearch(da Nodes, cs []byte) (node.Index, error)

type DoubleArray

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

func FromArray

func FromArray(xs []uint64) *DoubleArray

func New

func New() *DoubleArray

func (*DoubleArray) Array

func (da *DoubleArray) Array() []uint64

func (*DoubleArray) At

func (da *DoubleArray) At(i node.Index) (node.Node, error)

func (*DoubleArray) CommonPrefixSearch

func (da *DoubleArray) CommonPrefixSearch(cs word.Word) ([]node.Index, error)

func (*DoubleArray) ExactMatchSearch

func (da *DoubleArray) ExactMatchSearch(cs word.Word) (node.Index, error)

func (*DoubleArray) ReadFrom

func (da *DoubleArray) ReadFrom(r io.Reader) (int64, error)

func (*DoubleArray) WriteTo

func (da *DoubleArray) WriteTo(w io.Writer) (int64, error)

type Mmap

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

func NewMmap

func NewMmap(r *mmap.ReaderAt, offset, length int64) *Mmap

func OpenMmap

func OpenMmap(path string) (*Mmap, error)

func (*Mmap) At

func (da *Mmap) At(i node.Index) (node.Node, error)

func (*Mmap) CommonPrefixSearch

func (da *Mmap) CommonPrefixSearch(cs word.Word) ([]node.Index, error)

func (*Mmap) ExactMatchSearch

func (da *Mmap) ExactMatchSearch(cs word.Word) (node.Index, error)

func (*Mmap) WriteTo

func (da *Mmap) WriteTo(w io.Writer) (int64, error)

type Nodes

type Nodes interface {
	At(node.Index) (node.Node, error)
	io.WriterTo
}

type Option

type Option func(*Builder)

func OptionProgress

func OptionProgress(p Progress) Option

type Progress

type Progress interface {
	SetMax(int)
	Add(int) error
}

type RunesDict

type RunesDict runes.Dict

func (RunesDict) CommonPrefixSearch

func (s RunesDict) CommonPrefixSearch(da Nodes, cs string) ([]node.Index, error)

func (RunesDict) ExactMatchSearch

func (s RunesDict) ExactMatchSearch(da Nodes, cs string) (node.Index, error)

type Stat

type Stat struct {
	Size  int
	Node  int
	Empty int
	Leaf  int
}

func GetStat

func GetStat(da Nodes) Stat

func (Stat) String

func (s Stat) String() string

type Walker

type Walker interface {
	WalkNode(func(word.Word, []word.Code, *uint32) error) error
	WalkLeaf(func(word.Word, uint32) error) error
	LeafNum() int
}

type Words

type Words struct{}

func (Words) CommonPrefixSearch

func (Words) CommonPrefixSearch(da Nodes, cs word.Word) ([]node.Index, error)

func (Words) ExactMatchSearch

func (Words) ExactMatchSearch(da Nodes, cs word.Word) (node.Index, error)

Jump to

Keyboard shortcuts

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