compare

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package compare implements comparisons between Kythe values as used in the implementation of a graphstore.Service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EntriesEqual

func EntriesEqual(e1, e2 *spb.Entry) bool

EntriesEqual reports whether e1 and e2 are equivalent, including their fact values (if any).

func VNamesEqual

func VNamesEqual(v1, v2 *spb.VName) bool

VNamesEqual reports whether v1 and v2 are equal.

Types

type ByEntries

type ByEntries []*spb.Entry

ByEntries is a min-heap of entries, ordered by Entries.

func (ByEntries) Len

func (s ByEntries) Len() int

Implement the sort.Interface

func (ByEntries) Less

func (s ByEntries) Less(i, j int) bool

func (*ByEntries) Pop

func (s *ByEntries) Pop() interface{}

func (*ByEntries) Push

func (s *ByEntries) Push(v interface{})

Implement the heap.Interface

func (ByEntries) Swap

func (s ByEntries) Swap(i, j int)

type Order

type Order int

An Order represents an ordering relationship between values.

const (
	LT Order = -1 // lhs < rhs
	EQ Order = 0  // lhs == rhs
	GT Order = 1  // lhs > rhs
)

LT, EQ, and GT are the standard values for an Order.

func Entries

func Entries(e1, e2 *spb.Entry) Order

Entries reports whether e1 is LT, GT, or EQ to e2 in entry order, ignoring fact values (if any).

The ordering for entries is defined by lexicographic comparison of [source, edge kind, fact name, target].

func Strings

func Strings(s, t string) Order

Strings returns LT if s < t, EQ if s == t, or GT if s > t.

func VNames

func VNames(v1, v2 *spb.VName) Order

VNames returns LT if v1 precedes v2, EQ if v1 and v2 are equal, or GT if v1 follows v2, in standard order. The ordering for VNames is defined by lexicographic comparison of [signature, corpus, root, path, language].

func ValueEntries

func ValueEntries(e1, e2 *spb.Entry) Order

ValueEntries reports whether e1 is LT, GT, or EQ to e2 in entry order, including fact values (if any).

Jump to

Keyboard shortcuts

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