neighbor

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

TODO:

> Write unit tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Neighbor

type Neighbor struct {
	Name     string
	Distance int
}

A struct representing a neighbor, with a Distance to its relation.

type Neighbors

type Neighbors []*Neighbor

A slice of Neighbor objects.

func FindNearest

func FindNearest(subject string, options []string, limit int) Neighbors

Find the nearest, up to <limit>, Neighbors for the given subject.

func (Neighbors) Len

func (n Neighbors) Len() int

The number of Neighbor object in the current slice.

func (Neighbors) Less

func (n Neighbors) Less(i, j int) bool

Determine if the Neighbor at offset i has a lesser Neighbor.Distance than Neighbor at offset j.

func (Neighbors) Swap

func (n Neighbors) Swap(i, j int)

Swap Neighbor at offset i with Neighbor at offset j.

Jump to

Keyboard shortcuts

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