bitset

package
Version: v0.0.0-...-e2efd09 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flatten

func Flatten(iface interface{}) [][]interface{}

Flatten generates a two-dimensional array from several Go type, including composed types and nested types. The purpose of this array is to be converted into a bitmap set.

NOTE: `struct` and `map` types MUST always be the last field of `iface`. NOTE: This function panics if a struct's field is not exported.

Types

type BitField

type BitField struct {
	// contains filtered or unexported fields
}

BitField is a `struct` exposing methods related to bit manipulation.

func NewBitField

func NewBitField(data []byte) *BitField

NewBitField returns a new `BitField`.

func (*BitField) BitCount

func (bf *BitField) BitCount() int64

BitCount returns the number of bit contained in bf.data.

func (*BitField) Pos

func (bf *BitField) Pos(idx int64) int

Pos returns the value of the bit at index `idx` in `bf.data`.

func (*BitField) PrintByte

func (bf *BitField) PrintByte(idx int64)

PrintByte displays each bit value of the specific `byte` of `bf.data` at index `idx`.

func (*BitField) WhichSet

func (bf *BitField) WhichSet(v int, limit int64) (res []int64)

WhichSet returns a slice of `[]int64` of up to `limit` values representing indexes of `bf.data` where a bit is set to `v`.

func (*BitField) WhichSetFrom

func (bf *BitField) WhichSetFrom(v int, limit, from int64) (int64, []int64)

WhichSetFrom returns a slice of `[]int64` of up to `limit` values representing indexes of `bf.data` where a bit is set to `v` and the index of the last bit processed.

func (*BitField) WhichSetInclusive

func (bf *BitField) WhichSetInclusive(idxs []string, inclusive bool) (res []int64)

WhichSetInclusive returns a slice of `[]int64` values representing indexes of `bf.data` where a bit is set to `1`. If `inclusive` is `true`, values found in `res` are composed of a subset of `idxs`. If `inclusive` is `false`, values found in `res` cannot be found in `idxs`.

type Bitset

type Bitset map[string]map[string][]int

Bitset is a structure representing a bitmap set.

func ValToBitSet

func ValToBitSet(valArrays [][]interface{}, index []string) (bs Bitset)

ValToBitSet generates a bitmap set from a two-dimensional array of `reflect.Value`. Each column name is stored in `index`.

NOTE: `index` lenght MUST be equal or longer than slice's length contained in `valArrays`.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL