Documentation
¶
Index ¶
- Variables
- type Collection16
- type Collection8x8
- type ID16
- type ID32
- type ID8
- type Set16
- func (set16 Set16) EqualTo(another Set16) bool
- func (set16 Set16) Len() int
- func (set16 Set16) Less(i, j int) bool
- func (set16 *Set16) ReadFrom(r io.Reader) (totalBytesTaken int64, err error)
- func (set16 Set16) Sort()
- func (set16 Set16) Swap(i, j int)
- func (set16 Set16) WriteTo(w io.Writer) (n int64, err error)
- type Set8
- type Table16
- type Table8
Constants ¶
This section is empty.
Variables ¶
var ErrSet16 = fmt.Errorf("%w: set16", Error)
ErrSet16 identifies Set16 related errors.
var ErrSet8 = fmt.Errorf("%w: set8", Error)
ErrSet8 identifies Set8 related errors.
var Error = errors.New("storage")
Error identifies general sets package error's.
Functions ¶
This section is empty.
Types ¶
type Collection16 ¶
type Collection16 []Table16
Collection16 stores unique ids.Set16 items organized in Table16 storages where each storage keeps sets of same sizes. Each Collection16 item is addressable by unique ids.ID32 which consists of Table16 ID16 item index in collection and ID16 element index in Table16 item.
func (Collection16) Find ¶
func (collection8x8 Collection16) Find(item Set16) (foundIdx ID32, found bool)
Find returns 0-based index of ids.Set16 item in Collection16 array. If no such set found returns -1.
func (Collection16) Get ¶
func (collection8x8 Collection16) Get(itemIdx ID32) (Set16, bool)
Get returns set by index.
func (*Collection16) Index ¶
func (collection8x8 *Collection16) Index(item Set16) (indexedIdx ID32)
Index returns 0-based index of set in Collection8x8 array.
type Collection8x8 ¶
type Collection8x8 []Table8
Collection8x8 stores unique ids.Set8 items in Table8 items where each Table8 stores sets of same sizes. Each Collection8x8 item is addressable by unique ID16 which consists of Table8 ID8 item index in collection and ID8 element index in Table8 item.
func (Collection8x8) Find ¶
func (collection8x8 Collection8x8) Find(setItem Set8) (foundIdx ID16, found bool)
Find returns 0-based index of ids.Set8 item in Collection8x8 array. If no such set found returns -1.
func (Collection8x8) Get ¶
func (collection8x8 Collection8x8) Get(itemIdx ID16) (Set8, bool)
Get returns set by index.
func (*Collection8x8) Index ¶
func (collection8x8 *Collection8x8) Index(setItem Set8) (indexedIdx ID16)
Index returns 0-based index of set in Collection8x8 array.
type ID16 ¶
type ID16 uint16
ID16 represents uint16 index of elements.
func Combine8 ¶
Combine8 makes an ID16 value putting upper ID8 onto upper bits and lower ID8 onto lower bits.
type ID32 ¶
type ID32 uint32
ID32 represents uint32 index of elements. It wraps built-in uint32 type, providing some utilities methods.
func Combine16 ¶
Combine16 makes an ID32 value putting upper ID16 onto upper bits and lower ID16 onto lower bits.
type Set16 ¶
type Set16 []ID16
Set16 stores unique sorted ids.ID16's ids sets. Requires external implementation to provide item -> ids.ID16 and vise-versa transitions.
func (Set16) EqualTo ¶
EqualTo compares Set8 with another one. Returns true if both sets are contains the same ID8 elements or false otherwise. Note: both sets should be sorted before compare.
func (Set16) Less ¶
Less reports whether the element with index i must be placed before the element with index j. Implements sort.Interface.
func (*Set16) ReadFrom ¶
ReadFrom loads Set16 data from provided io.Reader until all data loaded or any error including EOF. Returns taken bytes count and error if occurs. Implements io.ReaderFrom.
func (Set16) Sort ¶
func (set16 Set16) Sort()
Sort is a convenience method: x.Sort() calls sort.Sort(x). Does inplace sorting of Set8 items.
type Set8 ¶
type Set8 []ID8
Set8 stores unique sorted ID8's ids sets. Requires external management to provide item-to-ID8 and vise-versa transitions.
func (Set8) EqualTo ¶
EqualTo compares Set8 with another one. Returns true if both sets are contains the same ID8 elements or false otherwise. Note: both sets should be sorted before compare.
func (Set8) Less ¶
Less reports whether the element with index i must be placed before the element with index j. Implements sort.Interface.
func (*Set8) ReadFrom ¶
ReadFrom loads Set8 data from provided io.Reader until all data loaded or any error including EOF. Returns taken bytes count and error if occurs. Implements io.ReaderFrom.
func (Set8) Sort ¶
func (set8 Set8) Sort()
Sort is a convenience method: x.Sort() calls sort.Sort(x). Does inplace sorting of Set8 items.
type Table16 ¶
type Table16 []Set16
Table16 stores unique ids.Set16 lists having equal length. It Uses its own ID16 index to address target sets.set16 stack in addition to address element in stack. Used in Collection16 to store different sized sets organized into stacks of equal-sized sets.
func (Table16) Find ¶
Find returns 0-based index of ids.Set16 in Table16 storage. If no such set found returns -1. It required sets.Set16 argument to be sorted before.
type Table8 ¶
type Table8 []Set8
Table8 stores upto 256 unique ids.Set8 lists having equal length. Used in Collection8x8 to store different sized sets organized into stacks of equal-sized sets.
func (Table8) Find ¶
Find returns 0-based index of ids.Set8 in Table8 storage. If no such set found returns -1. It required argument sets.Set8 to be sorted before.