github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/text/search/index.go (about) 1 // Copyright 2015 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 5 // Note: this file is identical to the file text/collate/index.go. Both files 6 // will be removed when the new colltab package is finished and in use. 7 8 package search 9 10 // tableIndex holds information for constructing a table 11 // for a certain locale based on the main table. 12 type tableIndex struct { 13 lookupOffset uint32 14 valuesOffset uint32 15 } 16 17 func (t tableIndex) TrieIndex() []uint16 { 18 return mainLookup[:] 19 } 20 21 func (t tableIndex) TrieValues() []uint32 { 22 return mainValues[:] 23 } 24 25 func (t tableIndex) FirstBlockOffsets() (lookup, value uint16) { 26 return uint16(t.lookupOffset), uint16(t.valuesOffset) 27 } 28 29 func (t tableIndex) ExpandElems() []uint32 { 30 return mainExpandElem[:] 31 } 32 33 func (t tableIndex) ContractTries() []struct{ l, h, n, i uint8 } { 34 return mainCTEntries[:] 35 } 36 37 func (t tableIndex) ContractElems() []uint32 { 38 return mainContractElem[:] 39 } 40 41 func (t tableIndex) MaxContractLen() int { 42 return 18 // TODO: generate 43 } 44 45 func (t tableIndex) VariableTop() uint32 { 46 return varTop 47 }