Check-in [e01b36769d]
Overview
Comment:Skip diagonals shorter than the current match
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e01b36769d02f7299edb71b084bb4aad79f95cdf
User & Date: spaskalev on 2014-12-14 12:11:19.001
Other Links: manifest | tags
Context
2014-12-14
20:41
Buffer stdout, use os.Args instead of flag check-in: 074a26f76b user: spaskalev tags: trunk
12:11
Skip diagonals shorter than the current match check-in: e01b36769d user: spaskalev tags: trunk
01:03
[bits] fixed package documentation [bits] added tests for the bool-backed vector [diff] added a real test, commented out the visual debug aids [plaindiff] added comments, removed commented code, added a helper []line getter [math] removed math package as it is currently unused check-in: d5adabf68e user: spaskalev tags: trunk
Changes
88
89
90
91
92
93
94
95

96
97
98
99
100
101

102
103
104
105
106
107
108
88
89
90
91
92
93
94

95
96
97
98
99
100

101
102
103
104
105
106
107
108







-
+





-
+








	return result
}

// Finds the largest common substring by looking at the provided match matrix
// starting from (bounds.x, bounds.y) with lengths bounds.lenX, bounds.lenY
func largest(bounds box, mat matrix) (result match) {
	for i := bounds.x; i < bounds.lenX; i++ {
	for i := bounds.x; i < bounds.lenX && result.length <= (bounds.lenX-bounds.x); i++ {
		var m match = search(i, bounds.y, bounds.lenX, bounds.lenY, mat)
		if m.length > result.length {
			result = m
		}
	}
	for j := bounds.y + 1; j < bounds.lenY; j++ {
	for j := bounds.y + 1; j < bounds.lenY && result.length <= (bounds.lenY-bounds.y); j++ {
		var m match = search(bounds.x, j, bounds.lenX, bounds.lenY, mat)
		if m.length > result.length {
			result = m
		}
	}
	return
}