search

package
v0.0.0-...-b5aa40e Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2018 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparable

type Comparable interface {
	Compare(interface{}) CompareResult
}

Comparable types can be compared to arbitrary elements and will return a CompareResult following. They are intended for use as search keys.

type CompareResult

type CompareResult int

A CompareResult is returned from a Compare query.

const (
	Less CompareResult = iota
	Equal
	Greater
	Invalid
)

Compare result constant

type Copyable

type Copyable interface {
	Copy() interface{}
}

Copyable types can create copies of themself.

type Dynamic

type Dynamic interface {
	Static
	Insert(Node) error
	Delete(Node) error
	ToStatic() Static
}

Dynamic types implicitly are static types with additional functionality to change their contents, and being static types, should be convertible back to static.

type DynamicPersistent

type DynamicPersistent interface {
	Persistent
	Dynamic
	AtInstant(float64) Dynamic
	ThisInstant() Dynamic
	ToStaticPersistent() StaticPersistent
}

DynamicPersistent types are StaticPersitent types that also allow modification as Dynamic types. AtInstant on a DynamicPersistent type will return a sub-dynamic type instead of a sub-static type, and being implicitly an extension on StaticPersistent, these can be converted back to StaticPersistent.

type Equalable

type Equalable interface {
	Equals(Equalable) bool
}

Equalable types can be compared to one another and will return a boolean if they are the same.

type Inf

type Inf struct{}

Inf is a Comparable type which is greater than everything (including itself)

func (Inf) Compare

func (i Inf) Compare(c interface{}) CompareResult

Compare on Inf returns Greater.

type NegativeInf

type NegativeInf struct{}

NegativeInf is a Comparable type which is less than everything (including itself!) (the less than itself part might change!)

func (NegativeInf) Compare

func (ni NegativeInf) Compare(c interface{}) CompareResult

Compare on NegativeInf returns Less.

type Nil

type Nil struct{}

Nil Equalables are equal to any value. Insert them in deletion queries in order to delete arbitrary elements.

func (Nil) Equals

func (n Nil) Equals(Equalable) bool

Equals on Nil always returns true.

type Node

type Node interface {
	Key() Comparable
	Val() Equalable
}

Node types can be stored in modifiable search types.

type Persistable

type Persistable interface {
	Dynamic
	ToPersistent() DynamicPersistent
}

Persistable types are dynamic types, convertible to PersistentDynamic.

type Persistent

type Persistent interface {
	MinInstant() float64
	MaxInstant() float64
	SetInstant(float64)
}

Persistent types have a concept of time instants elapsing.

type Searchable

type Searchable interface {
	Search(interface{}) (bool, interface{})
	SearchUp(interface{}, int) (Comparable, interface{})
	SearchDown(interface{}, int) (Comparable, interface{})
}

Searchable types can be searched, with float64 keys pointing to arbitrary values.

type Sizable

type Sizable interface {
	Size() int
}

Sizable types can count the number of elements within them.

type Static

type Static interface {
	Sizable
	Searchable
	Traversable
	Copyable
}

Static types can be searched and traversed, but not modified. The benefit of using a static type is that it should be faster to query than a dynamic type.

type StaticPersistent

type StaticPersistent interface {
	Persistent
	Static
	AtInstant(float64) Static
}

StaticPersistent types are Persistent types that are searchable as static types. At a given instant of time, a sub-static type can be returned from a StaticPersistent type.

type Traversable

type Traversable interface {
	InOrderTraverse() []Node
}

Traversable types can produce lists of elements in some given order from within them.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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