weighter.go 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2013 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package colltab // import "golang.org/x/text/internal/colltab"
  5. // A Weighter can be used as a source for Collator and Searcher.
  6. type Weighter interface {
  7. // Start finds the start of the segment that includes position p.
  8. Start(p int, b []byte) int
  9. // StartString finds the start of the segment that includes position p.
  10. StartString(p int, s string) int
  11. // AppendNext appends Elems to buf corresponding to the longest match
  12. // of a single character or contraction from the start of s.
  13. // It returns the new buf and the number of bytes consumed.
  14. AppendNext(buf []Elem, s []byte) (ce []Elem, n int)
  15. // AppendNextString appends Elems to buf corresponding to the longest match
  16. // of a single character or contraction from the start of s.
  17. // It returns the new buf and the number of bytes consumed.
  18. AppendNextString(buf []Elem, s string) (ce []Elem, n int)
  19. // Domain returns a slice of all single characters and contractions for which
  20. // collation elements are defined in this table.
  21. Domain() []string
  22. // Top returns the highest variable primary value.
  23. Top() uint32
  24. }