Documentation ¶
Index ¶
- Constants
- type Diff
- func (diff *Diff[T]) Compose()
- func (diff *Diff[T]) Editdistance() int
- func (diff *Diff[T]) FprintSes(w io.Writer)
- func (diff *Diff[T]) FprintUniHunks(w io.Writer, uniHunks []UniHunk[T])
- func (diff *Diff[T]) Lcs() []T
- func (diff *Diff[T]) OnlyEd()
- func (diff *Diff[T]) Patch(seq []T) []T
- func (diff *Diff[T]) PrintSes()
- func (diff *Diff[T]) PrintUniHunks(uniHunks []UniHunk[T])
- func (diff *Diff[T]) Ses() []SesElem[T]
- func (diff *Diff[T]) SetContextSize(n int)
- func (diff *Diff[T]) SetRouteSize(n int)
- func (diff *Diff[T]) SprintSes() string
- func (diff *Diff[T]) SprintUniHunks(uniHunks []UniHunk[T]) string
- func (diff *Diff[T]) UniPatch(seq []T, uniHunks []UniHunk[T]) ([]T, error)
- func (diff *Diff[T]) UnifiedHunks() []UniHunk[T]
- type Elem
- type Point
- type PointWithRoute
- type SesElem
- type SesType
- type UniHunk
Constants ¶
const ( PhaseFrontDiff = iota PhaseInDiff PhaseBehindDiff )
const (
DefaultContextSize = 3
)
const (
// limit of cordinate size
DefaultRouteSize = 2000000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Diff ¶
type Diff[T Elem] struct { // contains filtered or unexported fields }
Diff is context for calculating difference between a and b
func (*Diff[T]) Editdistance ¶
Editdistance returns edit distance between a and b
func (*Diff[T]) FprintUniHunks ¶
FprintUniHunks emit about unified format difference between a and b to w
func (*Diff[T]) Lcs ¶
func (diff *Diff[T]) Lcs() []T
Lcs returns LCS (Longest Common Subsequence) between a and b
func (*Diff[T]) OnlyEd ¶
func (diff *Diff[T]) OnlyEd()
OnlyEd enables to calculate only edit distance
func (*Diff[T]) Patch ¶
func (diff *Diff[T]) Patch(seq []T) []T
Patch applies SES between a and b to seq
func (*Diff[T]) PrintSes ¶
func (diff *Diff[T]) PrintSes()
PrintSes prints shortest edit script between a and b
func (*Diff[T]) PrintUniHunks ¶
PrintUniHunks prints unified format difference between and b
func (*Diff[T]) SetContextSize ¶
SetContextSize sets the context size of unified format difference
func (*Diff[T]) SetRouteSize ¶
SetRouteSize sets the context size of unified format difference
func (*Diff[T]) SprintUniHunks ¶
SprintUniHunks returns string about unified format difference between a and b
func (*Diff[T]) UnifiedHunks ¶
UnifiedHunks composes unified format difference between a and b
type Elem ¶
type Elem interface { ~rune | ~string | ~byte | ~int | ~int8 | ~int16 | ~int64 | ~float32 | ~float64 }
Type constraints for element in SES
type Point ¶
type Point struct {
// contains filtered or unexported fields
}
Point is coordinate in edit graph
type PointWithRoute ¶
type PointWithRoute struct {
// contains filtered or unexported fields
}
PointWithRoute is coordinate in edit graph attached route
type SesElem ¶
type SesElem[T Elem] struct { // contains filtered or unexported fields }
SesElem is element of SES
type UniHunk ¶
type UniHunk[T Elem] struct { // contains filtered or unexported fields }
UniHunk is an element of unified format difference
func (*UniHunk[T]) GetChanges ¶
GetChanges is getter of changes in UniHunk
func (*UniHunk[T]) SprintDiffRange ¶
SprintDiffRange returns formatted string represents difference range