func (s ScalarSensor) Decode(bits data.Bitset) interface{} { found := bits.Any(func(int) bool { return true }) return (0.5+float64(found))*s.BucketSize + s.MinValue }
func (s *PeriodicSensor) Decode(bits data.Bitset) interface{} { found := bits.Any(func(int) bool { return true }) if bits.IsSet(found + 2) { return found + 1 + s.First } else if bits.IsSet(found + 1) { // found is the center bit, so first. return s.First } else { // found is center bit + 1, so last. return s.Last } }
func (s *CategorySensor) Decode(bits data.Bitset) interface{} { found := bits.Any(func(int) bool { return true }) return s.reverse[found/s.W] }