diff

package module
v0.0.0-...-2e7ea9a Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func For

func For(es Document, f func(i int, e Element))

func LongestIncreasingSubsequence

func LongestIncreasingSubsequence(vs []int) []int

func TrimCommonElements

func TrimCommonElements(a, b Document) (Document, Document)

func UniqueElements

func UniqueElements(es Document) map[uint64][]int

Types

type Document

type Document interface {
	Len() int
	At(i int) Element
	Slice(start, end int) Document
	Join() string
	AbsoluteRange() (from, to int)
}

func NewDocument

func NewDocument(doc string) Document

type Edit

type Edit struct {
	A Document
	B Document
}

func Diff

func Diff(a, b Document) []Edit

func NewEdit

func NewEdit(a, b Document) Edit

func (Edit) String

func (e Edit) String() string

func (Edit) Type

func (e Edit) Type() EditType

type EditType

type EditType int
const (
	Empty EditType = iota
	Insert
	Delete
	Replace
)

func (EditType) String

func (et EditType) String() string

type Element

type Element interface {
	Equals(e Element) bool
	Hash() uint64
	fmt.Stringer
}

type Line

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

func NewLine

func NewLine(s string) Line

func NewLineRaw

func NewLineRaw(raw []byte, start, end int) Line

func (Line) AbsoluteRange

func (l Line) AbsoluteRange() (int, int)

func (Line) At

func (l Line) At(i int) Element

func (Line) Equals

func (l Line) Equals(e Element) bool

func (Line) Hash

func (l Line) Hash() uint64

func (Line) Join

func (l Line) Join() string

func (Line) Len

func (l Line) Len() int

func (Line) Slice

func (l Line) Slice(start, end int) Document

func (Line) String

func (l Line) String() string

type Lines

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

func NewLines

func NewLines(s string) Lines

func (Lines) AbsoluteRange

func (l Lines) AbsoluteRange() (int, int)

func (Lines) At

func (l Lines) At(i int) Element

func (Lines) Join

func (l Lines) Join() string

func (Lines) Len

func (l Lines) Len() int

func (Lines) Slice

func (l Lines) Slice(start, end int) Document

type Rune

type Rune rune

func NewRune

func NewRune(r rune) Rune

func (Rune) Equals

func (r Rune) Equals(e Element) bool

func (Rune) Hash

func (r Rune) Hash() uint64

func (Rune) String

func (r Rune) String() string

Jump to

Keyboard shortcuts

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