aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/index/suffixarray/suffixarray.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2011-07-14 14:39:40 -0700
committerRobert Griesemer <gri@golang.org>2011-07-14 14:39:40 -0700
commit90564a92565877d19e456694ac4e2ef205720432 (patch)
tree8cb7e9ba936b3721ed7e3120e95fa419859ea20f /src/pkg/index/suffixarray/suffixarray.go
parent58e19aa4cb8656cdb757172647dfcb028029185e (diff)
downloadgo-90564a92565877d19e456694ac4e2ef205720432.tar.xz
go/printer: changed max. number of newlines from 3 to 2
manual changes in src/pkg/go/printer, src/cmd/gofix/signal_test.go (cd src/cmd/gofix/testdata; gofmt -w *.in *.out) (cd src/pkg/go/printer; gotest -update) gofmt -w misc src runs all tests R=golang-dev, rsc CC=golang-dev https://golang.org/cl/4715041
Diffstat (limited to 'src/pkg/index/suffixarray/suffixarray.go')
-rw-r--r--src/pkg/index/suffixarray/suffixarray.go7
1 files changed, 0 insertions, 7 deletions
diff --git a/src/pkg/index/suffixarray/suffixarray.go b/src/pkg/index/suffixarray/suffixarray.go
index 9d4e93217b..82e98d2ef5 100644
--- a/src/pkg/index/suffixarray/suffixarray.go
+++ b/src/pkg/index/suffixarray/suffixarray.go
@@ -22,21 +22,18 @@ import (
"sort"
)
-
// Index implements a suffix array for fast substring search.
type Index struct {
data []byte
sa []int // suffix array for data
}
-
// New creates a new Index for data.
// Index creation time is O(N*log(N)) for N = len(data).
func New(data []byte) *Index {
return &Index{data, qsufsort(data)}
}
-
// Bytes returns the data over which the index was created.
// It must not be modified.
//
@@ -44,12 +41,10 @@ func (x *Index) Bytes() []byte {
return x.data
}
-
func (x *Index) at(i int) []byte {
return x.data[x.sa[i]:]
}
-
// lookupAll returns a slice into the matching region of the index.
// The runtime is O(log(N)*len(s)).
func (x *Index) lookupAll(s []byte) []int {
@@ -61,7 +56,6 @@ func (x *Index) lookupAll(s []byte) []int {
return x.sa[i:j]
}
-
// Lookup returns an unsorted list of at most n indices where the byte string s
// occurs in the indexed data. If n < 0, all occurrences are returned.
// The result is nil if s is empty, s is not found, or n == 0.
@@ -82,7 +76,6 @@ func (x *Index) Lookup(s []byte, n int) (result []int) {
return
}
-
// FindAllIndex returns a sorted list of non-overlapping matches of the
// regular expression r, where a match is a pair of indices specifying
// the matched slice of x.Bytes(). If n < 0, all matches are returned