code
stringlengths
114
1.05M
path
stringlengths
3
312
quality_prob
float64
0.5
0.99
learning_prob
float64
0.2
1
filename
stringlengths
3
168
kind
stringclasses
1 value
package parser import ( "RenG/src/config" "RenG/src/lang/ast" "RenG/src/lang/token" "strconv" ) func (p *Parser) parseScreenExpression() ast.Expression { exp := &ast.ScreenExpression{Token: p.curToken} p.nextToken() exp.Name = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} if !p.expectPeek(token.LBRACE) { return nil } exp.Body = p.parseBlockStatement() return exp } func (p *Parser) parseLabelExpression() ast.Expression { exp := &ast.LabelExpression{Token: p.curToken} p.nextToken() exp.Name = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} if !p.expectPeek(token.LBRACE) { return nil } exp.Body = p.parseBlockStatement() return exp } func (p *Parser) parseMenuExpression() ast.Expression { exp := &ast.MenuExpression{Token: p.curToken} if !p.expectPeek(token.LBRACE) { return nil } p.expectPeek(token.ENDSENTENCE) p.nextToken() for p.curTokenIs(token.STRING) { exp.Key = append(exp.Key, p.parseExpression(LOWEST)) if !p.expectPeek(token.LBRACE) { return nil } exp.Action = append(exp.Action, p.parseBlockStatement()) p.expectPeek(token.ENDSENTENCE) p.nextToken() } return exp } func (p *Parser) parseCallLabelExpression() ast.Expression { exp := &ast.CallLabelExpression{Token: p.curToken} p.nextToken() exp.Label = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} return exp } func (p *Parser) parseJumpLabelExpression() ast.Expression { exp := &ast.JumpLabelExpression{Token: p.curToken} p.nextToken() exp.Label = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} return exp } func (p *Parser) parseTextExpression() ast.Expression { exp := &ast.TextExpression{Token: p.curToken} p.nextToken() exp.Text = p.parseExpression(LOWEST) exp.Transform = &ast.Identifier{ Token: token.Token{ Type: token.IDENT, Literal: "IDENT", }, Value: "default", } exp.Style = &ast.Identifier{ Token: token.Token{ Type: token.IDENT, Literal: "IDENT", }, Value: "defaultStyle", } exp.Width = &ast.IntegerLiteral{ Token: token.Token{ Type: token.INT, Literal: strconv.Itoa(config.Width), }, Value: int64(config.Width), } exp.Typing = &ast.Boolean{ Token: token.Token{ Type: token.FALSE, Literal: "false", }, Value: false, } for p.expectPeek(token.AT) || p.expectPeek(token.AS) || p.expectPeek(token.LIMITWIDTH) || p.expectPeek(token.TYPINGEFFECT) { switch p.curToken.Type { case token.AT: p.nextToken() exp.Transform = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} case token.AS: p.nextToken() exp.Style = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} case token.LIMITWIDTH: p.nextToken() exp.Width = p.parseExpression(LOWEST) case token.TYPINGEFFECT: p.nextToken() exp.Typing = p.parseExpression(LOWEST) } } return exp } func (p *Parser) parseImagebuttonExpression() ast.Expression { exp := &ast.ImagebuttonExpression{Token: p.curToken} p.nextToken() exp.MainImage = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} exp.Transform = &ast.Identifier{ Token: token.Token{ Type: token.IDENT, Literal: "IDENT", }, Value: "default", } for p.expectPeek(token.AT) || p.expectPeek(token.ACTION) { switch p.curToken.Type { case token.AT: p.nextToken() exp.Transform = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} case token.ACTION: p.nextToken() exp.Action = p.parseExpression(LOWEST) } } return exp } func (p *Parser) parseTextbuttonExpression() ast.Expression { exp := &ast.TextbuttonExpression{Token: p.curToken} p.nextToken() exp.Text = p.parseExpression(LOWEST) exp.Transform = &ast.Identifier{ Token: token.Token{ Type: token.IDENT, Literal: "IDENT", }, Value: "default", } exp.Style = &ast.Identifier{ Token: token.Token{ Type: token.IDENT, Literal: "IDENT", }, Value: "defaultStyle", } for p.expectPeek(token.AT) || p.expectPeek(token.AS) || p.expectPeek(token.ACTION) { switch p.curToken.Type { case token.AT: p.nextToken() exp.Transform = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} case token.AS: p.nextToken() exp.Style = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} case token.ACTION: p.nextToken() exp.Action = p.parseExpression(LOWEST) } } return exp } func (p *Parser) parseKeyExpression() ast.Expression { exp := &ast.KeyExpression{Token: p.curToken} p.nextToken() exp.Key = p.parseExpression(LOWEST) if !p.expectPeek(token.ACTION) { return nil } p.nextToken() exp.Action = p.parseExpression(LOWEST) return exp } func (p *Parser) parseImageExpression() ast.Expression { exp := &ast.ImageExpression{Token: p.curToken} p.nextToken() exp.Name = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} if !p.expectPeek(token.ASSIGN) { return nil } p.nextToken() exp.Path = p.parseExpression(LOWEST) return exp } func (p *Parser) parseVideoExpression() ast.Expression { exp := &ast.VideoExpression{Token: p.curToken} info := make(map[string]ast.Expression) p.nextToken() exp.Name = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} if !p.expectPeek(token.LPAREN) { return nil } var arg string p.nextToken() arg = p.curToken.Literal if !p.expectPeek(token.ASSIGN) { return nil } p.nextToken() info[arg] = p.parseExpression(LOWEST) for p.peekTokenIs(token.COMMA) { p.nextToken() p.nextToken() arg = p.curToken.Literal if !p.expectPeek(token.ASSIGN) { return nil } p.nextToken() info[arg] = p.parseExpression(LOWEST) } exp.Info = info return exp } func (p *Parser) parseShowExpression() ast.Expression { exp := &ast.ShowExpression{Token: p.curToken} p.nextToken() exp.Name = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} if p.peekTokenIs(token.AT) { p.nextToken() p.nextToken() exp.Transform = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} } else { exp.Transform = &ast.Identifier{ Token: token.Token{ Type: token.IDENT, Literal: "IDENT", }, Value: "default", } } return exp } func (p *Parser) parseHideExpression() ast.Expression { exp := &ast.HideExpression{Token: p.curToken} p.nextToken() exp.Name = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} return exp } func (p *Parser) parseTranformExpression() ast.Expression { exp := &ast.TransformExpression{Token: p.curToken} p.nextToken() exp.Name = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} if !p.expectPeek(token.LBRACE) { return nil } exp.Body = p.parseBlockStatement() return exp } func (p *Parser) parseStyleExpression() ast.Expression { exp := &ast.StyleExpression{Token: p.curToken} p.nextToken() exp.Name = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} if !p.expectPeek(token.LBRACE) { return nil } exp.Body = p.parseBlockStatement() return exp } func (p *Parser) parseXposExpression() ast.Expression { exp := &ast.XPosExpression{Token: p.curToken} p.nextToken() exp.Value = p.parseExpression(LOWEST) return exp } func (p *Parser) parseYposExpression() ast.Expression { exp := &ast.YPosExpression{Token: p.curToken} p.nextToken() exp.Value = p.parseExpression(LOWEST) return exp } func (p *Parser) parseXSizeExpression() ast.Expression { exp := &ast.XSizeExpression{Token: p.curToken} p.nextToken() exp.Value = p.parseExpression(LOWEST) return exp } func (p *Parser) parseYSizeExpression() ast.Expression { exp := &ast.YSizeExpression{Token: p.curToken} p.nextToken() exp.Value = p.parseExpression(LOWEST) return exp } func (p *Parser) parseRotateExpression() ast.Expression { exp := &ast.RotateExpression{Token: p.curToken} p.nextToken() exp.Value = p.parseExpression(LOWEST) return exp } func (p *Parser) parseAlphaExpression() ast.Expression { exp := &ast.AlphaExpression{Token: p.curToken} p.nextToken() exp.Value = p.parseExpression(LOWEST) return exp } func (p *Parser) parseColorExpression() ast.Expression { exp := &ast.ColorExpression{Token: p.curToken} p.nextToken() exp.Value = p.parseExpression(LOWEST) return exp } func (p *Parser) parsePlayExpression() ast.Expression { exp := &ast.PlayExpression{Token: p.curToken} p.nextToken() exp.Channel = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} if p.expectPeek(token.IDENT) { exp.Loop = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} } else { switch exp.Channel.Value { case "music": exp.Loop = &ast.Identifier{ Token: token.Token{ Type: token.IDENT, Literal: "IDENT", }, Value: "loop", } default: exp.Loop = &ast.Identifier{ Token: token.Token{ Type: token.IDENT, Literal: "IDENT", }, Value: "noloop", } } } p.nextToken() exp.Music = p.parseExpression(LOWEST) return exp } func (p *Parser) parseStopExpression() ast.Expression { exp := &ast.StopExpression{Token: p.curToken} p.nextToken() exp.Channel = &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal} return exp } func (p *Parser) parseWhoExpression() ast.Expression { return &ast.WhoExpression{Token: p.curToken} } func (p *Parser) parseWhatExpression() ast.Expression { return &ast.WhatExpression{Token: p.curToken} } func (p *Parser) parseItemsExpression() ast.Expression { return &ast.ItemsExpression{Token: p.curToken} }
src/lang/parser/rengExpression.go
0.596433
0.484014
rengExpression.go
starcoder
package xtime import "time" const ( DateFormat = "2006-01-02" DateTimeFormat = "2006-01-02 15:04:05" ) type Time struct { time.Time } // Now return current locale time func Now() *Time { return &Time{ Time: time.Now(), } } // GetCurrentUnixTime return current unix seconds func (t *Time) CurrentUnixTime() int64 { return t.Time.Unix() } // GetCurrentMilliTime return current milliseconds func (t *Time) CurrentMilliTime() int64 { return t.Time.UnixNano() / 1e6 } // GetCurrentNanoTime return current nano seconds func (t *Time) CurrentNanoTime() int64 { return t.Time.UnixNano() } // Leap check current time is leap year or not func (t *Time) Leap() bool { return IsLeap(t.Year()) } // Format returns a textual representation of the time value formatted // according to layout func (t *Time) Format(layout string) string { return t.Time.Format(layout) } // BeginOfYear return the beginning time of current year func (t *Time) BeginOfYear() *Time { y, _, _ := t.Date() return &Time{time.Date(y, time.January, 1, 0, 0, 0, 0, t.Location())} } // EndOfYear return the end time of current year func (t *Time) EndOfYear() *Time { return &Time{t.BeginOfYear().AddDate(1, 0, 0).Add(-time.Nanosecond)} } // BeginOfMonth return begin day time of current month func (t *Time) BeginOfMonth() *Time { y, m, _ := t.Date() return &Time{time.Date(y, m, 1, 0, 0, 0, 0, t.Location())} } // EndOfMonth return end day time of current month func (t *Time) EndOfMonth() *Time { return &Time{t.BeginOfMonth().AddDate(0, 1, 0).Add(-time.Nanosecond)} } // BeginOfWeek return begin day time of current week // NOTE: week begin from Sunday func (t *Time) BeginOfWeek() *Time { y, m, d := t.AddDate(0, 0, 0-int(t.BeginOfDay().Weekday())).Date() return &Time{time.Date(y, m, d, 0, 0, 0, 0, t.Location())} } // EndOfWeek return end day time of current week // NOTE: week end with Saturday func (t *Time) EndOfWeek() *Time { y, m, d := t.BeginOfWeek().AddDate(0, 0, 7).Add(-time.Nanosecond).Date() return &Time{time.Date(y, m, d, 23, 59, 59, int(time.Second-time.Nanosecond), t.Location())} } // BeginOfDay return begin time of current day func (t *Time) BeginOfDay() *Time { y, m, d := t.Date() return &Time{time.Date(y, m, d, 0, 0, 0, 0, t.Location())} } // EndOfDay return end time of current day func (t *Time) EndOfDay() *Time { y, m, d := t.Date() return &Time{time.Date(y, m, d, 23, 59, 59, int(time.Second-time.Nanosecond), t.Location())} } // BeginOfHour return begin time of current hour func (t *Time) BeginOfHour() *Time { y, m, d := t.Date() return &Time{time.Date(y, m, d, t.Hour(), 0, 0, 0, t.Location())} } // EndOfHour return end time of current hour func (t *Time) EndOfHour() *Time { y, m, d := t.Date() return &Time{time.Date(y, m, d, t.Hour(), 59, 59, int(time.Second-time.Nanosecond), t.Location())} } // BeginOfMinute return begin second of current minute func (t *Time) BeginOfMinute() *Time { y, m, d := t.Date() return &Time{time.Date(y, m, d, t.Hour(), t.Minute(), 0, 0, t.Location())} } // EndOfMinute return end second of current minute func (t *Time) EndOfMinute() *Time { y, m, d := t.Date() return &Time{time.Date(y, m, d, t.Hour(), t.Minute(), 59, int(time.Second-time.Nanosecond), t.Location())} } // FormatUnixDate formats Unix timestamp (s) to date string func FormatUnixDate(timestamp int64) string { return time.Unix(timestamp, 0).Format(DateFormat) } // FormatUnixDateTime formats Unix timestamp (s) to time string. func FormatUnixDateTime(timestamp int64) string { return time.Unix(timestamp, 0).Format(DateTimeFormat) } // FormatMilliDate formats Unix timestamp (ms) to date string func FormatMilliDate(milliseconds int64) string { return time.Unix(0, milliseconds*1e6).Format(DateFormat) } // FormatMilliDateTime formats Unix timestamp (ms) to time string. func FormatMilliDateTime(milliseconds int64) string { return time.Unix(0, milliseconds*1e6).Format(DateTimeFormat) } // IsLeap check a leap year func IsLeap(year int) bool { return year%4 == 0 && (year%100 != 0 || year%400 == 0) }
pkg/utils/xtime/time.go
0.79799
0.470615
time.go
starcoder
package kalman import ( "math" "github.com/regnull/kalman/geo" ) const ( _LAT = 0 _LNG = 1 _ALTITUDE = 2 _VLAT = 3 _VLNG = 4 minSpeedAccuracy = 0.1 // Meters per second. incline = 5 // Degrees, used to estimate altitude random step. ) var sqrtOf2 = math.Sqrt(2) // Pre-computed to speed up computations. var inclineFactor = math.Sin(incline * math.Pi / 180.0) // Pre-computed to speed up computations. // GeoFilter is a Kalman filter that deals with geographic coordinates and altitude. type GeoFilter struct { filter *Filter } // GeoProcessNoise is used to initialize the process noise. type GeoProcessNoise struct { // Base latitude to use for computing distances. BaseLat float64 // DistancePerSecond is the expected random walk distance per second. DistancePerSecond float64 // SpeedPerSecond is the expected speed per second change. SpeedPerSecond float64 } // GeoObserved represents a single observation, in geographical coordinates and altitude. type GeoObserved struct { Lat, Lng, Altitude float64 // Geographical coordinates (in degrees) and latitude. Speed float64 // Speed, in meters per second. SpeedAccuracy float64 // Speed accuracy, in meters per second. Direction float64 // Travel direction, in degrees from North, 0 to 360 range. DirectionAccuracy float64 // Direction accuracy, in degrees. HorizontalAccuracy float64 // Horizontal accuracy, in meters. VerticalAccuracy float64 // Vertical accuracy, in meters. } // GeoEstimated contains estimated location, obtained by processing several observed locations. type GeoEstimated struct { Lat, Lng, Altitude float64 Speed float64 Direction float64 HorizontalAccuracy float64 } // NewGeoFilter creates and returns a new GeoFilter. func NewGeoFilter(d *GeoProcessNoise) (*GeoFilter, error) { metersPerDegreeLat := geo.FastMetersPerDegreeLat(d.BaseLat) metersPerDegreeLng := geo.FastMetersPerDegreeLng(d.BaseLat) dx := d.DistancePerSecond / sqrtOf2 / metersPerDegreeLat dy := d.DistancePerSecond / sqrtOf2 / metersPerDegreeLng dz := d.DistancePerSecond * inclineFactor dsvx := d.SpeedPerSecond / sqrtOf2 / metersPerDegreeLat dsvy := d.SpeedPerSecond / sqrtOf2 / metersPerDegreeLng dsvz := d.SpeedPerSecond * inclineFactor f, err := NewFilter(&ProcessNoise{ ST: 1.0, SX: dx, SY: dy, SZ: dz, SVX: dsvx, SVY: dsvy, SVZ: dsvz}) if err != nil { return nil, err } return &GeoFilter{filter: f}, nil } func (g *GeoFilter) Observe(td float64, ob *GeoObserved) error { metersPerDegreeLat := geo.FastMetersPerDegreeLat(ob.Lat) metersPerDegreeLng := geo.FastMetersPerDegreeLng(ob.Lat) directionRad := ob.Direction * math.Pi / 180.0 directionRadAccuracy := ob.DirectionAccuracy * math.Pi / 180.0 speedLat := ob.Speed * math.Cos(directionRad) / metersPerDegreeLat speedLng := ob.Speed * math.Sin(directionRad) / metersPerDegreeLng ob1 := &Observed{ X: ob.Lat, Y: ob.Lng, Z: ob.Altitude, VX: speedLat, VY: speedLng, VZ: 0.0, // There is no way to estimate vertical speed. XA: ob.HorizontalAccuracy / metersPerDegreeLat, YA: ob.HorizontalAccuracy / metersPerDegreeLng, ZA: ob.VerticalAccuracy, VXA: speedLatAccuracy(ob.Speed, ob.SpeedAccuracy, directionRad, directionRadAccuracy, metersPerDegreeLat), VYA: speedLngAccuracy(ob.Speed, ob.SpeedAccuracy, directionRad, directionRadAccuracy, metersPerDegreeLng), VZA: minSpeedAccuracy, } return g.filter.Observe(td, ob1) } // Estimate returns the best location estimate. func (g *GeoFilter) Estimate() *GeoEstimated { if g.filter.state == nil { return nil } lat := g.filter.state.AtVec(_LAT) metersPerDegreeLat := geo.FastMetersPerDegreeLat(lat) metersPerDegreeLng := geo.FastMetersPerDegreeLng(lat) speedLatMeters := g.filter.state.AtVec(_VLAT) * metersPerDegreeLat speedLngMeters := g.filter.state.AtVec(_VLNG) * metersPerDegreeLng speed := math.Sqrt(speedLatMeters*speedLatMeters + speedLngMeters*speedLngMeters) haLatSquared := g.filter.cov.At(_LAT, _LAT) * metersPerDegreeLat * metersPerDegreeLat haLngSquared := g.filter.cov.At(_LNG, _LNG) * metersPerDegreeLng * metersPerDegreeLng ha := math.Max(math.Sqrt(haLatSquared), math.Sqrt(haLngSquared)) return &GeoEstimated{ Lat: g.filter.state.AtVec(_LAT), Lng: g.filter.state.AtVec(_LNG), Altitude: g.filter.state.AtVec(_ALTITUDE), Speed: speed, HorizontalAccuracy: ha, } } func speedLatAccuracy(speed float64, speedAccuracy float64, directionRad float64, directionRadAccuracy float64, metersPerDegreeLat float64) float64 { ds := math.Cos(directionRad) / metersPerDegreeLat * speedAccuracy dr := -speed * math.Sin(directionRad) / metersPerDegreeLat * directionRadAccuracy return math.Max(math.Sqrt(ds*ds+dr*dr), minSpeedAccuracy/metersPerDegreeLat) } func speedLngAccuracy(speed float64, speedAccuracy float64, directionRad float64, directionRadAccuracy float64, metersPerDegreeLng float64) float64 { ds := math.Sin(directionRad) / metersPerDegreeLng * speedAccuracy dr := speed * math.Cos(directionRad) / metersPerDegreeLng * directionRadAccuracy return math.Max(math.Sqrt(ds*ds+dr*dr), minSpeedAccuracy/metersPerDegreeLng) }
geo_filter.go
0.821653
0.611179
geo_filter.go
starcoder
package stats import ( "time" "github.com/blend/go-sdk/timeutil" ) // Assert that the mock collector implements Collector. var ( _ Collector = (*MockCollector)(nil) ) // NewMockCollector returns a new mock collector. func NewMockCollector(capacity int) *MockCollector { return &MockCollector{ Metrics: make(chan MockMetric, capacity), Errors: make(chan error, capacity), FlushErrors: make(chan error, capacity), CloseErrors: make(chan error, capacity), } } // MockCollector is a mocked collector for stats. type MockCollector struct { Field struct { Namespace string DefaultTags []string } Metrics chan MockMetric Errors chan error FlushErrors chan error CloseErrors chan error } // AllMetrics returns all the metrics from the collector. func (mc *MockCollector) AllMetrics() (output []MockMetric) { metricCount := len(mc.Metrics) for x := 0; x < metricCount; x++ { output = append(output, <-mc.Metrics) } return } // GetCount returns the number of events logged for a given metric name. func (mc *MockCollector) GetCount(metricName string) (count int) { var metric MockMetric metricCount := len(mc.Metrics) for x := 0; x < metricCount; x++ { metric = <-mc.Metrics if metric.Name == metricName { count++ } mc.Metrics <- metric } return } func (mc *MockCollector) makeName(name string) string { if mc.Field.Namespace != "" { return mc.Field.Namespace + name } return name } // AddDefaultTag adds a default tag. func (mc *MockCollector) AddDefaultTag(name, value string) { mc.Field.DefaultTags = append(mc.Field.DefaultTags, Tag(name, value)) } // AddDefaultTags adds default tags. func (mc *MockCollector) AddDefaultTags(tags ...string) { mc.Field.DefaultTags = append(mc.Field.DefaultTags, tags...) } // DefaultTags returns the default tags set. func (mc MockCollector) DefaultTags() []string { return mc.Field.DefaultTags } // Count adds a mock count event to the event stream. func (mc MockCollector) Count(name string, value int64, tags ...string) error { mc.Metrics <- MockMetric{Name: mc.makeName(name), Count: value, Tags: append(mc.Field.DefaultTags, tags...)} if len(mc.Errors) > 0 { return <-mc.Errors } return nil } // Increment adds a mock count event to the event stream with value (1). func (mc MockCollector) Increment(name string, tags ...string) error { mc.Metrics <- MockMetric{Name: mc.makeName(name), Count: 1, Tags: append(mc.Field.DefaultTags, tags...)} if len(mc.Errors) > 0 { return <-mc.Errors } return nil } // Gauge adds a mock count event to the event stream with value (1). func (mc MockCollector) Gauge(name string, value float64, tags ...string) error { mc.Metrics <- MockMetric{Name: mc.makeName(name), Gauge: value, Tags: append(mc.Field.DefaultTags, tags...)} if len(mc.Errors) > 0 { return <-mc.Errors } return nil } // Histogram adds a mock count event to the event stream with value (1). func (mc MockCollector) Histogram(name string, value float64, tags ...string) error { mc.Metrics <- MockMetric{Name: mc.makeName(name), Histogram: value, Tags: append(mc.Field.DefaultTags, tags...)} if len(mc.Errors) > 0 { return <-mc.Errors } return nil } // Distribution adds a mock count event to the event stream with value (1). func (mc MockCollector) Distribution(name string, value float64, tags ...string) error { mc.Metrics <- MockMetric{Name: mc.makeName(name), Distribution: value, Tags: append(mc.Field.DefaultTags, tags...)} if len(mc.Errors) > 0 { return <-mc.Errors } return nil } // TimeInMilliseconds adds a mock time in millis event to the event stream with a value. func (mc MockCollector) TimeInMilliseconds(name string, value time.Duration, tags ...string) error { mc.Metrics <- MockMetric{Name: mc.makeName(name), TimeInMilliseconds: timeutil.Milliseconds(value), Tags: append(mc.Field.DefaultTags, tags...)} if len(mc.Errors) > 0 { return <-mc.Errors } return nil } // Flush does nothing on a MockCollector. func (mc MockCollector) Flush() error { if len(mc.FlushErrors) > 0 { return <-mc.FlushErrors } return nil } // Close returns an error from the errors channel if any. func (mc MockCollector) Close() error { if len(mc.CloseErrors) > 0 { return <-mc.CloseErrors } return nil } // MockMetric is a mock metric. type MockMetric struct { Name string Count int64 Gauge float64 Histogram float64 Distribution float64 TimeInMilliseconds float64 Tags []string }
stats/mock_collector.go
0.880013
0.505432
mock_collector.go
starcoder
package query import ( "errors" "fmt" "github.com/Peripli/service-manager/pkg/types" "github.com/Peripli/service-manager/pkg/util" "github.com/tidwall/gjson" ) // LabelOperation is an operation to be performed on labels type LabelOperation string const ( // AddLabelOperation takes a label and adds it to the entity's labels AddLabelOperation LabelOperation = "add" // AddLabelValuesOperation takes a key and values and adds the values to the label with this key AddLabelValuesOperation LabelOperation = "add_values" // RemoveLabelOperation takes a key and removes the label with this key RemoveLabelOperation LabelOperation = "remove" // RemoveLabelValuesOperation takes a key and values and removes the values from the label with this key RemoveLabelValuesOperation LabelOperation = "remove_values" ) // RequiresValues returns true if the operation requires values to be provided func (o LabelOperation) RequiresValues() bool { return o != RemoveLabelOperation } // LabelChange represents the changes that should be performed to a label type LabelChange struct { Operation LabelOperation `json:"op"` Key string `json:"key"` Values []string `json:"values"` } func (lc *LabelChange) Validate() error { if lc.Operation.RequiresValues() && len(lc.Values) == 0 { return fmt.Errorf("operation %s requires values to be provided", lc.Operation) } if lc.Key == "" || lc.Operation == "" { return errors.New("both key and operation are missing but are required for label change") } return nil } type LabelChanges []*LabelChange func (lc *LabelChanges) Validate() error { for _, labelChange := range *lc { if err := labelChange.Validate(); err != nil { return err } } return nil } // LabelChangesFromJSON returns the label changes from the json byte array and an error if the changes are not valid func LabelChangesFromJSON(jsonBytes []byte) ([]*LabelChange, error) { labelChanges := LabelChanges{} labelChangesBytes := gjson.GetBytes(jsonBytes, "labels").String() if len(labelChangesBytes) <= 0 { return LabelChanges{}, nil } if err := util.BytesToObject([]byte(labelChangesBytes), &labelChanges); err != nil { return nil, err } for _, v := range labelChanges { if v.Operation == RemoveLabelOperation { v.Values = nil } } return labelChanges, nil } // ApplyLabelChangesToLabels applies the specified label changes to the specified labels func ApplyLabelChangesToLabels(changes LabelChanges, labels types.Labels) (types.Labels, types.Labels, types.Labels) { mergedLabels, labelsToAdd, labelsToRemove := types.Labels{}, types.Labels{}, types.Labels{} for k, v := range labels { mergedLabels[k] = v } for _, change := range changes { switch change.Operation { case AddLabelOperation: fallthrough case AddLabelValuesOperation: for _, value := range change.Values { found := false for _, currentValue := range mergedLabels[change.Key] { if currentValue == value { found = true break } } if !found { labelsToAdd[change.Key] = append(labelsToAdd[change.Key], value) mergedLabels[change.Key] = append(mergedLabels[change.Key], value) } } case RemoveLabelOperation: fallthrough case RemoveLabelValuesOperation: if len(change.Values) == 0 { labelsToRemove[change.Key] = labels[change.Key] delete(mergedLabels, change.Key) } else { labelsToRemove[change.Key] = append(labelsToRemove[change.Key], change.Values...) for _, valueToRemove := range change.Values { for i, value := range mergedLabels[change.Key] { if value == valueToRemove { mergedLabels[change.Key] = append(mergedLabels[change.Key][:i], mergedLabels[change.Key][i+1:]...) if len(mergedLabels[change.Key]) == 0 { delete(mergedLabels, change.Key) } } } } } } } return mergedLabels, labelsToAdd, labelsToRemove }
pkg/query/update.go
0.741674
0.414425
update.go
starcoder
package models import ( i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // AttackSimulationRepeatOffender type AttackSimulationRepeatOffender struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. additionalData map[string]interface{} // User in an attack simulation and training campaign. attackSimulationUser AttackSimulationUserable // Number of repeat offences of the user in attack simulation and training campaigns. repeatOffenceCount *int32 } // NewAttackSimulationRepeatOffender instantiates a new attackSimulationRepeatOffender and sets the default values. func NewAttackSimulationRepeatOffender()(*AttackSimulationRepeatOffender) { m := &AttackSimulationRepeatOffender{ } m.SetAdditionalData(make(map[string]interface{})); return m } // CreateAttackSimulationRepeatOffenderFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value func CreateAttackSimulationRepeatOffenderFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { return NewAttackSimulationRepeatOffender(), nil } // GetAdditionalData gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. func (m *AttackSimulationRepeatOffender) GetAdditionalData()(map[string]interface{}) { if m == nil { return nil } else { return m.additionalData } } // GetAttackSimulationUser gets the attackSimulationUser property value. User in an attack simulation and training campaign. func (m *AttackSimulationRepeatOffender) GetAttackSimulationUser()(AttackSimulationUserable) { if m == nil { return nil } else { return m.attackSimulationUser } } // GetFieldDeserializers the deserialization information for the current model func (m *AttackSimulationRepeatOffender) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) res["attackSimulationUser"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetObjectValue(CreateAttackSimulationUserFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetAttackSimulationUser(val.(AttackSimulationUserable)) } return nil } res["repeatOffenceCount"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetInt32Value() if err != nil { return err } if val != nil { m.SetRepeatOffenceCount(val) } return nil } return res } // GetRepeatOffenceCount gets the repeatOffenceCount property value. Number of repeat offences of the user in attack simulation and training campaigns. func (m *AttackSimulationRepeatOffender) GetRepeatOffenceCount()(*int32) { if m == nil { return nil } else { return m.repeatOffenceCount } } // Serialize serializes information the current object func (m *AttackSimulationRepeatOffender) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { { err := writer.WriteObjectValue("attackSimulationUser", m.GetAttackSimulationUser()) if err != nil { return err } } { err := writer.WriteInt32Value("repeatOffenceCount", m.GetRepeatOffenceCount()) if err != nil { return err } } { err := writer.WriteAdditionalData(m.GetAdditionalData()) if err != nil { return err } } return nil } // SetAdditionalData sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. func (m *AttackSimulationRepeatOffender) SetAdditionalData(value map[string]interface{})() { if m != nil { m.additionalData = value } } // SetAttackSimulationUser sets the attackSimulationUser property value. User in an attack simulation and training campaign. func (m *AttackSimulationRepeatOffender) SetAttackSimulationUser(value AttackSimulationUserable)() { if m != nil { m.attackSimulationUser = value } } // SetRepeatOffenceCount sets the repeatOffenceCount property value. Number of repeat offences of the user in attack simulation and training campaigns. func (m *AttackSimulationRepeatOffender) SetRepeatOffenceCount(value *int32)() { if m != nil { m.repeatOffenceCount = value } }
models/attack_simulation_repeat_offender.go
0.663778
0.501221
attack_simulation_repeat_offender.go
starcoder
package trie type trieNode struct { isEnd bool next map[rune]*trieNode } type Trie struct { nodes map[rune]*trieNode } /** Initialize your data structure here. */ func NewTrie() Trie { return Trie{ nodes: make(map[rune]*trieNode, 0), } } /** Inserts a word into the trie. */ func (this *Trie) Insert(word string) { if len(word) == 0 { return } b := rune(word[0]) if node, exist := this.nodes[b]; exist { this.insert(word[1:], node) } else { n := this.nodes for i, v := range word { n[v] = &trieNode{next: make(map[rune]*trieNode, 0)} if i == len(word)-1 { n[v].isEnd = true } n = n[v].next } } } func (this *Trie) insert(word string, node *trieNode) { if len(word) == 0 { node.isEnd = true return } b := rune(word[0]) if val, exist := node.next[b]; exist { this.insert(word[1:], val) } else { n := node for i, v := range word { insertNode := &trieNode{next: make(map[rune]*trieNode, 0)} if i == len(word)-1 { insertNode.isEnd = true } n.next[v] = insertNode n = insertNode } } } /** Returns if the word is in the trie. */ func (this *Trie) Search(word string) bool { if len(word) == 0 { return false } return this.search(word[1:], this.nodes[rune(word[0])]) } func (this *Trie) search(word string, node *trieNode) bool { if node == nil { return false } if len(word) == 0 && !node.isEnd { return false } else if len(word) == 0 && node.isEnd { return true } return this.search(word[1:], node.next[rune(word[0])]) } /** Returns if there is any word in the trie that starts with the given prefix. */ func (this *Trie) StartsWith(prefix string) bool { if len(prefix) == 0 { return false } return this.startWith(prefix[1:], this.nodes[rune(prefix[0])]) } func (this *Trie) startWith(prefix string, node *trieNode) bool { if node == nil { return false } if len(prefix) == 0 { return true } return this.startWith(prefix[1:], node.next[rune(prefix[0])]) } /** * Your Trie object will be instantiated and called as such: * obj := Constructor(); * obj.Insert(word); * param_2 := obj.Search(word); * param_3 := obj.StartsWith(prefix); */
trie/trie.go
0.617974
0.662442
trie.go
starcoder
package primitive import ( "errors" "fmt" "io" ) type ValueType = int32 const ( ValueTypeRegular = ValueType(0) ValueTypeNull = ValueType(-1) ValueTypeUnset = ValueType(-2) ) // Value models the [value] protocol primitive structure type Value struct { Type ValueType Contents []byte } func NewValue(contents []byte) *Value { if contents == nil { return &Value{Type: ValueTypeNull} } else { return &Value{Type: ValueTypeRegular, Contents: contents} } } func NewNullValue() *Value { return NewValue(nil) } func NewUnsetValue() *Value { return &Value{Type: ValueTypeUnset} } func (v *Value) Clone() *Value { var newContents []byte if v.Contents != nil { newContents = make([]byte, len(v.Contents)) copy(newContents, v.Contents) } else { newContents = nil } return &Value{ Type: v.Type, Contents: newContents, } } // [value] func ReadValue(source io.Reader, version ProtocolVersion) (*Value, error) { if length, err := ReadInt(source); err != nil { return nil, fmt.Errorf("cannot read [value] length: %w", err) } else if length == ValueTypeNull { return NewNullValue(), nil } else if length == ValueTypeUnset { if version < ProtocolVersion4 { return nil, fmt.Errorf("cannot use unset value with %v", version) } return NewUnsetValue(), nil } else if length < 0 { return nil, fmt.Errorf("invalid [value] length: %v", length) } else if length == 0 { return NewValue([]byte{}), nil } else { decoded := make([]byte, length) if read, err := source.Read(decoded); err != nil { return nil, fmt.Errorf("cannot read [value] content: %w", err) } else if read != int(length) { return nil, errors.New("not enough bytes to read [value] content") } return NewValue(decoded), nil } } func WriteValue(value *Value, dest io.Writer, version ProtocolVersion) error { if value == nil { return errors.New("cannot write a nil [value]") } switch value.Type { case ValueTypeNull: return WriteInt(ValueTypeNull, dest) case ValueTypeUnset: if !version.SupportsUnsetValues() { return fmt.Errorf("cannot use unset value with %v", version) } return WriteInt(ValueTypeUnset, dest) case ValueTypeRegular: if value.Contents == nil { return WriteInt(ValueTypeNull, dest) } else { length := len(value.Contents) if err := WriteInt(int32(length), dest); err != nil { return fmt.Errorf("cannot write [value] length: %w", err) } else if n, err := dest.Write(value.Contents); err != nil { return fmt.Errorf("cannot write [value] content: %w", err) } else if n < length { return errors.New("not enough capacity to write [value] content") } return nil } default: return fmt.Errorf("unknown [value] type: %v", value.Type) } } func LengthOfValue(value *Value) (int, error) { if value == nil { return -1, errors.New("cannot compute length of a nil [value]") } switch value.Type { case ValueTypeNull: return LengthOfInt, nil case ValueTypeUnset: return LengthOfInt, nil case ValueTypeRegular: return LengthOfInt + len(value.Contents), nil default: return -1, fmt.Errorf("unknown [value] type: %v", value.Type) } } // positional [value]s func ReadPositionalValues(source io.Reader, version ProtocolVersion) ([]*Value, error) { if length, err := ReadShort(source); err != nil { return nil, fmt.Errorf("cannot read positional [value]s length: %w", err) } else { decoded := make([]*Value, length) for i := uint16(0); i < length; i++ { if value, err := ReadValue(source, version); err != nil { return nil, fmt.Errorf("cannot read positional [value]s element %d content: %w", i, err) } else { decoded[i] = value } } return decoded, nil } } func WritePositionalValues(values []*Value, dest io.Writer, version ProtocolVersion) error { length := len(values) if err := WriteShort(uint16(length), dest); err != nil { return fmt.Errorf("cannot write positional [value]s length: %w", err) } for i, value := range values { if err := WriteValue(value, dest, version); err != nil { return fmt.Errorf("cannot write positional [value]s element %d content: %w", i, err) } } return nil } func LengthOfPositionalValues(values []*Value) (length int, err error) { length += LengthOfShort for i, value := range values { var valueLength int valueLength, err = LengthOfValue(value) if err != nil { return -1, fmt.Errorf("cannot compute length of positional [value] %d: %w", i, err) } length += valueLength } return length, nil } // named [value]s func ReadNamedValues(source io.Reader, version ProtocolVersion) (map[string]*Value, error) { if length, err := ReadShort(source); err != nil { return nil, fmt.Errorf("cannot read named [value]s length: %w", err) } else { decoded := make(map[string]*Value, length) for i := uint16(0); i < length; i++ { if name, err := ReadString(source); err != nil { return nil, fmt.Errorf("cannot read named [value]s entry %d name: %w", i, err) } else if value, err := ReadValue(source, version); err != nil { return nil, fmt.Errorf("cannot read named [value]s entry %d content: %w", i, err) } else { decoded[name] = value } } return decoded, nil } } func WriteNamedValues(values map[string]*Value, dest io.Writer, version ProtocolVersion) error { length := len(values) if err := WriteShort(uint16(length), dest); err != nil { return fmt.Errorf("cannot write named [value]s length: %w", err) } for name, value := range values { if err := WriteString(name, dest); err != nil { return fmt.Errorf("cannot write named [value]s entry '%v' name: %w", name, err) } if err := WriteValue(value, dest, version); err != nil { return fmt.Errorf("cannot write named [value]s entry '%v' content: %w", name, err) } } return nil } func LengthOfNamedValues(values map[string]*Value) (length int, err error) { length += LengthOfShort for name, value := range values { var nameLength = LengthOfString(name) var valueLength int valueLength, err = LengthOfValue(value) if err != nil { return -1, fmt.Errorf("cannot compute length of named [value]s: %w", err) } length += nameLength length += valueLength } return length, nil }
primitive/values.go
0.639736
0.446072
values.go
starcoder
package pulse import "math" type FindNumberFunc func(n Number, prevDelta, nextDelta uint16) bool type Range interface { // Left bound of the range. It may be an expected pulse. LeftPrevDelta() uint16 LeftBoundNumber() Number // Right bound of the range. MUST be a valid pulse data. RightBoundData() Data // Indicates that this range requires articulated pulses to be properly chained. IsArticulated() bool // Indicates that this range is a singular and contains only one pulse. IsSingular() bool // Iterates over both provided and articulated pulses within the range. EnumNumbers(fn FindNumberFunc) bool // Iterates over both provided and articulated pulse data within the range. EnumData(func(Data) bool) bool // Iterates only over the provided pulse data within the range. EnumNonArticulatedData(func(Data) bool) bool // Return true then the given range is next immediate range IsValidNext(Range) bool // Return true then the given range is prev immediate range IsValidPrev(Range) bool } // Creates a range that covers a gap between the last expected pulse and the last available one. // Will panic when pulse are overlapping and can't be properly connected. // Supports gaps with delta > 65535 func NewLeftGapRange(left Number, leftPrevDelta uint16, right Data) Range { right.EnsurePulseData() switch { case left == right.PulseNumber: if leftPrevDelta == right.PrevPulseDelta { return right.AsRange() } case left.IsBeforeOrEq(right.PrevPulseNumber()): left.Prev(leftPrevDelta) // ensure correctness return gapPulseRange{start: left, prevDelta: leftPrevDelta, end: right} } panic("illegal value") } // Creates a range that consists of >0 properly connected pulses. // Sequence MUST be sorted, all pulses must be connected, otherwise use NewPulseRange() // Will panic when pulse are overlapping and can't be properly connected. // Supports gaps with delta > 65535 func NewSequenceRange(data []Data) Range { switch { case len(data) == 0: panic("illegal value") case len(data) == 1: return data[0].AsRange() case checkSequence(data): return seqPulseRange{data: append([]Data(nil), data...)} } panic("illegal value") } // Creates a range that consists of both connected and disconnected pulses. // Sequence MUST be sorted, an expected pulse is allowed at [0] // Will panic when pulse are overlapping and can't be properly connected. // Supports gaps with delta > 65535 func NewPulseRange(data []Data) Range { switch { case len(data) == 0: panic("illegal value") case len(data) == 1: return data[0].AsRange() case !data[0].isExpected(): if checkSequence(data) { return seqPulseRange{data: append([]Data(nil), data...)} } case data[1].PrevPulseNumber() < data[0].PulseNumber || !data[0].IsValidExpectedPulseData(): panic("illegal value") case len(data) == 2: return NewLeftGapRange(data[0].PulseNumber, data[0].PrevPulseDelta, data[1]) default: checkSequence(data[1:]) } return sparsePulseRange{data: append([]Data(nil), data...)} } func checkSequence(data []Data) bool { sequence := true for i, d := range data { d.EnsurePulseData() if i == 0 { continue } prev := &data[i-1] switch { case prev.IsValidNext(d): case prev.NextPulseNumber() > d.PrevPulseNumber(): panic("illegal value - unordered or intersecting pulses") default: sequence = false } } return sequence } /* ===================================================== */ var _ Range = onePulseRange{} type onePulseRange struct { data Data } func (p onePulseRange) IsValidNext(a Range) bool { if p.data.NextPulseDelta != a.LeftPrevDelta() { return false } if n, ok := p.data.GetNextPulseNumber(); ok { return n == a.LeftBoundNumber() } return false } func (p onePulseRange) IsValidPrev(a Range) bool { return a.IsValidNext(p) } func (p onePulseRange) EnumNumbers(fn FindNumberFunc) bool { return fn(p.data.PulseNumber, p.data.PrevPulseDelta, p.data.NextPulseDelta) } func (p onePulseRange) EnumData(fn func(Data) bool) bool { return fn(p.data) } func (p onePulseRange) EnumNonArticulatedData(fn func(Data) bool) bool { return fn(p.data) } func (p onePulseRange) RightBoundData() Data { return p.data } func (p onePulseRange) IsSingular() bool { return true } func (p onePulseRange) IsArticulated() bool { return false } func (p onePulseRange) LeftBoundNumber() Number { return p.data.PulseNumber } func (p onePulseRange) LeftPrevDelta() uint16 { return p.data.PrevPulseDelta } /* ===================================================== */ type templatePulseRange struct { } func (p templatePulseRange) IsSingular() bool { return false } var _ Range = gapPulseRange{} type gapPulseRange struct { templatePulseRange start Number prevDelta uint16 end Data } func (p gapPulseRange) IsValidNext(a Range) bool { if p.end.NextPulseDelta != a.LeftPrevDelta() { return false } if n, ok := p.end.GetNextPulseNumber(); ok { return n == a.LeftBoundNumber() } return false } func (p gapPulseRange) IsValidPrev(a Range) bool { return a.IsValidNext(p) } func (p gapPulseRange) EnumNumbers(fn FindNumberFunc) bool { if _enumSegments(p.start, p.prevDelta, p.end.PrevPulseNumber(), p.end.PrevPulseDelta, fn) { return true } return fn(p.end.PulseNumber, p.end.PrevPulseDelta, p.end.NextPulseDelta) } func (p gapPulseRange) EnumData(fn func(Data) bool) bool { return _enumSegmentData(p.start, p.prevDelta, p.end, fn) } func (p gapPulseRange) EnumNonArticulatedData(fn func(Data) bool) bool { return fn(p.end) } func (p gapPulseRange) LeftPrevDelta() uint16 { return p.prevDelta } func (p gapPulseRange) LeftBoundNumber() Number { return p.start } func (p gapPulseRange) RightBoundData() Data { return p.end } func (p gapPulseRange) IsArticulated() bool { return true } /* ===================================================== */ var _ Range = seqPulseRange{} type seqPulseRange struct { templatePulseRange data []Data } func (p seqPulseRange) IsValidNext(a Range) bool { end := p.RightBoundData() if end.NextPulseDelta != a.LeftPrevDelta() { return false } if n, ok := end.GetNextPulseNumber(); ok { return n == a.LeftBoundNumber() } return false } func (p seqPulseRange) IsValidPrev(a Range) bool { return a.IsValidNext(p) } func (p seqPulseRange) EnumNumbers(fn FindNumberFunc) bool { for _, d := range p.data { if fn(d.PulseNumber, d.PrevPulseDelta, d.NextPulseDelta) { return true } } return false } func (p seqPulseRange) EnumData(fn func(Data) bool) bool { for _, d := range p.data { if fn(d) { return true } } return false } func (p seqPulseRange) EnumNonArticulatedData(fn func(Data) bool) bool { for _, d := range p.data { if fn(d) { return true } } return false } func (p seqPulseRange) IsArticulated() bool { return false } func (p seqPulseRange) LeftPrevDelta() uint16 { return p.data[0].PrevPulseDelta } func (p seqPulseRange) LeftBoundNumber() Number { return p.data[0].PulseNumber } func (p seqPulseRange) RightBoundData() Data { return p.data[len(p.data)-1] } /* ===================================================== */ var _ Range = sparsePulseRange{} type sparsePulseRange struct { templatePulseRange data []Data } func (p sparsePulseRange) IsValidNext(a Range) bool { end := p.RightBoundData() if end.NextPulseDelta != a.LeftPrevDelta() { return false } if n, ok := end.GetNextPulseNumber(); ok { return n == a.LeftBoundNumber() } return false } func (p sparsePulseRange) IsValidPrev(a Range) bool { return a.IsValidNext(p) } func (p sparsePulseRange) EnumNumbers(fn FindNumberFunc) bool { var ( next Number prevDelta uint16 ) switch first := p.data[0]; { case first.NextPulseDelta == 0: // expected pulse next, prevDelta = first.PulseNumber, first.PrevPulseDelta default: next, prevDelta = first.NextPulseNumber(), first.NextPulseDelta fn(first.PulseNumber, first.PrevPulseDelta, first.NextPulseDelta) } for _, d := range p.data[1:] { switch { case next == d.PulseNumber: if _enumSegments(next, prevDelta, d.PulseNumber, d.NextPulseDelta, fn) { return true } case _enumSegments(next, prevDelta, d.PrevPulseNumber(), d.PrevPulseDelta, fn): return true case fn(d.PulseNumber, d.PrevPulseDelta, d.NextPulseDelta): return true } next, prevDelta = d.NextPulseNumber(), d.NextPulseDelta } return false } func (p sparsePulseRange) EnumData(fn func(Data) bool) bool { var ( next Number prevDelta uint16 ) switch first := p.data[0]; { case first.NextPulseDelta == 0: // expected pulse next, prevDelta = first.PulseNumber, first.PrevPulseDelta default: next, prevDelta = first.NextPulseNumber(), first.NextPulseDelta fn(first) } for _, d := range p.data[1:] { if _enumSegmentData(next, prevDelta, d, fn) { return true } next, prevDelta = d.NextPulseNumber(), d.NextPulseDelta } return false } func (p sparsePulseRange) EnumNonArticulatedData(fn func(Data) bool) bool { startIdx := 0 if p.data[0].NextPulseDelta == 0 { startIdx++ } for _, d := range p.data[startIdx:] { if fn(d) { return true } } return false } func (p sparsePulseRange) IsArticulated() bool { return true } func (p sparsePulseRange) LeftPrevDelta() uint16 { return p.data[0].PrevPulseDelta } func (p sparsePulseRange) LeftBoundNumber() Number { return p.data[0].PulseNumber } func (p sparsePulseRange) RightBoundData() Data { return p.data[len(p.data)-1] } /* ===================================================== */ const minSegmentPulseDelta = 10 func _enumSegmentData(start Number, prevDelta uint16, end Data, fn func(Data) bool) bool { if start != end.PulseNumber && _enumSegments(start, prevDelta, end.PrevPulseNumber(), end.PrevPulseDelta, func(n Number, prevDelta, nextDelta uint16) bool { return fn(Data{ n, DataExt{ PulseEpoch: ArticulationPulseEpoch, NextPulseDelta: nextDelta, PrevPulseDelta: prevDelta, }}) }) { return true } return fn(end) } func _enumSegments(next Number, prevDelta uint16, end Number, endNextDelta uint16, fn FindNumberFunc) bool { for { switch { case next < end: delta := end - next switch { case delta <= math.MaxUint16: case delta < math.MaxUint16+minSegmentPulseDelta: delta -= minSegmentPulseDelta default: delta = math.MaxUint16 } if fn(next, prevDelta, uint16(delta)) { return true } prevDelta = uint16(delta) next = next.Next(prevDelta) continue case next == end: return fn(next, prevDelta, endNextDelta) default: panic("illegal state") } } }
pulse/pulse_range.go
0.795499
0.707986
pulse_range.go
starcoder
package layout import ( "github.com/lysrt/bro/css" "github.com/lysrt/bro/style" ) const ( BlockNode BoxType = iota InlineNode AnonymousBlock ) type BoxType int // LayoutBox is the building block of the layout tree, associated to one StyleNode type LayoutBox struct { // Dimensions is the box position, size, margin, padding and border Dimensions Dimensions // BoxType is the type of the box (inline, block, anonymous) BoxType BoxType // StyleNode holds the style node wrapped by this layout node StyledNode *style.StyledNode // Children of this node, in the layout tree, following the structure of the style tree Children []*LayoutBox } // Dimensions represents the position, size, margin, padding and border of a layout box type Dimensions struct { // Content represents the position and size of the content area relative to the document origin: Content Rect // Surrounding edges: padding, Border, margin EdgeSizes } // Rect represents the position and size of a box on the screen type Rect struct { X, Y, Width, Height float64 } // EdgeSizes is a placeholder for four float values type EdgeSizes struct { Left, Right, Top, Bottom float64 } // marginBox returns the area covered by the content area plus padding, borders, and margin func (d Dimensions) marginBox() Rect { return d.BorderBox().expandedBy(d.margin) } // BorderBox returns the area covered by the content area plus padding and borders func (d Dimensions) BorderBox() Rect { return d.paddingBox().expandedBy(d.Border) } // paddingBox returns the area covered by the content area plus its padding func (d Dimensions) paddingBox() Rect { return d.Content.expandedBy(d.padding) } func (r Rect) expandedBy(edge EdgeSizes) Rect { return Rect{ X: r.X - edge.Left, Y: r.Y - edge.Top, Width: r.Width + edge.Left + edge.Right, Height: r.Height + edge.Top + edge.Bottom, } } func newLayoutBox(boxType BoxType, styledNode *style.StyledNode) *LayoutBox { var children []*LayoutBox return &LayoutBox{ BoxType: boxType, StyledNode: styledNode, Children: children, } } func GenerateLayoutTree(styleTree *style.StyledNode) *LayoutBox { var boxType BoxType switch styleTree.Display() { case style.Inline: boxType = InlineNode case style.Block: boxType = BlockNode case style.None: panic("Root StyledNode has display:none") } root := newLayoutBox(boxType, styleTree) for _, child := range styleTree.Children { switch child.Display() { case style.Inline: ic := root.getInlineContainer() ic.Children = append(ic.Children, GenerateLayoutTree(child)) case style.Block: root.Children = append(root.Children, GenerateLayoutTree(child)) case style.None: // Skip } } return root } // If a block node contains an inline child: func (box *LayoutBox) getInlineContainer() *LayoutBox { switch box.BoxType { case InlineNode: fallthrough case AnonymousBlock: return box case BlockNode: // If we've just generated an anonymous block box, keep using it. // Otherwise, create a new one. if len(box.Children) == 0 { box.Children = append(box.Children, newLayoutBox(AnonymousBlock, nil)) return box.Children[0] } lastChild := box.Children[len(box.Children)-1] switch lastChild.BoxType { case AnonymousBlock: return lastChild default: box.Children = append(box.Children, newLayoutBox(AnonymousBlock, nil)) return box.Children[len(box.Children)-1] } } panic("No more cases to switch") } func (box *LayoutBox) Layout(containingBlock Dimensions) { switch box.BoxType { case InlineNode: // TODO panic("Inline Node Unimplemented") case BlockNode: box.layoutBlock(containingBlock) case AnonymousBlock: // TODO panic("Anonymous Block Unimplemented") } } func (box *LayoutBox) layoutBlock(containingBlock Dimensions) { // First go down the LayoutTree to compute the widths from parents' widths // Then go up the tree to compute heights form children's heights box.calculateWidth(containingBlock) box.calculatePosition(containingBlock) box.layoutBlockChildren() box.calculateHeight() } func (box *LayoutBox) calculateWidth(containingBlock Dimensions) { style := box.StyledNode // width has initial value auto auto := css.Value{Keyword: "auto"} width, ok := style.Value("width") if !ok { width = auto } // margin, border, and padding have initial value 0 zero := css.Value{Length: css.Length{Quantity: 0.0, Unit: css.Px}} var marginLeft, marginRight, paddingLeft, paddingRight, borderLeft, borderRight css.Value if marginLeft, ok = style.Value("margin-left"); !ok { if marginLeft, ok = style.Value("margin"); !ok { marginLeft = zero } } if marginRight, ok = style.Value("margin-right"); !ok { if marginRight, ok = style.Value("margin"); !ok { marginRight = zero } } if borderLeft, ok = style.Value("border-left-width"); !ok { if borderLeft, ok = style.Value("border-width"); !ok { borderLeft = zero } } if borderRight, ok = style.Value("border-right-width"); !ok { if borderRight, ok = style.Value("border-width"); !ok { borderRight = zero } } if paddingLeft, ok = style.Value("padding-left"); !ok { if paddingLeft, ok = style.Value("padding"); !ok { paddingLeft = zero } } if paddingRight, ok = style.Value("padding-right"); !ok { if paddingRight, ok = style.Value("padding"); !ok { paddingRight = zero } } // Formula for block width: https://www.w3.org/TR/CSS2/visudet.html#blockwidth // Auto must count as zero total := marginLeft.ToPx() + marginRight.ToPx() + borderLeft.ToPx() + borderRight.ToPx() + paddingLeft.ToPx() + paddingRight.ToPx() + width.ToPx() // Checking if the box is too big // If width is not auto and the total is wider than the container, treat auto margins as 0. if width != auto && total > containingBlock.Content.Width { if marginLeft == auto { marginLeft = css.Value{Length: css.Length{Quantity: 0.0, Unit: css.Px}} } if marginRight == auto { marginRight = css.Value{Length: css.Length{Quantity: 0.0, Unit: css.Px}} } } // Check for over or underflow, and adjust "auto" dimensions accordingly underflow := containingBlock.Content.Width - total widthAuto := width == auto marginLeftAuto := marginLeft == auto marginRightAuto := marginRight == auto if !widthAuto && !marginLeftAuto && !marginRightAuto { // If the values are overconstrained, calculate margin_right marginRight = css.Value{Length: css.Length{Quantity: marginRight.ToPx() + underflow, Unit: css.Px}} } else if !widthAuto && !marginLeftAuto && marginRightAuto { // If exactly one size is auto, its used value follows from the equality marginRight = css.Value{Length: css.Length{Quantity: underflow, Unit: css.Px}} } else if !widthAuto && marginLeftAuto && !marginRightAuto { // Idem marginLeft = css.Value{Length: css.Length{Quantity: underflow, Unit: css.Px}} } else if widthAuto { // If width is set to auto, any other auto values become 0 if marginLeft == auto { marginLeft = css.Value{Length: css.Length{Quantity: 0.0, Unit: css.Px}} } if marginRight == auto { marginRight = css.Value{Length: css.Length{Quantity: 0.0, Unit: css.Px}} } if underflow >= 0.0 { // Expand width to fill the underflow width = css.Value{Length: css.Length{Quantity: underflow, Unit: css.Px}} } else { // Width can't be negative. Adjust the right margin instead width = css.Value{Length: css.Length{Quantity: 0.0, Unit: css.Px}} marginRight = css.Value{Length: css.Length{Quantity: marginRight.ToPx() + underflow, Unit: css.Px}} } } else if !widthAuto && marginLeftAuto && marginRightAuto { // If margin-left and margin-right are both auto, their used values are equal marginLeft = css.Value{Length: css.Length{Quantity: underflow / 2.0, Unit: css.Px}} marginRight = css.Value{Length: css.Length{Quantity: underflow / 2.0, Unit: css.Px}} } box.Dimensions.Content.Width = width.ToPx() box.Dimensions.padding.Left = paddingLeft.ToPx() box.Dimensions.padding.Right = paddingRight.ToPx() box.Dimensions.Border.Left = borderLeft.ToPx() box.Dimensions.Border.Right = borderRight.ToPx() box.Dimensions.margin.Left = marginLeft.ToPx() box.Dimensions.margin.Right = marginRight.ToPx() } func (box *LayoutBox) calculatePosition(containingBlock Dimensions) { style := box.StyledNode // margin, border, and padding have initial value 0 zero := css.Value{Length: css.Length{Quantity: 0.0, Unit: css.Px}} var marginTop, marginBottom, borderTop, borderBottom, paddingTop, paddingBottom css.Value var ok bool if marginTop, ok = style.Value("margin-top"); !ok { if marginTop, ok = style.Value("margin"); !ok { marginTop = zero } } if marginBottom, ok = style.Value("margin-bottom"); !ok { if marginBottom, ok = style.Value("margin"); !ok { marginBottom = zero } } if borderTop, ok = style.Value("border-top-width"); !ok { if borderTop, ok = style.Value("border-width"); !ok { borderTop = zero } } if borderBottom, ok = style.Value("border-bottom-width"); !ok { if borderBottom, ok = style.Value("border-width"); !ok { borderBottom = zero } } if paddingTop, ok = style.Value("padding-top"); !ok { if paddingTop, ok = style.Value("padding"); !ok { paddingTop = zero } } if paddingBottom, ok = style.Value("padding-bottom"); !ok { if paddingBottom, ok = style.Value("padding"); !ok { paddingBottom = zero } } box.Dimensions.margin.Top = marginTop.ToPx() box.Dimensions.margin.Bottom = marginBottom.ToPx() box.Dimensions.Border.Top = borderTop.ToPx() box.Dimensions.Border.Bottom = borderBottom.ToPx() box.Dimensions.padding.Top = paddingTop.ToPx() box.Dimensions.padding.Bottom = paddingBottom.ToPx() box.Dimensions.Content.X = containingBlock.Content.X + box.Dimensions.margin.Left + box.Dimensions.Border.Left + box.Dimensions.padding.Left // Position the box below all the previous boxes in the container. // Making sure the block is below content.height to stack components in the box box.Dimensions.Content.Y = containingBlock.Content.Height + containingBlock.Content.Y + box.Dimensions.margin.Top + box.Dimensions.Border.Top + box.Dimensions.padding.Top } func (box *LayoutBox) layoutBlockChildren() { for _, child := range box.Children { child.Layout(box.Dimensions) // Track the height so each child is laid out below the previous content box.Dimensions.Content.Height = box.Dimensions.Content.Height + child.Dimensions.marginBox().Height } } func (box *LayoutBox) calculateHeight() { // If the height is set to an explicit length, use that exact length // Otherwise, just keep the value set by layoutBlockChildren() if height, ok := box.StyledNode.Value("height"); ok { if height.Length.Unit == css.Px { box.Dimensions.Content.Height = height.Length.Quantity } } }
layout/layout.go
0.641535
0.562056
layout.go
starcoder
package plugin import ( "fmt" "os" "github.com/spf13/cobra" "github.com/thoas/go-funk" "go.blockdaemon.com/bpm/sdk/pkg/node" ) // ParameterValidator provides a function to validate the node parameters type ParameterValidator interface { // ValidateParameters validates the ndoe parameters ValidateParameters(currentNode node.Node) error } // IdentityCreator provides functions to create and remove the identity (e.g. private keys) of a node type IdentityCreator interface { // Function that creates the identity of a node CreateIdentity(currentNode node.Node) error // Removes identity related to the node RemoveIdentity(currentNode node.Node) error } // Configurator is the interface that wraps the Configure method type Configurator interface { // Function that creates the configuration for the node Configure(currentNode node.Node) error // Removes configuration related to the node RemoveConfig(currentNode node.Node) error } // LifecycleHandler provides functions to manage a node type LifecycleHandler interface { // SetUpEnvironment prepares the runtime environment SetUpEnvironment(currentNode node.Node) error // Function to start a node Start(currentNode node.Node) error // Function to stop a running node Stop(currentNode node.Node) error // Function to return the status (running, incomplete, stopped) of a node Status(currentNode node.Node) (string, error) // Removes any data (typically the blockchain itself) related to the node RemoveData(currentNode node.Node) error // Removes everything other than data and configuration related to the node RemoveRuntime(currentNode node.Node) error // TearDownEnvironment removes everything related to the node from the runtime environment TearDownEnvironment(currentNode node.Node) error } // Upgrader is the interface that wraps the Upgrade method type Upgrader interface { // Function to upgrade a node with a new plugin version Upgrade(currentNode node.Node) error } // Tester is the interface that wraps the Test method type Tester interface { // Function to test a node Test(currentNode node.Node) (bool, error) } // Plugin describes and provides the functionality for a plugin type Plugin interface { // Returns the name of the plugin Name() string // Return plugin meta information such as: What's supported, possible parameters Meta() MetaInfo ParameterValidator IdentityCreator Configurator LifecycleHandler Upgrader Tester } // Initialize creates the CLI for a plugin func Initialize(plugin Plugin) { // Initialize root command var rootCmd = &cobra.Command{ Use: plugin.Name(), Short: plugin.Meta().Description, SilenceUsage: true, } // Create the commands var validateParametersCmd = &cobra.Command{ Use: "validate-parameters <node-file>", Short: "Validates the parameters in the node file", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { currentNode, err := node.Load(args[0]) if err != nil { return err } return plugin.ValidateParameters(currentNode) }, } var createConfigurationsCmd = &cobra.Command{ Use: "create-configurations <node-file>", Short: "Creates the configurations for a node", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { currentNode, err := node.Load(args[0]) if err != nil { return err } return plugin.Configure(currentNode) }, } var setUpEnvironmentCmd = &cobra.Command{ Use: "set-up-environment <node-file>", Short: "Sets up the runtime environment in which the node runs", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { currentNode, err := node.Load(args[0]) if err != nil { return err } return plugin.SetUpEnvironment(currentNode) }, } var tearDownEnvironmentCmd = &cobra.Command{ Use: "tear-down-environment <node-file>", Short: "Tears down the runtime environment in which the node runs", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { currentNode, err := node.Load(args[0]) if err != nil { return err } return plugin.TearDownEnvironment(currentNode) }, } var startCmd = &cobra.Command{ Use: "start <node-file>", Short: "Starts the node", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { currentNode, err := node.Load(args[0]) if err != nil { return err } return plugin.Start(currentNode) }, } var stopCmd = &cobra.Command{ Use: "stop <node-file>", Short: "Stops the node", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { currentNode, err := node.Load(args[0]) if err != nil { return err } return plugin.Stop(currentNode) }, } var statusCmd = &cobra.Command{ Use: "status <node-file>", Short: "Gives information about the current node status", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { currentNode, err := node.Load(args[0]) if err != nil { return err } output, err := plugin.Status(currentNode) if err != nil { return err } fmt.Println(output) return nil }, } var metaInfoCmd = &cobra.Command{ Use: "meta", Short: "Shows meta information for this package", Run: func(cmd *cobra.Command, args []string) { fmt.Println(plugin.Meta()) }, } var removeConfigCmd = &cobra.Command{ Use: "remove-config <node-file>", Short: "Removes the node configuration", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { currentNode, err := node.Load(args[0]) if err != nil { return err } return plugin.RemoveConfig(currentNode) }, } var removeDataCmd = &cobra.Command{ Use: "remove-data <node-file>", Short: "Removes the node data (i.e. already synced blockchain)", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { currentNode, err := node.Load(args[0]) if err != nil { return err } return plugin.RemoveData(currentNode) }, } var removeRuntimeCmd = &cobra.Command{ Use: "remove-runtime <node-file>", Short: "Removes everything related to the node itself but no data, identity or configs", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { currentNode, err := node.Load(args[0]) if err != nil { return err } return plugin.RemoveRuntime(currentNode) }, } rootCmd.AddCommand( validateParametersCmd, createConfigurationsCmd, setUpEnvironmentCmd, tearDownEnvironmentCmd, startCmd, statusCmd, stopCmd, metaInfoCmd, removeConfigCmd, removeDataCmd, removeRuntimeCmd, ) if funk.Contains(plugin.Meta().Supported, SupportsTest) { var testCmd = &cobra.Command{ Use: "test <node-file>", Short: "Runs a test suite against the running node", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { currentNode, err := node.Load(args[0]) if err != nil { return err } success, err := plugin.Test(currentNode) if err != nil { return err } if !success { return fmt.Errorf("tests failed") // this causes a non-zero exit code } return nil }, } rootCmd.AddCommand(testCmd) } if funk.Contains(plugin.Meta().Supported, SupportsUpgrade) { var upgradeCmd = &cobra.Command{ Use: "upgrade <node-file>", Short: "Upgrades the node to a newer version of a package", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { currentNode, err := node.Load(args[0]) if err != nil { return err } return plugin.Upgrade(currentNode) }, } rootCmd.AddCommand(upgradeCmd) } if funk.Contains(plugin.Meta().Supported, SupportsIdentity) { var createIdentityCmd = &cobra.Command{ Use: "create-identity <node-file>", Short: "Creates the nodes identity (e.g. private keys, certificates, etc.)", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { currentNode, err := node.Load(args[0]) if err != nil { return err } return plugin.CreateIdentity(currentNode) }, } var removeIdentityCmd = &cobra.Command{ Use: "remove-identity <node-file>", Short: "Removes the node identity", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { currentNode, err := node.Load(args[0]) if err != nil { return err } return plugin.RemoveIdentity(currentNode) }, } rootCmd.AddCommand( createIdentityCmd, removeIdentityCmd, ) } // Start it all if err := rootCmd.Execute(); err != nil { os.Exit(1) } }
pkg/plugin/plugin.go
0.632276
0.434401
plugin.go
starcoder
package parsers import ( "errors" "strings" m "github.com/NumberXNumbers/types/gc/matrices" gcv "github.com/NumberXNumbers/types/gc/values" ) // Matrix takes a string and returns a matrix if string is // of matrix format, else error. // Example of matrix format: [1 2 3: 2+2i 2 0: 3.0 2.3 0+3i] // [1 2 3: 2+2i 2 0: 3.0 2.3 0+3i]' will return the transpose of the matrix // [1 2 3: 2+2i 2 0: 3.0 2.3 0+3i]* will return the conjugate transpose of the matrix func Matrix(s string) (matrix m.Matrix, err error) { if !strings.HasPrefix(s, leftBracket) { err = errors.New("String is not of type Matrix") return } if strings.Count(s, leftBracket) != 1 || strings.Count(s, rightBracket) != 1 { err = errors.New("String is not of type Matrix") return } if strings.Count(s, ":") == 0 { err = errors.New("String is of type Vector") return } var transposeMatrix bool var conjTransposeMatrix bool if strings.HasSuffix(s, apostrophe) { if strings.Index(s, rightBracket) == len(s)-offsetApostrophe { transposeMatrix = true s = strings.TrimRight(s, apostrophe) } else { err = errors.New("String is not of type Vector") return } } if strings.HasSuffix(s, star) { if strings.Index(s, rightBracket) == len(s)-offsetStar { conjTransposeMatrix = true s = strings.TrimRight(s, star) } else { err = errors.New("String is not of type Vector") return } } s = strings.TrimLeft(s, leftBracket) s = strings.TrimRight(s, rightBracket) s = strings.Replace(s, ": ", ":", -1) s = strings.Replace(s, " ", ",", -1) sSlice := strings.Split(s, ":") // mSlice stands for matrix string slice var mSlice [][]string for _, subSlice := range sSlice { mSlice = append(mSlice, strings.Split(subSlice, ",")) } length := len(mSlice[0]) matrix = m.NewMatrix(len(mSlice), length) var value gcv.Value // vSlice stands for vector string slice for indexI, vSlice := range mSlice { if len(vSlice) != length { err = errors.New("Inconsistent lengths") return } for indexJ, val := range vSlice { value, err = Value(val) if err != nil { return } matrix.Set(indexI, indexJ, value) } } if transposeMatrix { matrix.Trans() } if conjTransposeMatrix { matrix.ConjTrans() } return }
utils/parsers/parse_matrix.go
0.742048
0.570989
parse_matrix.go
starcoder
package main import ( "errors" "fmt" "image" "io" "os" "os/exec" "path/filepath" "strings" "time" ) // Graph is a collection of pixels to draw. type Graph struct { bounds image.Rectangle pixels []GraphPixel } // GraphPixel is a single pixel to draw. type GraphPixel struct { daysAgo int darkness int } // PixelChr returns unicode characters resembling a single GitHub graph pixel. func PixelChr(darkness int) string { r := []rune(" ░▒▓█") return strings.Repeat(string(r[darkness]), 2) + " " } // ImageToGraphPixels converts an image to an array of GraphPixels. func ImageToGraphPixels(colorMapped ColorMappedImage, args Args) Graph { bounds := colorMapped.image.Bounds() graph := Graph{bounds: bounds} for y := 0; y < bounds.Max.Y; y++ { for x := 0; x < bounds.Max.X; x++ { gray := colorMapped.image.GrayAt(x, y) commits := colorMapped.colorMap[int(gray.Y)] graph.pixels = append(graph.pixels, GraphPixel{ pixelDaysAgo(x, y, bounds.Max.X, args.weeksAgo), commits, }) } } return graph } func getBaseSSHCmd() []string { envData := os.Getenv("GIT_SSH_COMMAND") if envData != "" { return strings.Split(envData, " ") } return []string{"ssh"} } // GetUsername gets the GitHub username of the user func GetUsername() (string, error) { cmd := append(getBaseSSHCmd(), "-T", "<EMAIL>@github.com") resp, _ := exec.Command(cmd[0], cmd[1:]...).CombinedOutput() scan := strings.Split(string(resp), "!")[0] var username string _, err := fmt.Sscanf(scan, "Hi %s", &username) if err != nil { return "", errors.New("Invalid identity") } return username, nil } // CreateBranch creates a git branch locally. func CreateBranch(dir string, branch string) error { return commands( dir, []string{"git", "init"}, []string{"git", "checkout", "-B", branch}, ) } // CommitAll converts and executes all GraphPixels to git commits. func CommitAll(dir string, graph Graph, args Args) error { chrs := "" filename := filepath.Join(dir, "README.md") f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) if err != nil { return err } defer f.Close() fmt.Println() for i, px := range graph.pixels { err = drawPixel(dir, f, px, chrs) if err != nil { return err } fmt.Print(PixelChr(px.darkness)) chrs += PixelChr(px.darkness) if (i+1)%graph.bounds.Max.X == 0 { chrs += "\n" fmt.Println() } } fmt.Println() return nil } // PushAll pushes all local commits to remote git. func PushAll(dir string, project string, branch string) error { githubURL := fmt.Sprintf("<EMAIL>:%s.git", project) return command(dir, "git", "push", "-fu", githubURL, branch) } func pixelDaysAgo(x int, y int, width int, weeksAgo int) int { startDaysAgo := (width + weeksAgo) * 7 startDaysAgo += int(time.Now().Weekday()) return startDaysAgo - (x * 7) - y } func drawPixel(dir string, f *os.File, px GraphPixel, pixelChrs string) error { var err error multiply := 2 for i := 1; i <= px.darkness; i++ { // Multiply the number of commits per pixel to reduce the noise // of any other user activity in the user's activity graph. for j := multiply; j > 0; j-- { s := markdownStr(pixelChrs+PixelChr(i), j) // Write changes to file so it can be git committed. f.Seek(0, io.SeekStart) _, err = f.Write([]byte(s)) if err != nil { return err } // Commit changes. err = commit(dir, px.daysAgo) if err != nil { return err } } } return nil } // markDownstr wraps the block char pixels in a code section for // monospace display and adds a temporary `<` suffix to achieve unique // file contents to write for multiple commits per pixel. func markdownStr(pixelChrs string, ncommits int) string { s := "```\n" + pixelChrs if ncommits > 1 { s += strings.Repeat("<", ncommits-1) } return s + "\n```\n" } func commit(dir string, daysAgo int) error { date := time.Now().AddDate(0, 0, -daysAgo).Format(time.RFC3339) return commands(dir, []string{"git", "add", "."}, []string{ "git", "commit", "--all", "--allow-empty-message", "--message", "", "--date", date, }, ) } // command executes a single command in a custom environment and dir. func command(dir string, name string, arg ...string) error { cmd := exec.Command(name, arg...) cmd.Dir = dir response, err := cmd.CombinedOutput() responseStr := string(response) if err != nil { return fmt.Errorf("%s %v: %v", name, arg, responseStr) } return nil } // commands executes multiple commands. func commands(dir string, cmds ...[]string) error { for _, cmd := range cmds { err := command(dir, cmd[0], cmd[1:]...) if err != nil { return err } } return nil }
git.go
0.639511
0.40695
git.go
starcoder
package elasticsearch import ( "strings" "k8s.io/heapster/metrics/core" ) func MetricFamilyTimestamp(metricFamily core.MetricFamily) string { return strings.Title(string(metricFamily)) + "MetricsTimestamp" } func metricFamilySchema(metricFamily core.MetricFamily) string { metricSchemas := []string{} for _, metric := range core.MetricFamilies[metricFamily] { metricSchemas = append(metricSchemas, `"`+metric.Name+`": { "properties": { "value": { "type": "double" } } }`, ) } return customMetricTypeSchema(string(metricFamily), `"`+MetricFamilyTimestamp(metricFamily)+`": { "type": "date", "format": "strict_date_optional_time||epoch_millis" }, "Metrics": { "properties": { `+strings.Join(metricSchemas, ",\r\n")+` } } `, ) } func customMetricTypeSchema(typeName string, customSchema string) string { return `"` + typeName + `": { "properties": { "MetricsTags": { "properties": { "container_base_image": { "type": "string", "index": "analyzed", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "container_name": { "type": "string", "index": "analyzed", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "host_id": { "type": "string", "index": "not_analyzed" }, "hostname": { "type": "string", "index": "analyzed", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "labels": { "type": "string", "index": "analyzed", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "namespace_id": { "type": "string", "index": "not_analyzed" }, "namespace_name": { "type": "string", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "nodename": { "type": "string", "index": "analyzed", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "cluster_name": { "type": "string", "index": "not_analyzed" }, "pod_id": { "type": "string", "index": "not_analyzed" }, "pod_name": { "type": "string", "index": "analyzed", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "pod_namespace": { "type": "string", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "resource_id": { "type": "string", "index": "not_analyzed" }, "type": { "type": "string", "index": "not_analyzed" } } }, ` + customSchema + ` } }` } var mapping = `{ "mappings": { "_default_": { "_all": { "enabled": false } }, ` + metricFamilySchema(core.MetricFamilyCpu) + `, ` + metricFamilySchema(core.MetricFamilyFilesystem) + `, ` + metricFamilySchema(core.MetricFamilyMemory) + `, ` + metricFamilySchema(core.MetricFamilyNetwork) + `, ` + customMetricTypeSchema(core.MetricFamilyGeneral, `"MetricsName": { "type": "string", "index": "analyzed", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "GeneralMetricsTimestamp": { "type": "date", "format": "strict_date_optional_time||epoch_millis" }, "MetricsValue": { "properties": { "value": { "type": "double" } } }`) + `, "events": { "properties": { "EventTags": { "properties": { "eventID": { "type": "string", "index": "not_analyzed" }, "cluster_name": { "type": "string", "index": "not_analyzed" }, "hostname": { "type": "string", "index": "analyzed", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "pod_id": { "type": "string", "index": "not_analyzed" }, "pod_name": { "type": "string", "index": "analyzed", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } } } }, "InvolvedObject": { "properties": { "apiVersion": { "type": "string", "index": "not_analyzed" }, "fieldPath": { "type": "string", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "kind": { "type": "string", "index": "not_analyzed" }, "name": { "type": "string", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "namespace": { "type": "string", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "resourceVersion": { "type": "string", "index": "not_analyzed" }, "uid": { "type": "string", "index": "not_analyzed" } } }, "FirstOccurrenceTimestamp": { "type": "date", "format": "strict_date_optional_time||epoch_millis" }, "LastOccurrenceTimestamp": { "type": "date", "format": "strict_date_optional_time||epoch_millis" }, "Type": { "type": "string", "index": "not_analyzed" }, "Message": { "type": "string", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "Reason": { "type": "string", "index": "not_analyzed" }, "Count": { "type": "long" }, "Metadata": { "properties": { "creationTimestamp": { "type": "date", "format": "strict_date_optional_time||epoch_millis" }, "name": { "type": "string", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "namespace": { "type": "string", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, "resourceVersion": { "type": "string", "index": "not_analyzed" }, "selfLink": { "type": "string", "index": "not_analyzed" }, "uid": { "type": "string", "index": "not_analyzed" } } }, "Source": { "properties": { "component": { "type": "string", "index": "not_analyzed" }, "host": { "type": "string", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } } } } } } } }`
heapster-1.3.0/common/elasticsearch/mapping.go
0.796649
0.417153
mapping.go
starcoder
package gl import ( "github.com/cloudprivacylabs/lsa/pkg/ls" ) // NodeValue is zero or mode nodes on the stack type NodeValue struct { basicValue Nodes ls.NodeSet } func NewNodeValue(nodes ...ls.Node) NodeValue { return NodeValue{Nodes: ls.NewNodeSet(nodes...)} } func (n NodeValue) oneNode() (ls.Node, error) { switch n.Nodes.Len() { case 0: return nil, ErrNoNodesInResult case 1: return n.Nodes.Slice()[0], nil } return nil, ErrMultipleNodesInResult } var nodeSelectors = map[string]func(NodeValue) (Value, error){ "id": oneNode(func(node ls.Node) (Value, error) { return StringValue(node.GetID()), nil }), "length": func(node NodeValue) (Value, error) { return ValueOf(node.Nodes.Len()), nil }, "type": oneNode(func(node ls.Node) (Value, error) { return StringSliceValue(node.GetTypes().Slice()), nil }), "value": oneNode(func(node ls.Node) (Value, error) { return ValueOf(node.GetValue()), nil }), "properties": oneNode(func(node ls.Node) (Value, error) { return PropertiesValue{Properties: node.GetProperties()}, nil }), "firstReachable": nodeFirstReachableFunc, "first": nodeFirstReachableFunc, "firstDoc": nodeFirstReachableDocNodeFunc, "instanceOf": nodeInstanceOfFunc, "walk": nodeWalk, } func (v NodeValue) Selector(sel string) (Value, error) { selected := nodeSelectors[sel] if selected != nil { return selected(v) } return v.basicValue.Selector(sel) } func (v NodeValue) Add(v2 Value) (Value, error) { if v2 == nil { return v, nil } if _, ok := v2.(NullValue); ok { return v, nil } nodes, ok := v2.(NodeValue) if !ok { return nil, ErrIncompatibleValue } ret := NewNodeValue() ret.Nodes.Add(v.Nodes.Slice()...) ret.Nodes.Add(nodes.Nodes.Slice()...) return ret, nil } func (v NodeValue) AsBool() (bool, error) { return v.Nodes.Len() > 0, nil } func (v NodeValue) AsString() (string, error) { return "", ErrNotAString } func (v NodeValue) Eq(val Value) (bool, error) { nv, ok := val.(NodeValue) if !ok { return false, ErrIncomparable } return v.Nodes.EqualSet(nv.Nodes), nil }
pkg/gl/nodevalue.go
0.500244
0.447702
nodevalue.go
starcoder
package eval import "github.com/elves/elvish/parse" func (cp *compiler) chunkOp(n *parse.Chunk) effectOp { cp.compiling(n) return effectOp{cp.chunk(n), n.Range().From, n.Range().To} } func (cp *compiler) chunkOps(ns []*parse.Chunk) []effectOp { ops := make([]effectOp, len(ns)) for i, n := range ns { ops[i] = cp.chunkOp(n) } return ops } func (cp *compiler) pipelineOp(n *parse.Pipeline) effectOp { cp.compiling(n) return effectOp{cp.pipeline(n), n.Range().From, n.Range().To} } func (cp *compiler) pipelineOps(ns []*parse.Pipeline) []effectOp { ops := make([]effectOp, len(ns)) for i, n := range ns { ops[i] = cp.pipelineOp(n) } return ops } func (cp *compiler) formOp(n *parse.Form) effectOp { cp.compiling(n) return effectOp{cp.form(n), n.Range().From, n.Range().To} } func (cp *compiler) formOps(ns []*parse.Form) []effectOp { ops := make([]effectOp, len(ns)) for i, n := range ns { ops[i] = cp.formOp(n) } return ops } func (cp *compiler) assignmentOp(n *parse.Assignment) effectOp { cp.compiling(n) return effectOp{cp.assignment(n), n.Range().From, n.Range().To} } func (cp *compiler) assignmentOps(ns []*parse.Assignment) []effectOp { ops := make([]effectOp, len(ns)) for i, n := range ns { ops[i] = cp.assignmentOp(n) } return ops } func (cp *compiler) redirOp(n *parse.Redir) effectOp { cp.compiling(n) return effectOp{cp.redir(n), n.Range().From, n.Range().To} } func (cp *compiler) redirOps(ns []*parse.Redir) []effectOp { ops := make([]effectOp, len(ns)) for i, n := range ns { ops[i] = cp.redirOp(n) } return ops } func (cp *compiler) compoundOp(n *parse.Compound) valuesOp { cp.compiling(n) return valuesOp{cp.compound(n), n.Range().From, n.Range().To} } func (cp *compiler) compoundOps(ns []*parse.Compound) []valuesOp { ops := make([]valuesOp, len(ns)) for i, n := range ns { ops[i] = cp.compoundOp(n) } return ops } func (cp *compiler) arrayOp(n *parse.Array) valuesOp { cp.compiling(n) return valuesOp{cp.array(n), n.Range().From, n.Range().To} } func (cp *compiler) arrayOps(ns []*parse.Array) []valuesOp { ops := make([]valuesOp, len(ns)) for i, n := range ns { ops[i] = cp.arrayOp(n) } return ops } func (cp *compiler) indexingOp(n *parse.Indexing) valuesOp { cp.compiling(n) return valuesOp{cp.indexing(n), n.Range().From, n.Range().To} } func (cp *compiler) indexingOps(ns []*parse.Indexing) []valuesOp { ops := make([]valuesOp, len(ns)) for i, n := range ns { ops[i] = cp.indexingOp(n) } return ops } func (cp *compiler) primaryOp(n *parse.Primary) valuesOp { cp.compiling(n) return valuesOp{cp.primary(n), n.Range().From, n.Range().To} } func (cp *compiler) primaryOps(ns []*parse.Primary) []valuesOp { ops := make([]valuesOp, len(ns)) for i, n := range ns { ops[i] = cp.primaryOp(n) } return ops } func (cp *compiler) listOp(n *parse.Primary) valuesOp { cp.compiling(n) return valuesOp{cp.list(n), n.Range().From, n.Range().To} } func (cp *compiler) listOps(ns []*parse.Primary) []valuesOp { ops := make([]valuesOp, len(ns)) for i, n := range ns { ops[i] = cp.listOp(n) } return ops } func (cp *compiler) lambdaOp(n *parse.Primary) valuesOp { cp.compiling(n) return valuesOp{cp.lambda(n), n.Range().From, n.Range().To} } func (cp *compiler) lambdaOps(ns []*parse.Primary) []valuesOp { ops := make([]valuesOp, len(ns)) for i, n := range ns { ops[i] = cp.lambdaOp(n) } return ops } func (cp *compiler) map_Op(n *parse.Primary) valuesOp { cp.compiling(n) return valuesOp{cp.map_(n), n.Range().From, n.Range().To} } func (cp *compiler) map_Ops(ns []*parse.Primary) []valuesOp { ops := make([]valuesOp, len(ns)) for i, n := range ns { ops[i] = cp.map_Op(n) } return ops } func (cp *compiler) bracedOp(n *parse.Primary) valuesOp { cp.compiling(n) return valuesOp{cp.braced(n), n.Range().From, n.Range().To} } func (cp *compiler) bracedOps(ns []*parse.Primary) []valuesOp { ops := make([]valuesOp, len(ns)) for i, n := range ns { ops[i] = cp.bracedOp(n) } return ops }
eval/boilerplate.go
0.556641
0.410225
boilerplate.go
starcoder
package gqlmodel import ( "net/url" "strings" "github.com/reearth/reearth-backend/pkg/value" ) func valueInterfaceToGqlValue(v interface{}) interface{} { if v == nil { return nil } switch v2 := v.(type) { case bool: return v2 case float64: return v2 case string: return v2 case *url.URL: return v2.String() case value.LatLng: return LatLng{ Lat: v2.Lat, Lng: v2.Lng, } case value.LatLngHeight: return LatLngHeight{ Lat: v2.Lat, Lng: v2.Lng, Height: v2.Height, } case *value.LatLng: return LatLng{ Lat: v2.Lat, Lng: v2.Lng, } case *value.LatLngHeight: return LatLngHeight{ Lat: v2.Lat, Lng: v2.Lng, Height: v2.Height, } case []value.LatLngHeight: res := make([]LatLngHeight, 0, len(v2)) for _, c := range v2 { res = append(res, LatLngHeight{ Lat: c.Lat, Lng: c.Lng, Height: c.Height, }) } return res case [][]value.LatLngHeight: res := make([][]LatLngHeight, 0, len(v2)) for _, d := range v2 { coord := make([]LatLngHeight, 0, len(d)) for _, c := range d { coord = append(coord, LatLngHeight{ Lat: c.Lat, Lng: c.Lng, Height: c.Height, }) } res = append(res, coord) } return res case *value.Rect: return Rect{ West: v2.West, East: v2.East, North: v2.North, South: v2.South, } } return nil } func gqlValueToValueInterface(v interface{}) interface{} { if v == nil { return nil } switch v2 := v.(type) { case LatLng: return value.LatLng{ Lat: v2.Lat, Lng: v2.Lng, } case *LatLng: if v2 == nil { return nil } return value.LatLng{ Lat: v2.Lat, Lng: v2.Lng, } case LatLngHeight: return value.LatLngHeight{ Lat: v2.Lat, Lng: v2.Lng, Height: v2.Height, } case *LatLngHeight: if v2 == nil { return nil } return value.LatLngHeight{ Lat: v2.Lat, Lng: v2.Lng, Height: v2.Height, } case []LatLngHeight: res := make([]value.LatLngHeight, 0, len(v2)) for _, c := range v2 { res = append(res, value.LatLngHeight{ Lat: c.Lat, Lng: c.Lng, Height: c.Height, }) } return value.Coordinates(res) case []*LatLngHeight: res := make([]value.LatLngHeight, 0, len(v2)) for _, c := range v2 { if c == nil { continue } res = append(res, value.LatLngHeight{ Lat: c.Lat, Lng: c.Lng, Height: c.Height, }) } return value.Coordinates(res) case [][]LatLngHeight: res := make([]value.Coordinates, 0, len(v2)) for _, d := range v2 { coord := make([]value.LatLngHeight, 0, len(d)) for _, c := range d { coord = append(coord, value.LatLngHeight{ Lat: c.Lat, Lng: c.Lng, Height: c.Height, }) } res = append(res, coord) } return value.Polygon(res) case [][]*LatLngHeight: res := make([]value.Coordinates, 0, len(v2)) for _, d := range v2 { coord := make([]value.LatLngHeight, 0, len(d)) for _, c := range d { if c == nil { continue } coord = append(coord, value.LatLngHeight{ Lat: c.Lat, Lng: c.Lng, Height: c.Height, }) } res = append(res, coord) } return value.Polygon(res) case Rect: return value.Rect{ West: v2.West, East: v2.East, North: v2.North, South: v2.South, } case *Rect: return value.Rect{ West: v2.West, East: v2.East, North: v2.North, South: v2.South, } } return v } func ToValueType(t value.Type) ValueType { return ValueType(strings.ToUpper(string(t))) } func FromValueType(t ValueType) value.Type { return value.Type(strings.ToLower(string(t))) }
internal/adapter/gql/gqlmodel/convert_value.go
0.517327
0.48377
convert_value.go
starcoder
package algs4 // BSTNode ... type BSTNode struct { key Key // defined in st.go val interface{} left, right *BSTNode n int } // BST is symbol table implemented by a binary tree type BST struct { root *BSTNode } // NewBST returns an bst with init capcity func NewBST() *BST { return &BST{} } func (st *BST) put(x *BSTNode, key Key, val interface{}) *BSTNode { if x == nil { return &BSTNode{key: key, val: val, n: 1} } cmp := key.compareTo(x.key) if cmp > 0 { x.right = st.put(x.right, key, val) } else if cmp < 0 { x.left = st.put(x.left, key, val) } else { x.val = val } x.n = st.size(x.left) + st.size(x.right) + 1 return x } // Put add new key value pair into the st func (st *BST) Put(key Key, val interface{}) { st.root = st.put(st.root, key, val) return } func (st *BST) get(x *BSTNode, key Key) interface{} { if x == nil { return nil } cmp := key.compareTo(x.key) if cmp > 0 { return st.get(x.right, key) } else if cmp < 0 { return st.get(x.left, key) } else { return x.val } } // Get add new key value pair into the st func (st *BST) Get(key Key) interface{} { return st.get(st.root, key) } // GetInt return the val as int( have to do this since GO doesn't have generics) func (st *BST) GetInt(key Key) int { return st.Get(key).(int) } // MinNode returns the minimum node in the BST func (st *BST) MinNode() *BSTNode { if st.IsEmpty() { panic("call Min on empty bst") } return st.min(st.root) } // Min returns the minimum key in the BST func (st *BST) Min() Key { if st.IsEmpty() { panic("call Min on empty bst") } return st.min(st.root).key } // min returns the minium node in x func (st *BST) min(x *BSTNode) *BSTNode { if x.left == nil { return x } return st.min(x.left) } // MaxNode returns the maximum node in the BST func (st *BST) MaxNode() *BSTNode { if st.IsEmpty() { panic("call Max on empty bst") } return st.max(st.root) } // Max returns the maximum key in the BST func (st *BST) Max() Key { if st.IsEmpty() { panic("call Max on empty bst") } return st.max(st.root).key } // max returns the maxium node in x func (st *BST) max(x *BSTNode) *BSTNode { if x.right == nil { return x } return st.max(x.right) } // Floor ... func (st *BST) Floor(key Key) Key { x := st.floor(st.root, key) if x == nil { return nil } return x.key } func (st *BST) floor(x *BSTNode, key Key) *BSTNode { if x == nil { return nil } cmp := key.compareTo(x.key) if cmp == 0 { return x } else if cmp < 0 { return st.floor(x.left, key) } t := st.floor(x.right, key) if t != nil { return t } return x } // Select ... func (st *BST) Select(k int) Key { return st._select(st.root, k).key } func (st *BST) _select(x *BSTNode, k int) *BSTNode { if x == nil { return nil } t := st.size(x) if t > k { return st._select(x.left, k) } else if t < k { return st._select(x.right, k-t-1) } else { return x } } // Rank ... func (st *BST) Rank(k Key) int { return st.rank(st.root, k) } func (st *BST) rank(x *BSTNode, key Key) int { if x == nil { return 0 } cmp := key.compareTo(x.key) if cmp < 0 { return st.rank(x.left, key) } else if cmp > 0 { return 1 + st.size(x.left) + st.rank(x.right, key) } else { return st.size(x.left) } } // DeleteMin ... func (st *BST) DeleteMin() { st.root = st.deleteMin(st.root) } func (st *BST) deleteMin(x *BSTNode) *BSTNode { if x.left == nil { return x.right } x.left = st.deleteMin(x.left) x.n = st.size(x.left) + st.size(x.right) + 1 return x } // Delete ... func (st *BST) Delete(key Key) { st.root = st.delete(st.root, key) } func (st *BST) delete(x *BSTNode, key Key) *BSTNode { if x == nil { return nil } cmp := key.compareTo(x.key) if cmp < 0 { x.left = st.delete(x.left, key) } else if cmp > 0 { x.right = st.delete(x.right, key) } else { if x.right == nil { return x.left } else if x.left == nil { return x.right } t := x x = st.min(t.right) x.right = st.deleteMin(t.right) x.left = t.left } x.n = st.size(x.left) + st.size(x.right) + 1 return x } // Contains ... func (st *BST) Contains(key Key) bool { return st.Get(key) != nil } func (st *BST) size(x *BSTNode) int { if x == nil { return 0 } return x.n } // Size ... func (st *BST) Size() int { return st.size(st.root) } // IsEmpty add new key value pair into the st func (st BST) IsEmpty() bool { return st.Size() == 0 } // Keys ... func (st *BST) Keys() []Key { return st.keys(st.Min(), st.Max()) } func (st *BST) keys(lo, hi Key) (keys []Key) { queue := NewQueue() st.nodeKeys(st.root, queue, lo, hi) for _, item := range queue.Slice() { keys = append(keys, item.(Key)) } return } func (st *BST) nodeKeys(x *BSTNode, queue *Queue, lo, hi Key) { if x == nil { return } cmplo := lo.compareTo(x.key) cmphi := hi.compareTo(x.key) if cmplo < 0 { st.nodeKeys(x.left, queue, lo, hi) } if cmplo <= 0 && cmphi >= 0 { queue.Enqueue(x.key) } if cmphi > 0 { st.nodeKeys(x.right, queue, lo, hi) } }
algs4/bst.go
0.759582
0.451931
bst.go
starcoder
package lshIndex import ( //"errors" "github.com/orcaman/concurrent-map" ) // set to 2/4/8 for 16bit/32bit/64bit hash values const HASH_SIZE = 8 // integration precision for optimising number of bands + hash functions in LSH Forest const PRECISION = 0.01 // number of partitions and maxK to use in LSH Ensemble (TODO: add these as customisable parameters for GROOT) const PARTITIONS = 6 const MAXK = 4 // error messages //var ( //querySizeError = errors.New("Query size is > +/- 10 bases of reference windows, re-index using --containment") //) // NewLSHensemble initializes a new index consisting of MinHash LSH implemented using LshForest. // numHash is the number of hash functions in MinHash. // maxK is the maximum value for the MinHash parameter K - the number of hash functions per "band". func NewLSHensemble(parts []Partition, numHash, maxK int) *LshEnsemble { lshes := make([]*LshForest, len(parts)) for i := range lshes { lshes[i] = newLshForest(maxK, numHash/maxK) } return &LshEnsemble{ Lshes: lshes, Partitions: parts, MaxK: maxK, NumHash: numHash, paramCache: cmap.New(), } } // NewLshForest initializes a new index consisting of MinHash LSH implemented using a single LshForest. // sigSize is the number of hash functions in MinHash. // jsThresh is the minimum Jaccard similarity needed for a query to return a match func NewLSHforest(sigSize int, jsThresh float64) *LshEnsemble { // calculate the optimal number of bands and hash functions to use numHashFuncs, numBands, _, _ := optimise(sigSize, jsThresh) lshes := make([]*LshForest, 1) lshes[0] = newLshForest(numHashFuncs, numBands) return &LshEnsemble{ Lshes: lshes, Partitions: make([]Partition, 1), MaxK: numBands, NumHash: numHashFuncs, paramCache: cmap.New(), SingleForest: true, } } // BoostrapLshEnsemble builds an index from a channel of domains. // The returned index consists of MinHash LSH implemented using LshForest. // numPart is the number of partitions to create. // numHash is the number of hash functions in MinHash. // maxK is the maximum value for the MinHash parameter K - the number of hash functions per "band". // GraphWindow is a channel emitting windows (don't need to be sorted by their sizes as windows are constant) TODO: should probably add a check for this func BootstrapLshEnsemble(numPart, numHash, maxK, totalNumWindows int, windows <-chan *GraphWindow) *LshEnsemble { index := NewLSHensemble(make([]Partition, numPart), numHash, maxK) bootstrap(index, totalNumWindows, windows) return index } // bootstrap func bootstrap(index *LshEnsemble, totalNumWindows int, windows <-chan *GraphWindow) { numPart := len(index.Partitions) depth := totalNumWindows / numPart var currDepth, currPart int for rec := range windows { index.Add(rec.Key, rec.Signature, currPart) currDepth++ index.Partitions[currPart].Upper = rec.Size if currDepth >= depth && currPart < numPart-1 { currPart++ index.Partitions[currPart].Lower = rec.Size currDepth = 0 } } return } // Windows2Chan is a utility function that converts a GraphWindow slice in memory to a GraphWindow channel. func Windows2Chan(windows []*GraphWindow) <-chan *GraphWindow { c := make(chan *GraphWindow, 1000) go func() { for _, w := range windows { c <- w } close(c) }() return c }
src/lshIndex/lshIndex.go
0.519278
0.453201
lshIndex.go
starcoder
package filter import ( "fmt" ) // Field represents an SQL field type Field string // Operator represents an SQL operator type Operator string const ( // OperatorEqual represents an SQL operator of the same name OperatorEqual Operator = "eq" // OperatorNot represents an SQL operator of the same name OperatorNot Operator = "not" // OperatorNotEqual represents an SQL operator of the same name OperatorNotEqual Operator = "noteq" // OperatorLessThan represents an SQL operator of the same name OperatorLessThan Operator = "lt" // OperatorLessThanEqual represents an SQL operator of the same name OperatorLessThanEqual Operator = "lte" // OperatorGreaterThan represents an SQL operator of the same name OperatorGreaterThan Operator = "gt" // OperatorGreaterThanEqual represents an SQL operator of the same name OperatorGreaterThanEqual Operator = "gte" // OperatorAnd represents an SQL operator of the same name OperatorAnd Operator = "and" // OperatorOr represents an SQL operator of the same name OperatorOr Operator = "or" // OperatorLike represents an SQL operator of the same name OperatorLike Operator = "like" ) // OperandMap is the map of operands to its query string equivalent var OperandMap = map[Operator]string{ OperatorEqual: " = ", OperatorNot: " ! ", OperatorNotEqual: " != ", OperatorLessThan: " < ", OperatorLessThanEqual: " <= ", OperatorGreaterThan: " > ", OperatorGreaterThanEqual: " >= ", OperatorAnd: " AND ", OperatorOr: " OR ", OperatorLike: " LIKE ", } // QueryPart represents part of a query type QueryPart interface { ToString() string } // Clause represents a simple clause type Clause struct { Operand1 interface{} Operand2 interface{} Operator Operator } // GetArgs gets the arguments required for this clause func (c *Clause) GetArgs(args []interface{}) []interface{} { switch c.Operand1.(type) { case Field, *Field: case Clause: clause1 := c.Operand1.(Clause) args = clause1.GetArgs(args) case *Clause: clause1 := c.Operand1.(*Clause) args = clause1.GetArgs(args) default: args = append(args, c.Operand1) } switch c.Operand2.(type) { case Field, *Field: case Clause: clause2 := c.Operand2.(Clause) args = clause2.GetArgs(args) case *Clause: clause1 := c.Operand2.(*Clause) args = clause1.GetArgs(args) default: args = append(args, c.Operand2) } return args } func (c *Clause) handlePointers() error { switch c.Operand1.(type) { case *Field: if c.Operand1 == nil { return fmt.Errorf("operand1 is nil, expected non-nil *Field") } operand1 := c.Operand1.(*Field) c.Operand1 = *operand1 case *Clause: if c.Operand1 == nil { return fmt.Errorf("operand1 is nil, expected non-nil *Clause") } operand1 := c.Operand1.(*Clause) c.Operand1 = *operand1 default: } switch c.Operand2.(type) { case *Field: if c.Operand2 == nil { return fmt.Errorf("operand2 is nil, expected non-nil *Field") } operand2 := c.Operand2.(*Field) c.Operand2 = *operand2 case *Clause: if c.Operand2 == nil { return fmt.Errorf("operand2 is nil, expected non-nil *Clause") } operand2 := c.Operand2.(*Clause) c.Operand2 = *operand2 default: } return nil } // ToQueryString returns the string representation of the clause func (c *Clause) ToQueryString() (string, error) { err := c.handlePointers() if err != nil { return "", err } switch c.Operand1.(type) { case Field: switch c.Operand2.(type) { case Field: return c.toStringFieldVsField() case Clause: return c.toStringFieldVsClause() default: return c.toStringFieldVsValue() } case Clause: switch c.Operand2.(type) { case Field: return c.toStringClauseVsField() case Clause: return c.toStringClauseVsClause() default: return "", fmt.Errorf("unsupported filter param combination: clause vs value") } default: switch c.Operand2.(type) { case Field: return "", fmt.Errorf("unsupported filter param combination: value vs field") case Clause: return "", fmt.Errorf("unsupported filter param combination: value vs clause") default: return "", fmt.Errorf("unsupported filter param combination: value vs value") } } } func (c *Clause) toStringFieldVsField() (string, error) { field1, ok := c.Operand1.(Field) if !ok { return "", fmt.Errorf("failed processing field [%#v]", field1) } field2, ok := c.Operand2.(Field) if !ok { return "", fmt.Errorf("failed processing field [%#v]", field2) } return fmt.Sprintf("(%s %s %s)", field1, OperandMap[c.Operator], field2), nil } func (c *Clause) toStringFieldVsClause() (string, error) { field, ok := c.Operand1.(Field) if !ok { return "", fmt.Errorf("failed processing field [%#v]", field) } clause, ok := c.Operand2.(Clause) if !ok { return "", fmt.Errorf("failed processing clause [%#v]", clause) } clauseStr, err := clause.ToQueryString() if err != nil { return "", err } return fmt.Sprintf("(%s %s %s)", field, OperandMap[c.Operator], clauseStr), nil } func (c *Clause) toStringFieldVsValue() (string, error) { field, ok := c.Operand1.(Field) if !ok { return "", fmt.Errorf("failed processing field [%#v]", field) } return fmt.Sprintf("(%s %s ?)", field, OperandMap[c.Operator]), nil } func (c *Clause) toStringClauseVsField() (string, error) { clause, ok := c.Operand1.(Clause) if !ok { return "", fmt.Errorf("failed processing clause [%#v]", clause) } clauseStr, err := clause.ToQueryString() if err != nil { return "", err } field, ok := c.Operand2.(Field) if !ok { return "", fmt.Errorf("failed processing field [%#v]", field) } return fmt.Sprintf("(%s %s %s)", clauseStr, OperandMap[c.Operator], field), nil } func (c *Clause) toStringClauseVsClause() (string, error) { clause1, ok := c.Operand1.(Clause) if !ok { return "", fmt.Errorf("failed processing clause [%#v]", clause1) } clause1Str, err := clause1.ToQueryString() if err != nil { return "", err } clause2, ok := c.Operand2.(Clause) if !ok { return "", fmt.Errorf("failed processing clause [%#v]", clause2) } clause2Str, err := clause2.ToQueryString() if err != nil { return "", err } return fmt.Sprintf("(%s %s %s)", clause1Str, OperandMap[c.Operator], clause2Str), nil } // Pagination represents the pagination part of an SQL query type Pagination struct { Page int PageSize int } // GetOffset returns the offset required for the current page func (p *Pagination) GetOffset() int { return (p.Page - 1) * p.PageSize } // GetArgs gets the arguments required for this pagination func (p *Pagination) GetArgs(args []interface{}) []interface{} { args = append(args, p.PageSize, p.GetOffset()) return args } // GetPageCount calculates the page count based on pagination settings and total item count func (p *Pagination) GetPageCount(itemCount int) (pageCount int) { pageCount = itemCount / p.PageSize pagedItems := p.PageSize * pageCount if pagedItems < itemCount { pageCount++ } return } // ToQueryString returns the string representation of the pagination func (p *Pagination) ToQueryString() string { return fmt.Sprintf("LIMIT ? OFFSET ?") } // Filter represents a generic SQL filter type Filter struct { TableName string DeletedColumn string Clause *Clause IncludeDeleted bool Pagination Pagination } // GetArgs gets the arguments required for this filter func (f *Filter) GetArgs(withPagination bool) []interface{} { args := make([]interface{}, 0) if f.Clause != nil { args = f.Clause.GetArgs(args) } if withPagination { args = f.Pagination.GetArgs(args) } return args } // AddClause adds a clause to this Filter func (f *Filter) AddClause(clause Clause, operator Operator) { if f.Clause == nil { f.Clause = &clause } else { newClause := Clause{ Operand1: f.Clause, Operand2: clause, Operator: operator, } f.Clause = &newClause } } // ToQueryString converts the Filter to a string query func (f *Filter) ToQueryString() (string, error) { var err error clauseStr := "" if f.Clause != nil { clauseStr, err = f.Clause.ToQueryString() if err != nil { return "", err } } if !f.IncludeDeleted { if len(f.DeletedColumn) == 0 { f.DeletedColumn = "deleted" } if len(clauseStr) > 0 { clauseStr = fmt.Sprintf("(%s) AND %s.%s IS NULL ", clauseStr, f.TableName, f.DeletedColumn) } else { clauseStr = fmt.Sprintf(" %s.%s IS NULL ", f.TableName, f.DeletedColumn) } } return " WHERE " + clauseStr, nil } // BaseFilterInput is the base type for all filter inputs type BaseFilterInput struct { Keyword *string `json:"keyword,omitempty"` IncludeDeleted *bool `json:"includeDeleted,omitempty"` Page *int `json:"page,omitempty"` PageSize *int `json:"pageSize,omitempty"` } // GetKeywordFilter produces the filter object from a list of searchable fields func (f *BaseFilterInput) GetKeywordFilter(fields []Field, exact bool) (clause *Clause) { if f.Keyword == nil { return nil } keyword := *f.Keyword operator := OperatorEqual if !exact { keyword = "%" + keyword + "%" operator = OperatorLike } for idx, field := range fields { newClause := &Clause{ Operand1: field, Operand2: keyword, Operator: operator, } if idx == 0 { clause = newClause } else { clause = &Clause{ Operand1: clause, Operand2: newClause, Operator: OperatorOr, } } } return } // GetIncludeDeleted returns the boolean parameter which indicates whether the filter should include deleted items func (f *BaseFilterInput) GetIncludeDeleted() bool { if f.IncludeDeleted == nil { includeDeleted := false f.IncludeDeleted = &includeDeleted } return *f.IncludeDeleted } // GetPagination returns the pagination object from a filter input func (f *BaseFilterInput) GetPagination() Pagination { page := 1 if f.Page != nil { page = *f.Page } pageSize := 10 if f.PageSize != nil { pageSize = *f.PageSize } return Pagination{ Page: page, PageSize: pageSize, } }
backend/util/filter/filter.go
0.758689
0.594434
filter.go
starcoder
package audio import "math" // PCMDataFormat is an enum type to indicate the underlying data format used. type PCMDataFormat uint8 const ( // DataTypeUnknown refers to an unknown format DataTypeUnknown PCMDataFormat = iota // DataTypeI8 indicates that the content of the audio buffer made of 8-bit integers. DataTypeI8 // DataTypeI16 indicates that the content of the audio buffer made of 16-bit integers. DataTypeI16 // DataTypeI32 indicates that the content of the audio buffer made of 32-bit integers. DataTypeI32 // DataTypeF32 indicates that the content of the audio buffer made of 32-bit floats. DataTypeF32 // DataTypeF64 indicates that the content of the audio buffer made of 64-bit floats. DataTypeF64 ) var _ Buffer = (*PCMBuffer)(nil) // PCMBuffer encapsulates uncompressed audio data // and provides useful methods to read/manipulate this PCM data. // It's a more flexible buffer type allowing the developer to handle // different kind of buffer data formats and convert between underlying // types. type PCMBuffer struct { // Format describes the format of the buffer data. Format *Format // I8 is a store for audio sample data as integers. I8 []int8 // I16 is a store for audio sample data as integers. I16 []int16 // I32 is a store for audio sample data as integers. I32 []int32 // F32 is a store for audio samples data as float64. F32 []float32 // F64 is a store for audio samples data as float64. F64 []float64 // DataType indicates the primary format used for the underlying data. // The consumer of the buffer might want to look at this value to know what store // to use to optimaly retrieve data. DataType PCMDataFormat // SourceBitDepth helps us know if the source was encoded on // 1 (int8), 2 (int16), 3(int24), 4(int32), 8(int64) bytes. SourceBitDepth uint8 } // Len returns the length of the underlying data. func (b *PCMBuffer) Len() int { if b == nil { return 0 } switch b.DataType { case DataTypeI8: return len(b.I8) case DataTypeI16: return len(b.I16) case DataTypeI32: return len(b.I32) case DataTypeF32: return len(b.F32) case DataTypeF64: return len(b.F64) default: return 0 } } // PCMFormat returns the buffer format information. func (b *PCMBuffer) PCMFormat() *Format { if b == nil { return nil } return b.Format } // NumFrames returns the number of frames contained in the buffer. func (b *PCMBuffer) NumFrames() int { if b == nil || b.Format == nil { return 0 } numChannels := b.Format.NumChannels if numChannels == 0 { numChannels = 1 } return b.Len() / numChannels } // AsFloatBuffer returns a copy of this buffer but with data converted to floats. func (b *PCMBuffer) AsFloatBuffer() *FloatBuffer { newB := &FloatBuffer{} newB.Data = b.AsF64() if b.Format != nil { newB.Format = &Format{ NumChannels: b.Format.NumChannels, SampleRate: b.Format.SampleRate, } } return newB } // AsFloat32Buffer implements the Buffer interface and returns a float 32 version of itself. func (b *PCMBuffer) AsFloat32Buffer() *Float32Buffer { newB := &Float32Buffer{} newB.Data = b.AsF32() if b.Format != nil { newB.Format = &Format{ NumChannels: b.Format.NumChannels, SampleRate: b.Format.SampleRate, } } return newB } // AsIntBuffer returns a copy of this buffer but with data truncated to Ints. func (b *PCMBuffer) AsIntBuffer() *IntBuffer { newB := &IntBuffer{} newB.Data = b.AsInt() if b.Format != nil { newB.Format = &Format{ NumChannels: b.Format.NumChannels, SampleRate: b.Format.SampleRate, } } return newB } // AsI8 returns the buffer's samples as int8 sample values. // If the buffer isn't in this format, a copy is created and converted. // Note that converting might result in loss of resolution. func (b *PCMBuffer) AsI8() (out []int8) { if b == nil { return nil } switch b.DataType { case DataTypeI8: return b.I8 case DataTypeI16: out = make([]int8, len(b.I16)) for i := 0; i < len(b.I16); i++ { out[i] = int8(b.I16[i]) } case DataTypeI32: out = make([]int8, len(b.I32)) for i := 0; i < len(b.I32); i++ { out[i] = int8(b.I32[i]) } case DataTypeF32: out = make([]int8, len(b.F32)) for i := 0; i < len(b.F32); i++ { out[i] = int8(b.F32[i]) } case DataTypeF64: out = make([]int8, len(b.F64)) for i := 0; i < len(b.F64); i++ { out[i] = int8(b.F64[i]) } } return out } // AsI16 returns the buffer's samples as int16 sample values. // If the buffer isn't in this format, a copy is created and converted. // Note that converting might result in loss of resolution. func (b *PCMBuffer) AsI16() (out []int16) { if b == nil { return nil } switch b.DataType { case DataTypeI8: out = make([]int16, len(b.I8)) for i := 0; i < len(b.I8); i++ { out[i] = int16(b.I8[i]) } case DataTypeI16: return b.I16 case DataTypeI32: out = make([]int16, len(b.I32)) for i := 0; i < len(b.I32); i++ { out[i] = int16(b.I32[i]) } case DataTypeF32: out = make([]int16, len(b.F32)) for i := 0; i < len(b.F32); i++ { out[i] = int16(b.F32[i]) } case DataTypeF64: out = make([]int16, len(b.F64)) for i := 0; i < len(b.F64); i++ { out[i] = int16(b.F64[i]) } } return out } // AsI32 returns the buffer's samples as int32 sample values. // If the buffer isn't in this format, a copy is created and converted. // Note that converting a float to an int might result in unexpected truncations. func (b *PCMBuffer) AsI32() (out []int32) { if b == nil { return nil } switch b.DataType { case DataTypeI8: out = make([]int32, len(b.I8)) for i := 0; i < len(b.I8); i++ { out[i] = int32(b.I8[i]) } case DataTypeI16: out = make([]int32, len(b.I16)) for i := 0; i < len(b.I16); i++ { out[i] = int32(b.I16[i]) } case DataTypeI32: return b.I32 case DataTypeF32: out = make([]int32, len(b.F32)) for i := 0; i < len(b.F32); i++ { out[i] = int32(b.F32[i]) } case DataTypeF64: out = make([]int32, len(b.F64)) for i := 0; i < len(b.F64); i++ { out[i] = int32(b.F64[i]) } } return out } // AsInt returns the buffer content as integers (int32s). // It's recommended to avoid this method since it creates // an extra copy of the buffer content. func (b *PCMBuffer) AsInt() (out []int) { int32s := b.AsI32() out = make([]int, len(int32s)) for i := 0; i < len(int32s); i++ { out[i] = int(int32s[i]) } return out } // AsF32 returns the buffer's samples as float32 sample values. // If the buffer isn't in this format, a copy is created and converted. // Note that converting might result in unexpected truncations. func (b *PCMBuffer) AsF32() (out []float32) { if b == nil { return nil } switch b.DataType { case DataTypeI8: bitDepth := b.calculateIntBitDepth() factor := math.Pow(2, 8*float64(bitDepth/8)-1) out = make([]float32, len(b.I8)) for i := 0; i < len(b.I8); i++ { out[i] = float32(float64(int64(b.I8[i])) / factor) } case DataTypeI16: bitDepth := b.calculateIntBitDepth() factor := math.Pow(2, 8*float64(bitDepth/8)-1) out = make([]float32, len(b.I16)) for i := 0; i < len(b.I16); i++ { out[i] = float32(float64(int64(b.I16[i])) / factor) } case DataTypeI32: bitDepth := b.calculateIntBitDepth() factor := math.Pow(2, 8*float64(bitDepth/8)-1) out = make([]float32, len(b.I16)) for i := 0; i < len(b.I16); i++ { out[i] = float32(float64(int64(b.I16[i])) / factor) } case DataTypeF32: return b.F32 case DataTypeF64: out = make([]float32, len(b.F64)) for i := 0; i < len(b.F64); i++ { out[i] = float32(b.F64[i]) } } return out } // AsF64 returns the buffer's samples as float64 sample values. // If the buffer isn't in this format, a copy is created and converted. // Note that converting might result in unexpected truncations. func (b *PCMBuffer) AsF64() (out []float64) { if b == nil { return nil } switch b.DataType { case DataTypeI8: bitDepth := b.calculateIntBitDepth() factor := math.Pow(2, 8*float64(bitDepth/8)-1) out = make([]float64, len(b.I8)) for i := 0; i < len(b.I8); i++ { out[i] = float64(int64(b.I8[i])) / factor } case DataTypeI16: bitDepth := b.calculateIntBitDepth() factor := math.Pow(2, 8*float64(bitDepth/8)-1) out = make([]float64, len(b.I16)) for i := 0; i < len(b.I16); i++ { out[i] = float64(int64(b.I16[i])) / factor } case DataTypeI32: bitDepth := b.calculateIntBitDepth() factor := math.Pow(2, 8*float64(bitDepth/8)-1) out = make([]float64, len(b.I16)) for i := 0; i < len(b.I16); i++ { out[i] = float64(int64(b.I16[i])) / factor } case DataTypeF32: out = make([]float64, len(b.F32)) for i := 0; i < len(b.F32); i++ { out[i] = float64(b.F32[i]) } case DataTypeF64: return b.F64 } return out } // Clone creates a clean clone that can be modified without // changing the source buffer. func (b *PCMBuffer) Clone() Buffer { if b == nil { return nil } newB := &PCMBuffer{DataType: b.DataType} switch b.DataType { case DataTypeI8: newB.I8 = make([]int8, len(b.I8)) copy(newB.I8, b.I8) case DataTypeI16: newB.I16 = make([]int16, len(b.I16)) copy(newB.I16, b.I16) case DataTypeI32: newB.I32 = make([]int32, len(b.I32)) copy(newB.I32, b.I32) case DataTypeF32: newB.F32 = make([]float32, len(b.F32)) copy(newB.F32, b.F32) case DataTypeF64: newB.F64 = make([]float64, len(b.F64)) copy(newB.F64, b.F64) } newB.Format = &Format{ NumChannels: b.Format.NumChannels, SampleRate: b.Format.SampleRate, } return newB } // SwitchPrimaryType is a convenience method to switch the primary data type. // Use this if you process/swap a different type than the original type. // Notes that conversion might be lossy if you switch to a lower resolution format. func (b *PCMBuffer) SwitchPrimaryType(t PCMDataFormat) { if b == nil || t == b.DataType { return } switch t { case DataTypeI8: b.I8 = b.AsI8() b.I16 = nil b.I32 = nil b.F32 = nil b.F64 = nil case DataTypeI16: b.I8 = nil b.I16 = b.AsI16() b.I32 = nil b.F32 = nil b.F64 = nil case DataTypeI32: b.I8 = nil b.I16 = nil b.I32 = b.AsI32() b.F32 = nil b.F64 = nil case DataTypeF32: b.I8 = nil b.I16 = nil b.I32 = nil b.F32 = b.AsF32() b.F64 = nil case DataTypeF64: b.I8 = nil b.I16 = nil b.I32 = nil b.F32 = nil b.F64 = b.AsF64() } b.DataType = t } // calculateIntBithDepth looks at the int values in the buffer and returns // the required lowest bit depth. func (b *PCMBuffer) calculateIntBitDepth() uint8 { if b == nil { return 0 } bitDepth := b.SourceBitDepth if bitDepth != 0 { return bitDepth } var max int64 switch b.DataType { case DataTypeI8: var i8max int8 for _, s := range b.I8 { if s > i8max { i8max = s } } max = int64(i8max) case DataTypeI16: var i16max int16 for _, s := range b.I16 { if s > i16max { i16max = s } } max = int64(i16max) case DataTypeI32: var i32max int32 for _, s := range b.I32 { if s > i32max { i32max = s } } max = int64(i32max) default: // This method is only meant to be used on int buffers. return bitDepth } bitDepth = 8 if max > 127 { bitDepth = 16 } // greater than int16, expecting int24 if max > 32767 { bitDepth = 24 } // int 32 if max > 8388607 { bitDepth = 32 } // int 64 if max > 4294967295 { bitDepth = 64 } return bitDepth }
vendor/github.com/go-audio/audio/pcm_buffer.go
0.724286
0.567877
pcm_buffer.go
starcoder
package mysorts // HeapSort implements Sort by MaxHeap in-place func HeapSort(in myInterface) { if in.Len() <= 1 { return } bh := binaryHeap{} bh.maxHeapity = bh.maxHeapityLoopBased //switch loop or rescurse based maxheapity here bh.buildMaxHeap(in) // first build max heap for i := in.Len(); i >= 2; i-- { // 1 started index here in.Swap(0, i-1) // move biggest element to the end bh.heapSize-- // then find the biggest and move it to root again //bh.maxHeapityRecursed(in, 1) //bh.maxHeapityLoopBased(in, 1) bh.maxHeapity(in, 1) } } // binaryHeap assoicate binary heap related methods // NOTE: an outside slice will be operated based on these methods. type binaryHeap struct { heapSize int maxHeapity func(myInterface, int) //maxHeapity func } /********************** Be aware that `i` in below functions are all started by 1, not 0 *****************/ func (m binaryHeap) leftChild(i int) int { return i * 2 } func (m binaryHeap) rightChild(i int) int { return i*2 + 1 } func (m binaryHeap) parent(i int) int { return i / 2 } // maxHeapityRecurseBased to keep max heap properties recursed // i is node index started by 1, only will be translated to 0 started index until operate array func (m *binaryHeap) maxHeapityRecurseBased(in myInterface, i int) { // i will be the parent in the maxHeapity procedure left := m.leftChild(i) right := m.rightChild(i) largest := i // find largest from i,left,right if left <= m.heapSize && in.Less(largest-1, left-1) { // translate to 0 started index to operate array largest = left } if right <= m.heapSize && in.Less(largest-1, right-1) { // translate to 0 started index to operate array largest = right } if largest != i { in.Swap(largest-1, i-1) // translate to 0 started index to operate array m.maxHeapityRecurseBased(in, largest) } } // maxHeapityLoopBased to keep max heap properties by loop // i is node index started by 1, only will be translated to 0 started index until operate array func (m *binaryHeap) maxHeapityLoopBased(in myInterface, i int) { for { // i will be the parent in the maxHeapity procedure left := m.leftChild(i) right := m.rightChild(i) largest := i // find largest from i,left,right if left <= m.heapSize && in.Less(largest-1, left-1) { // translate to 0 started index to operate array largest = left } if right <= m.heapSize && in.Less(largest-1, right-1) { // translate to 0 started index to operate array largest = right } if largest == i { break } in.Swap(largest-1, i-1) // translate to 0 started index to operate array i = largest } } func (m *binaryHeap) buildMaxHeap(in myInterface) { m.heapSize = in.Len() // start at in.Len()/2 because all leaf nodes don't need to do the `maxheapity` for i := in.Len() / 2; i >= 1; i-- { // 1 started index here //m.maxHeapityRecursed(in, i) //m.maxHeapityLoopBased(in, i) m.maxHeapity(in, i) } }
mysorts/heap_sort.go
0.662687
0.416441
heap_sort.go
starcoder
package models import ( i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time" i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" ) // GovernanceRoleAssignment type GovernanceRoleAssignment struct { Entity // The state of the assignment. The value can be Eligible for eligible assignment or Active if it is directly assigned Active by administrators, or activated on an eligible assignment by the users. assignmentState *string // For a non-permanent role assignment, this is the time when the role assignment will be expired. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z endDateTime *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time // The external ID the resource that is used to identify the role assignment in the provider. externalId *string // Read-only. If this is an active assignment and created due to activation on an eligible assignment, it represents the object of that eligible assignment; Otherwise, the value is null. linkedEligibleRoleAssignment GovernanceRoleAssignmentable // If this is an active assignment and created due to activation on an eligible assignment, it represents the ID of that eligible assignment; Otherwise, the value is null. linkedEligibleRoleAssignmentId *string // The type of member. The value can be: Inherited (if the role assignment is inherited from a parent resource scope), Group (if the role assignment is not inherited, but comes from the membership of a group assignment), or User (if the role assignment is neither inherited nor from a group assignment). memberType *string // Read-only. The resource associated with the role assignment. resource GovernanceResourceable // Required. The ID of the resource which the role assignment is associated with. resourceId *string // Read-only. The role definition associated with the role assignment. roleDefinition GovernanceRoleDefinitionable // Required. The ID of the role definition which the role assignment is associated with. roleDefinitionId *string // The start time of the role assignment. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z startDateTime *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time // The status property status *string // Read-only. The subject associated with the role assignment. subject GovernanceSubjectable // Required. The ID of the subject which the role assignment is associated with. subjectId *string } // NewGovernanceRoleAssignment instantiates a new governanceRoleAssignment and sets the default values. func NewGovernanceRoleAssignment()(*GovernanceRoleAssignment) { m := &GovernanceRoleAssignment{ Entity: *NewEntity(), } return m } // CreateGovernanceRoleAssignmentFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value func CreateGovernanceRoleAssignmentFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { return NewGovernanceRoleAssignment(), nil } // GetAssignmentState gets the assignmentState property value. The state of the assignment. The value can be Eligible for eligible assignment or Active if it is directly assigned Active by administrators, or activated on an eligible assignment by the users. func (m *GovernanceRoleAssignment) GetAssignmentState()(*string) { if m == nil { return nil } else { return m.assignmentState } } // GetEndDateTime gets the endDateTime property value. For a non-permanent role assignment, this is the time when the role assignment will be expired. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z func (m *GovernanceRoleAssignment) GetEndDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) { if m == nil { return nil } else { return m.endDateTime } } // GetExternalId gets the externalId property value. The external ID the resource that is used to identify the role assignment in the provider. func (m *GovernanceRoleAssignment) GetExternalId()(*string) { if m == nil { return nil } else { return m.externalId } } // GetFieldDeserializers the deserialization information for the current model func (m *GovernanceRoleAssignment) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { res := m.Entity.GetFieldDeserializers() res["assignmentState"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetAssignmentState(val) } return nil } res["endDateTime"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetTimeValue() if err != nil { return err } if val != nil { m.SetEndDateTime(val) } return nil } res["externalId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetExternalId(val) } return nil } res["linkedEligibleRoleAssignment"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetObjectValue(CreateGovernanceRoleAssignmentFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetLinkedEligibleRoleAssignment(val.(GovernanceRoleAssignmentable)) } return nil } res["linkedEligibleRoleAssignmentId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetLinkedEligibleRoleAssignmentId(val) } return nil } res["memberType"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetMemberType(val) } return nil } res["resource"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetObjectValue(CreateGovernanceResourceFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetResource(val.(GovernanceResourceable)) } return nil } res["resourceId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetResourceId(val) } return nil } res["roleDefinition"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetObjectValue(CreateGovernanceRoleDefinitionFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetRoleDefinition(val.(GovernanceRoleDefinitionable)) } return nil } res["roleDefinitionId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetRoleDefinitionId(val) } return nil } res["startDateTime"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetTimeValue() if err != nil { return err } if val != nil { m.SetStartDateTime(val) } return nil } res["status"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetStatus(val) } return nil } res["subject"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetObjectValue(CreateGovernanceSubjectFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetSubject(val.(GovernanceSubjectable)) } return nil } res["subjectId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetSubjectId(val) } return nil } return res } // GetLinkedEligibleRoleAssignment gets the linkedEligibleRoleAssignment property value. Read-only. If this is an active assignment and created due to activation on an eligible assignment, it represents the object of that eligible assignment; Otherwise, the value is null. func (m *GovernanceRoleAssignment) GetLinkedEligibleRoleAssignment()(GovernanceRoleAssignmentable) { if m == nil { return nil } else { return m.linkedEligibleRoleAssignment } } // GetLinkedEligibleRoleAssignmentId gets the linkedEligibleRoleAssignmentId property value. If this is an active assignment and created due to activation on an eligible assignment, it represents the ID of that eligible assignment; Otherwise, the value is null. func (m *GovernanceRoleAssignment) GetLinkedEligibleRoleAssignmentId()(*string) { if m == nil { return nil } else { return m.linkedEligibleRoleAssignmentId } } // GetMemberType gets the memberType property value. The type of member. The value can be: Inherited (if the role assignment is inherited from a parent resource scope), Group (if the role assignment is not inherited, but comes from the membership of a group assignment), or User (if the role assignment is neither inherited nor from a group assignment). func (m *GovernanceRoleAssignment) GetMemberType()(*string) { if m == nil { return nil } else { return m.memberType } } // GetResource gets the resource property value. Read-only. The resource associated with the role assignment. func (m *GovernanceRoleAssignment) GetResource()(GovernanceResourceable) { if m == nil { return nil } else { return m.resource } } // GetResourceId gets the resourceId property value. Required. The ID of the resource which the role assignment is associated with. func (m *GovernanceRoleAssignment) GetResourceId()(*string) { if m == nil { return nil } else { return m.resourceId } } // GetRoleDefinition gets the roleDefinition property value. Read-only. The role definition associated with the role assignment. func (m *GovernanceRoleAssignment) GetRoleDefinition()(GovernanceRoleDefinitionable) { if m == nil { return nil } else { return m.roleDefinition } } // GetRoleDefinitionId gets the roleDefinitionId property value. Required. The ID of the role definition which the role assignment is associated with. func (m *GovernanceRoleAssignment) GetRoleDefinitionId()(*string) { if m == nil { return nil } else { return m.roleDefinitionId } } // GetStartDateTime gets the startDateTime property value. The start time of the role assignment. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z func (m *GovernanceRoleAssignment) GetStartDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) { if m == nil { return nil } else { return m.startDateTime } } // GetStatus gets the status property value. The status property func (m *GovernanceRoleAssignment) GetStatus()(*string) { if m == nil { return nil } else { return m.status } } // GetSubject gets the subject property value. Read-only. The subject associated with the role assignment. func (m *GovernanceRoleAssignment) GetSubject()(GovernanceSubjectable) { if m == nil { return nil } else { return m.subject } } // GetSubjectId gets the subjectId property value. Required. The ID of the subject which the role assignment is associated with. func (m *GovernanceRoleAssignment) GetSubjectId()(*string) { if m == nil { return nil } else { return m.subjectId } } // Serialize serializes information the current object func (m *GovernanceRoleAssignment) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { err := m.Entity.Serialize(writer) if err != nil { return err } { err = writer.WriteStringValue("assignmentState", m.GetAssignmentState()) if err != nil { return err } } { err = writer.WriteTimeValue("endDateTime", m.GetEndDateTime()) if err != nil { return err } } { err = writer.WriteStringValue("externalId", m.GetExternalId()) if err != nil { return err } } { err = writer.WriteObjectValue("linkedEligibleRoleAssignment", m.GetLinkedEligibleRoleAssignment()) if err != nil { return err } } { err = writer.WriteStringValue("linkedEligibleRoleAssignmentId", m.GetLinkedEligibleRoleAssignmentId()) if err != nil { return err } } { err = writer.WriteStringValue("memberType", m.GetMemberType()) if err != nil { return err } } { err = writer.WriteObjectValue("resource", m.GetResource()) if err != nil { return err } } { err = writer.WriteStringValue("resourceId", m.GetResourceId()) if err != nil { return err } } { err = writer.WriteObjectValue("roleDefinition", m.GetRoleDefinition()) if err != nil { return err } } { err = writer.WriteStringValue("roleDefinitionId", m.GetRoleDefinitionId()) if err != nil { return err } } { err = writer.WriteTimeValue("startDateTime", m.GetStartDateTime()) if err != nil { return err } } { err = writer.WriteStringValue("status", m.GetStatus()) if err != nil { return err } } { err = writer.WriteObjectValue("subject", m.GetSubject()) if err != nil { return err } } { err = writer.WriteStringValue("subjectId", m.GetSubjectId()) if err != nil { return err } } return nil } // SetAssignmentState sets the assignmentState property value. The state of the assignment. The value can be Eligible for eligible assignment or Active if it is directly assigned Active by administrators, or activated on an eligible assignment by the users. func (m *GovernanceRoleAssignment) SetAssignmentState(value *string)() { if m != nil { m.assignmentState = value } } // SetEndDateTime sets the endDateTime property value. For a non-permanent role assignment, this is the time when the role assignment will be expired. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z func (m *GovernanceRoleAssignment) SetEndDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() { if m != nil { m.endDateTime = value } } // SetExternalId sets the externalId property value. The external ID the resource that is used to identify the role assignment in the provider. func (m *GovernanceRoleAssignment) SetExternalId(value *string)() { if m != nil { m.externalId = value } } // SetLinkedEligibleRoleAssignment sets the linkedEligibleRoleAssignment property value. Read-only. If this is an active assignment and created due to activation on an eligible assignment, it represents the object of that eligible assignment; Otherwise, the value is null. func (m *GovernanceRoleAssignment) SetLinkedEligibleRoleAssignment(value GovernanceRoleAssignmentable)() { if m != nil { m.linkedEligibleRoleAssignment = value } } // SetLinkedEligibleRoleAssignmentId sets the linkedEligibleRoleAssignmentId property value. If this is an active assignment and created due to activation on an eligible assignment, it represents the ID of that eligible assignment; Otherwise, the value is null. func (m *GovernanceRoleAssignment) SetLinkedEligibleRoleAssignmentId(value *string)() { if m != nil { m.linkedEligibleRoleAssignmentId = value } } // SetMemberType sets the memberType property value. The type of member. The value can be: Inherited (if the role assignment is inherited from a parent resource scope), Group (if the role assignment is not inherited, but comes from the membership of a group assignment), or User (if the role assignment is neither inherited nor from a group assignment). func (m *GovernanceRoleAssignment) SetMemberType(value *string)() { if m != nil { m.memberType = value } } // SetResource sets the resource property value. Read-only. The resource associated with the role assignment. func (m *GovernanceRoleAssignment) SetResource(value GovernanceResourceable)() { if m != nil { m.resource = value } } // SetResourceId sets the resourceId property value. Required. The ID of the resource which the role assignment is associated with. func (m *GovernanceRoleAssignment) SetResourceId(value *string)() { if m != nil { m.resourceId = value } } // SetRoleDefinition sets the roleDefinition property value. Read-only. The role definition associated with the role assignment. func (m *GovernanceRoleAssignment) SetRoleDefinition(value GovernanceRoleDefinitionable)() { if m != nil { m.roleDefinition = value } } // SetRoleDefinitionId sets the roleDefinitionId property value. Required. The ID of the role definition which the role assignment is associated with. func (m *GovernanceRoleAssignment) SetRoleDefinitionId(value *string)() { if m != nil { m.roleDefinitionId = value } } // SetStartDateTime sets the startDateTime property value. The start time of the role assignment. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z func (m *GovernanceRoleAssignment) SetStartDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() { if m != nil { m.startDateTime = value } } // SetStatus sets the status property value. The status property func (m *GovernanceRoleAssignment) SetStatus(value *string)() { if m != nil { m.status = value } } // SetSubject sets the subject property value. Read-only. The subject associated with the role assignment. func (m *GovernanceRoleAssignment) SetSubject(value GovernanceSubjectable)() { if m != nil { m.subject = value } } // SetSubjectId sets the subjectId property value. Required. The ID of the subject which the role assignment is associated with. func (m *GovernanceRoleAssignment) SetSubjectId(value *string)() { if m != nil { m.subjectId = value } }
models/governance_role_assignment.go
0.619701
0.573141
governance_role_assignment.go
starcoder
package hlopt import "github.com/koron/csvim/internal/highlight" // Coloring defines an interface to unify color number and name. type Coloring interface { ColorNr() highlight.ColorNr ColorName() highlight.ColorName } // CTermFg returns Option to apply a color to CTermFg field of Group. func CTermFg(c Coloring) highlight.Option { if c == nil { return nop } return highlight.OptionFunc(func(g *highlight.Group) { g.CTermFg = c.ColorNr() }) } // CTermBg returns Option to apply a color to CTermBg field of Group. func CTermBg(c Coloring) highlight.Option { if c == nil { return nop } return highlight.OptionFunc(func(g *highlight.Group) { g.CTermBg = c.ColorNr() }) } // GUIFg returns Option to apply a color to GUIFg field of Group. func GUIFg(c Coloring) highlight.Option { if c == nil { return nop } return highlight.OptionFunc(func(g *highlight.Group) { g.GUIFg = c.ColorName() }) } // GUIBg returns Option to apply a color to GUIBg field of Group. func GUIBg(c Coloring) highlight.Option { if c == nil { return nop } return highlight.OptionFunc(func(g *highlight.Group) { g.GUIBg = c.ColorName() }) } // GUISp returns Option to apply a color to GUISp field of Group. func GUISp(c Coloring) highlight.Option { if c == nil { return nop } return highlight.OptionFunc(func(g *highlight.Group) { g.GUISp = c.ColorName() }) } // Fg returns Option to apply a color to fields of Group: CTermFg and // GUIFg. func Fg(c Coloring) highlight.Option { if c == nil { return nop } return highlight.OptionFunc(func(g *highlight.Group) { g.CTermFg = c.ColorNr() g.GUIFg = c.ColorName() }) } // Bg returns Option to apply a color to fields of Group: CTermBg and // GUIBg. func Bg(c Coloring) highlight.Option { if c == nil { return nop } return highlight.OptionFunc(func(g *highlight.Group) { g.CTermBg = c.ColorNr() g.GUIBg = c.ColorName() }) } // Sp returns Option to apply a color to field of Group: GUISp. func Sp(c Coloring) highlight.Option { if c == nil { return nop } return highlight.OptionFunc(func(g *highlight.Group) { g.GUISp = c.ColorName() }) } // Color is scheme of a color, implements Coloring type Color struct { Nr highlight.ColorNr Name highlight.ColorName } // ColorNr implements Coloring interface. func (c Color) ColorNr() highlight.ColorNr { return c.Nr } // ColorName implements Coloring interface. func (c Color) ColorName() highlight.ColorName { return c.Name } // Colors is a set of Colors for Fg, Bg, Sp. type Colors struct { Fg Coloring Bg Coloring Sp Coloring } // Apply implements Option for Colors func (cs Colors) Apply(g *highlight.Group) { g.Apply(Fg(cs.Fg), Bg(cs.Bg), Sp(cs.Sp)) }
internal/hlopt/color.go
0.811863
0.482795
color.go
starcoder
package discovery_docs var AutoscalerV1beta2 = ` { "kind": "discovery#restDescription", "discoveryVersion": "v1", "id": "autoscaler:v1beta2", "name": "autoscaler", "version": "v1beta2", "revision": "20141002", "title": "Google Compute Engine Autoscaler API", "description": "The Google Compute Engine Autoscaler API provides autoscaling for groups of Cloud VMs.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { "x16": "http://www.google.com/images/icons/product/search-16.gif", "x32": "http://www.google.com/images/icons/product/search-32.gif" }, "documentationLink": "http://developers.google.com/compute/docs/autoscaler", "labels": [ "limited_availability" ], "protocol": "rest", "baseUrl": "https://www.googleapis.com/autoscaler/v1beta2/", "basePath": "/autoscaler/v1beta2/", "rootUrl": "https://www.googleapis.com/", "servicePath": "autoscaler/v1beta2/", "batchPath": "batch", "parameters": { "alt": { "type": "string", "description": "Data format for the response.", "default": "json", "enum": [ "json" ], "enumDescriptions": [ "Responses with Content-Type of application/json" ], "location": "query" }, "fields": { "type": "string", "description": "Selector specifying which fields to include in a partial response.", "location": "query" }, "key": { "type": "string", "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", "location": "query" }, "oauth_token": { "type": "string", "description": "OAuth 2.0 token for the current user.", "location": "query" }, "prettyPrint": { "type": "boolean", "description": "Returns response with indentations and line breaks.", "default": "true", "location": "query" }, "quotaUser": { "type": "string", "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.", "location": "query" }, "userIp": { "type": "string", "description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.", "location": "query" } }, "auth": { "oauth2": { "scopes": { "https://www.googleapis.com/auth/compute": { "description": "View and manage your Google Compute Engine resources" }, "https://www.googleapis.com/auth/compute.readonly": { "description": "View your Google Compute Engine resources" } } } }, "schemas": { "Autoscaler": { "id": "Autoscaler", "type": "object", "description": "Cloud Autoscaler resource.", "properties": { "autoscalingPolicy": { "$ref": "AutoscalingPolicy", "description": "Configuration parameters for autoscaling algorithm." }, "creationTimestamp": { "type": "string", "description": "[Output Only] Creation timestamp in RFC3339 text format." }, "description": { "type": "string", "description": "An optional textual description of the resource provided by the client." }, "id": { "type": "string", "description": "[Output Only] Unique identifier for the resource; defined by the server.", "format": "uint64" }, "kind": { "type": "string", "description": "Type of resource.", "default": "compute#autoscaler" }, "name": { "type": "string", "description": "Name of the Autoscaler resource. Must be unique per project and zone." }, "selfLink": { "type": "string", "description": "[Output Only] A self-link to the Autoscaler configuration resource." }, "target": { "type": "string", "description": "URL to the entity which will be autoscaled. Currently the only supported value is ReplicaPool?s URL. Note: it is illegal to specify multiple Autoscalers for the same target." } } }, "AutoscalerListResponse": { "id": "AutoscalerListResponse", "type": "object", "properties": { "items": { "type": "array", "description": "Autoscaler resources.", "items": { "$ref": "Autoscaler" } }, "kind": { "type": "string", "description": "Type of resource.", "default": "compute#autoscalerList" }, "nextPageToken": { "type": "string", "description": "[Output only] A token used to continue a truncated list request." } } }, "AutoscalingPolicy": { "id": "AutoscalingPolicy", "type": "object", "description": "Cloud Autoscaler policy.", "properties": { "coolDownPeriodSec": { "type": "integer", "description": "The number of seconds that the Autoscaler should wait between two succeeding changes to the number of virtual machines. You should define an interval that is at least as long as the initialization time of a virtual machine and the time it may take for replica pool to create the virtual machine. The default is 60 seconds.", "format": "int32" }, "cpuUtilization": { "$ref": "AutoscalingPolicyCpuUtilization", "description": "Exactly one utilization policy should be provided. Configuration parameters of CPU based autoscaling policy." }, "customMetricUtilizations": { "type": "array", "description": "Configuration parameters of autoscaling based on custom metric.", "items": { "$ref": "AutoscalingPolicyCustomMetricUtilization" } }, "loadBalancingUtilization": { "$ref": "AutoscalingPolicyLoadBalancingUtilization", "description": "Configuration parameters of autoscaling based on load balancer." }, "maxNumReplicas": { "type": "integer", "description": "The maximum number of replicas that the Autoscaler can scale up to.", "format": "int32" }, "minNumReplicas": { "type": "integer", "description": "The minimum number of replicas that the Autoscaler can scale down to.", "format": "int32" } } }, "AutoscalingPolicyCpuUtilization": { "id": "AutoscalingPolicyCpuUtilization", "type": "object", "description": "CPU utilization policy.", "properties": { "utilizationTarget": { "type": "number", "description": "The target utilization that the Autoscaler should maintain. It is represented as a fraction of used cores. For example: 6 cores used in 8-core VM are represented here as 0.75. Must be a float value between (0, 1]. If not defined, the default is 0.8.", "format": "double" } } }, "AutoscalingPolicyCustomMetricUtilization": { "id": "AutoscalingPolicyCustomMetricUtilization", "type": "object", "description": "Custom utilization metric policy.", "properties": { "metric": { "type": "string", "description": "Identifier of the metric. It should be a Cloud Monitoring metric. The metric can not have negative values. The metric should be an utilization metric (increasing number of VMs handling requests x times should reduce average value of the metric roughly x times). For example you could use: compute.googleapis.com/instance/network/received_bytes_count." }, "utilizationTarget": { "type": "number", "description": "Target value of the metric which Autoscaler should maintain. Must be a positive value.", "format": "double" }, "utilizationTargetType": { "type": "string", "description": "Defines type in which utilization_target is expressed." } } }, "AutoscalingPolicyLoadBalancingUtilization": { "id": "AutoscalingPolicyLoadBalancingUtilization", "type": "object", "description": "Load balancing utilization policy.", "properties": { "utilizationTarget": { "type": "number", "description": "Fraction of backend capacity utilization (set in HTTP load balancing configuration) that Autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8. For example if your maxRatePerInstance capacity (in HTTP Load Balancing configuration) is set at 10 and you would like to keep number of instances such that each instance receives 7 QPS on average, set this to 0.7.", "format": "double" } } }, "Operation": { "id": "Operation", "type": "object", "properties": { "clientOperationId": { "type": "string" }, "creationTimestamp": { "type": "string" }, "endTime": { "type": "string" }, "error": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "code": { "type": "string" }, "location": { "type": "string" }, "message": { "type": "string" } } } } } }, "httpErrorMessage": { "type": "string" }, "httpErrorStatusCode": { "type": "integer", "format": "int32" }, "id": { "type": "string", "format": "uint64" }, "insertTime": { "type": "string" }, "kind": { "type": "string", "description": "Type of the resource.", "default": "autoscaler#operation" }, "name": { "type": "string" }, "operationType": { "type": "string" }, "progress": { "type": "integer", "format": "int32" }, "region": { "type": "string" }, "selfLink": { "type": "string" }, "startTime": { "type": "string" }, "status": { "type": "string" }, "statusMessage": { "type": "string" }, "targetId": { "type": "string", "format": "uint64" }, "targetLink": { "type": "string" }, "user": { "type": "string" }, "warnings": { "type": "array", "items": { "type": "object", "properties": { "code": { "type": "string" }, "data": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string" }, "value": { "type": "string" } } } }, "message": { "type": "string" } } } }, "zone": { "type": "string" } } }, "OperationList": { "id": "OperationList", "type": "object", "properties": { "id": { "type": "string" }, "items": { "type": "array", "items": { "$ref": "Operation" } }, "kind": { "type": "string", "description": "Type of resource.", "default": "autoscaler#operationList" }, "nextPageToken": { "type": "string" }, "selfLink": { "type": "string" } } } }, "resources": { "autoscalers": { "methods": { "delete": { "id": "autoscaler.autoscalers.delete", "path": "projects/{project}/zones/{zone}/autoscalers/{autoscaler}", "httpMethod": "DELETE", "description": "Deletes the specified Autoscaler resource.", "parameters": { "autoscaler": { "type": "string", "description": "Name of the Autoscaler resource.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Project ID of Autoscaler resource.", "required": true, "location": "path" }, "zone": { "type": "string", "description": "Zone name of Autoscaler resource.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "zone", "autoscaler" ], "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/compute" ] }, "get": { "id": "autoscaler.autoscalers.get", "path": "projects/{project}/zones/{zone}/autoscalers/{autoscaler}", "httpMethod": "GET", "description": "Gets the specified Autoscaler resource.", "parameters": { "autoscaler": { "type": "string", "description": "Name of the Autoscaler resource.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Project ID of Autoscaler resource.", "required": true, "location": "path" }, "zone": { "type": "string", "description": "Zone name of Autoscaler resource.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "zone", "autoscaler" ], "response": { "$ref": "Autoscaler" }, "scopes": [ "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/compute.readonly" ] }, "insert": { "id": "autoscaler.autoscalers.insert", "path": "projects/{project}/zones/{zone}/autoscalers", "httpMethod": "POST", "description": "Adds new Autoscaler resource.", "parameters": { "project": { "type": "string", "description": "Project ID of Autoscaler resource.", "required": true, "location": "path" }, "zone": { "type": "string", "description": "Zone name of Autoscaler resource.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "zone" ], "request": { "$ref": "Autoscaler" }, "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/compute" ] }, "list": { "id": "autoscaler.autoscalers.list", "path": "projects/{project}/zones/{zone}/autoscalers", "httpMethod": "GET", "description": "Lists all Autoscaler resources in this zone.", "parameters": { "filter": { "type": "string", "location": "query" }, "maxResults": { "type": "integer", "default": "500", "format": "uint32", "minimum": "0", "maximum": "500", "location": "query" }, "pageToken": { "type": "string", "location": "query" }, "project": { "type": "string", "description": "Project ID of Autoscaler resource.", "required": true, "location": "path" }, "zone": { "type": "string", "description": "Zone name of Autoscaler resource.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "zone" ], "response": { "$ref": "AutoscalerListResponse" }, "scopes": [ "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/compute.readonly" ] }, "patch": { "id": "autoscaler.autoscalers.patch", "path": "projects/{project}/zones/{zone}/autoscalers/{autoscaler}", "httpMethod": "PATCH", "description": "Update the entire content of the Autoscaler resource. This method supports patch semantics.", "parameters": { "autoscaler": { "type": "string", "description": "Name of the Autoscaler resource.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Project ID of Autoscaler resource.", "required": true, "location": "path" }, "zone": { "type": "string", "description": "Zone name of Autoscaler resource.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "zone", "autoscaler" ], "request": { "$ref": "Autoscaler" }, "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/compute" ] }, "update": { "id": "autoscaler.autoscalers.update", "path": "projects/{project}/zones/{zone}/autoscalers/{autoscaler}", "httpMethod": "PUT", "description": "Update the entire content of the Autoscaler resource.", "parameters": { "autoscaler": { "type": "string", "description": "Name of the Autoscaler resource.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Project ID of Autoscaler resource.", "required": true, "location": "path" }, "zone": { "type": "string", "description": "Zone name of Autoscaler resource.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "zone", "autoscaler" ], "request": { "$ref": "Autoscaler" }, "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/compute" ] } } }, "zoneOperations": { "methods": { "delete": { "id": "autoscaler.zoneOperations.delete", "path": "{project}/zones/{zone}/operations/{operation}", "httpMethod": "DELETE", "description": "Deletes the specified zone-specific operation resource.", "parameters": { "operation": { "type": "string", "required": true, "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", "location": "path" }, "project": { "type": "string", "required": true, "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))", "location": "path" }, "zone": { "type": "string", "required": true, "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", "location": "path" } }, "parameterOrder": [ "project", "zone", "operation" ], "scopes": [ "https://www.googleapis.com/auth/compute" ] }, "get": { "id": "autoscaler.zoneOperations.get", "path": "{project}/zones/{zone}/operations/{operation}", "httpMethod": "GET", "description": "Retrieves the specified zone-specific operation resource.", "parameters": { "operation": { "type": "string", "required": true, "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", "location": "path" }, "project": { "type": "string", "required": true, "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))", "location": "path" }, "zone": { "type": "string", "required": true, "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", "location": "path" } }, "parameterOrder": [ "project", "zone", "operation" ], "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/compute.readonly" ] }, "list": { "id": "autoscaler.zoneOperations.list", "path": "{project}/zones/{zone}/operations", "httpMethod": "GET", "description": "Retrieves the list of operation resources contained within the specified zone.", "parameters": { "filter": { "type": "string", "location": "query" }, "maxResults": { "type": "integer", "default": "500", "format": "uint32", "minimum": "0", "maximum": "500", "location": "query" }, "pageToken": { "type": "string", "location": "query" }, "project": { "type": "string", "required": true, "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))", "location": "path" }, "zone": { "type": "string", "required": true, "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?", "location": "path" } }, "parameterOrder": [ "project", "zone" ], "response": { "$ref": "OperationList" }, "scopes": [ "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/compute.readonly" ] } } } } } `
gcloud_apis/discovery_docs/autoscaler_v1beta2.json.go
0.881373
0.447762
autoscaler_v1beta2.json.go
starcoder
package js type Error struct { Value } func (e Error) Error() string { return "" } type Type int const ( TypeUndefined Type = iota TypeNull TypeBoolean TypeNumber TypeString TypeSymbol TypeObject TypeFunction ) func Release(v Value) { v.release() } func (t Type) String() string { return "" } type TypedArray struct { Value } func (t TypedArray) Release() { t.Value.release() } func TypedArrayOf(slice interface{}) TypedArray { return TypedArray{} } type Value struct { ref uintptr } func (v Value) release() { refRelease(v.ref) } func Global() Value { return Value{ref: uintptr(8)} } func Null() Value { return Value{ref: uintptr(TypeNull)} } func Undefined() Value { return Value{ref: uintptr(TypeUndefined)} } func ValueOf(v interface{}) Value { switch t := v.(type) { case nil: return Null() case TypedArray: return t.Value case Callback: return t.Value case Value: return t case *Value: return Value{ref: t.ref} case bool: return Value{ref: newBool(t)} case int: return Value{ref: newInt(t)} case float32: return Value{ref: newFloat(t)} case float64: f := float32(t) return Value{ref: newFloat(f)} case string: ref := newString() for _, r := range t { appendString(ref, r) } return Value{ref: ref} case []interface{}: ref := newArray() for _, v := range t { val := ValueOf(v) pushRef(ref, val.ref) } return Value{ref: ref} } panic("unsupported type") } func (v Value) Bool() bool { if typeOf(v.ref) == TypeBoolean { return getBool(v.ref) } panic("not a bool") } func (v Value) Call(key string, args ...interface{}) Value { kv := ValueOf(key) defer kv.release() av := ValueOf(args) defer av.release() return Value{ref: call(v.ref, kv.ref, av.ref)} } func (v Value) Float() float32 { return getFloat(v.ref) } func (v Value) Get(key string) Value { kv := ValueOf(key) defer kv.release() return Value{ref: getRef(v.ref, kv.ref)} } func (v Value) Index(index int) Value { return Value{ref: getIndex(v.ref, index)} } func (v Value) InstanceOf(o Value) bool { if instanceOf(v.ref, o.ref) == 1 { return true } return false } func (v Value) Int() int { return getInt(v.ref) } func (v Value) Invoke(args ...interface{}) Value { av := ValueOf(args) defer av.release() return Value{ref: invoke(v.ref, av.ref)} } func (v Value) Length() int { return lengthOf(v.ref) } func (v Value) New(args ...interface{}) Value { av := ValueOf(args) defer av.release() return Value{ref: noo(v.ref, av.ref)} } func (v Value) Set(p string, i interface{}) { key := ValueOf(p) defer key.release() val, ok := i.(Value) if !ok { val = ValueOf(i) defer val.release() } setVal(v.ref, key.ref, val.ref) } func (v Value) SetIndex(index int, i interface{}) { val, ok := i.(Value) if !ok { val = ValueOf(i) defer val.release() } setIndex(v.ref, index, val.ref) } func (v Value) String() string { r := v.Call("toString") defer r.release() return toString(r.ref) } func (v Value) Type() Type { return typeOf(v.ref) }
js/js.go
0.59749
0.469946
js.go
starcoder
package hitmap import ( "log" "math" "sort" "github.com/go-spatial/geom" "github.com/go-spatial/geom/planar" ) func asGeomExtent(e [4]float64) *geom.Extent { ee := geom.Extent(e) return &ee } const ( Inside Always = Always(planar.Inside) Outside Always = Always(planar.Outside) ) // always will return the label for the point. type Always planar.Label func (a Always) LabelFor(_ [2]float64) planar.Label { return planar.Label(a) } func (a Always) Extent() [4]float64 { return [4]float64{math.Inf(-1), math.Inf(-1), math.Inf(1), math.Inf(1)} } func (a Always) Area() float64 { return math.Inf(1) } // PolygonHMSliceByAreaDec will allow you to sort a slice of PolygonHM in decending order type ByAreaDec []planar.HitMapper func (hm ByAreaDec) Len() int { return len(hm) } func (hm ByAreaDec) Swap(i, j int) { hm[i], hm[j] = hm[j], hm[i] } func (hm ByAreaDec) Less(i, j int) bool { ia, ja := hm[i].Area(), hm[j].Area() return ia < ja } // OrderedHM will iterate through a set of HitMaps looking for the first one to return // inside, if none of the hitmaps return inside it will return outside. type OrderedHM []planar.HitMapper func (hms OrderedHM) LabelFor(pt [2]float64) planar.Label { for i := range hms { if hms[i].LabelFor(pt) == planar.Inside { return planar.Inside } } return planar.Outside } // Extent is the accumlative extent of all the extens in the slice. func (hms OrderedHM) Extent() [4]float64 { e := new(geom.Extent) for i := range hms { e.Add(asGeomExtent(hms[i].Extent())) } return e.Extent() } // Area returns the area of the total extent of the hitmaps that are contain in the slice. func (hms OrderedHM) Area() float64 { return asGeomExtent(hms.Extent()).Area() } // NewOrderdHM will add the provided hitmaps in reverse order so that the last hit map is always tried first. func NewOrderedHM(hms ...planar.HitMapper) OrderedHM { ohm := make(OrderedHM, len(hms)) size := len(hms) - 1 for i := size; i >= 0; i-- { ohm[size-i] = hms[i] } return ohm } // NewHitMap will return a Polygon Hit map, a Ordered Hit Map, or a nil Hit map based on the geomtry type. func New(clipbox *geom.Extent, geo geom.Geometry) (planar.HitMapper, error) { switch g := geo.(type) { case geom.Polygoner: plyg := g.LinearRings() if debug { log.Printf("Settup up Polygon Hitmap") log.Printf("Polygon is: %v", plyg) log.Printf("Polygon rings: %v", len(plyg)) } return NewFromPolygons(nil, plyg) case geom.MultiPolygoner: if debug { log.Printf("Settup up MultiPolygon Hitmap") } return NewFromPolygons(nil, g.Polygons()...) case geom.Collectioner: if debug { log.Printf("Settup up Collections Hitmap") } geometries := g.Geometries() ghms := make([]planar.HitMapper, 0, len(geometries)) for i := range geometries { g, err := New(clipbox, geometries[i]) if err != nil { return nil, err } // skip empty hitmaps. if g == nil { continue } ghms = append(ghms, g) } sort.Sort(ByAreaDec(ghms)) return NewOrderedHM(ghms...), nil case geom.Pointer, geom.MultiPointer, geom.LineStringer, geom.MultiLineStringer: return nil, nil default: return nil, geom.ErrUnknownGeometry{geo} } }
planar/makevalid/hitmap/hitmap.go
0.651244
0.441372
hitmap.go
starcoder
package layout import ( "math" "time" s3mfile "github.com/heucuva/goaudiofile/music/tracked/s3m" "github.com/heucuva/gomixing/sampling" "github.com/heucuva/gomixing/volume" "gotracker/internal/format/s3m/playback/opl2" "gotracker/internal/format/s3m/playback/util" "gotracker/internal/player/intf" "gotracker/internal/player/note" ) // OPL2OperatorData is the operator data for an OPL2/Adlib instrument type OPL2OperatorData struct { // KeyScaleRateSelect returns true if the modulator's envelope scales with keys // If enabled, the envelopes of higher notes are played more quickly than those of lower notes. KeyScaleRateSelect bool // Sustain returns true if the modulator's envelope sustain is enabled // If enabled, the volume envelope stays at the sustain stage and does not enter the // release stage of the envelope until a note-off event is encountered. Otherwise, it // directly advances from the decay stage to the release stage without waiting for a // note-off event. Sustain bool // Vibrato returns true if the modulator's vibrato is enabled // If enabled, adds a vibrato effect with a depth of 7 cents (0.07 semitones). // The rate of this vibrato is a static 6.4Hz. Vibrato bool // Tremolo returns true if the modulator's tremolo is enabled // If enabled, adds a tremolo effect with a depth of 1dB. // The rate of this tremolo is a static 3.7Hz. Tremolo bool // FrequencyMultiplier returns the modulator's frequency multiplier // Multiplies the frequency of the operator with a value between 0.5 // (pitched one octave down) and 15. FrequencyMultiplier s3mfile.OPL2Multiple // KeyScaleLevel returns the key scale level // Attenuates the output level of the operators towards higher pitch by the given amount // (disabled, 1.5 dB / octave, 3 dB / octave, 6 dB / octave). KeyScaleLevel s3mfile.OPL2KSL // Volume returns the modulator's volume // The overall volume of the operator - if the modulator is in FM mode (i.e.: NOT in // additive synthesis mode), this will instead be the total pitch depth. Volume s3mfile.Volume // AttackRate returns the modulator's attack rate // Specifies how fast the volume envelope fades in from silence to peak volume. AttackRate uint8 // DecayRate returns the modulator's decay rate // Specifies how fast the volume envelope reaches the sustain volume after peaking. DecayRate uint8 // SustainLevel returns the modulator's sustain level // Specifies at which level the volume envelope is held before it is released. SustainLevel uint8 // ReleaseRate returns the modulator's release rate // Specifies how fast the volume envelope fades out from the sustain level. ReleaseRate uint8 // WaveformSelection returns the modulator's waveform selection WaveformSelection s3mfile.OPL2Waveform } // InstrumentOPL2 is an OPL2/Adlib instrument type InstrumentOPL2 struct { intf.Instrument Modulator OPL2OperatorData Carrier OPL2OperatorData // ModulationFeedback returns the modulation feedback ModulationFeedback s3mfile.OPL2Feedback // AdditiveSynthesis returns true if additive synthesis is enabled AdditiveSynthesis bool } type ym3812 struct { ch *opl2.SingleChannel data []int32 } // GetSample returns the sample at position `pos` in the instrument func (inst *InstrumentOPL2) GetSample(ioc *InstrumentOnChannel, pos sampling.Pos) volume.Matrix { ym := ioc.Data.(*ym3812) v0 := inst.getConvertedSample(ym.data, pos.Pos) if pos.Frac == 0 { return v0 } v1 := inst.getConvertedSample(ym.data, pos.Pos+1) for c, s := range v1 { v0[c] += volume.Volume(pos.Frac) * (s - v0[c]) } return v0 } func (inst *InstrumentOPL2) getConvertedSample(data []int32, pos int) volume.Matrix { if pos < 0 || pos >= len(data) { return volume.Matrix{} } o := make(volume.Matrix, 1) w := data[pos] o[0] = (volume.Volume(w)) / 65536.0 return o } var ym3812Channels [32]*opl2.SingleChannel // Initialize completes the setup of this instrument func (inst *InstrumentOPL2) Initialize(ioc *InstrumentOnChannel) error { chNum := ioc.OutputChannelNum ch := ym3812Channels[chNum] if ch == nil { rate := opl2.OPLRATE ch = opl2.NewSingleChannel(uint32(rate)) // support all waveforms ch.SupportAllWaveforms(true) ym3812Channels[chNum] = ch } ym := ym3812{ ch: ch, } ioc.Data = &ym return nil } // SetKeyOn sets the key on flag for the instrument func (inst *InstrumentOPL2) SetKeyOn(ioc *InstrumentOnChannel, semitone note.Semitone, on bool) { ym := ioc.Data.(*ym3812) ch := ym.ch // write the instrument to the channel! freq, block := inst.freqToFreqBlock(opl2.OPLRATE / 16) if !on { ch.WriteFNum(freq, block) ch.SetKeyOn(false) ym.data = nil } else { modReg20 := inst.getReg20(&inst.Modulator) modReg40 := inst.getReg40(&inst.Modulator) modReg60 := inst.getReg60(&inst.Modulator) modReg80 := inst.getReg80(&inst.Modulator) modRegE0 := inst.getRegE0(&inst.Modulator) carReg20 := inst.getReg20(&inst.Carrier) carReg40 := inst.getReg40(&inst.Carrier) carReg60 := inst.getReg60(&inst.Carrier) carReg80 := inst.getReg80(&inst.Carrier) carRegE0 := inst.getRegE0(&inst.Carrier) regC0 := inst.getRegC0() ch.WriteReg(0x20, 0, modReg20) ch.WriteReg(0x40, 0, modReg40) ch.WriteReg(0x60, 0, modReg60) ch.WriteReg(0x80, 0, modReg80) ch.WriteReg(0xE0, 0, modRegE0) ch.WriteFNum(freq, block) ch.WriteReg(0x20, 1, carReg20) ch.WriteReg(0x40, 1, carReg40) ch.WriteReg(0x60, 1, carReg60) ch.WriteReg(0x80, 1, carReg80) ch.WriteReg(0xE0, 1, carRegE0) ch.WriteC0(regC0) ch.SetKeyOn(true) } } func (inst *InstrumentOPL2) getReg20(o *OPL2OperatorData) uint8 { reg20 := uint8(0x00) if o.Tremolo { reg20 |= 0x80 } if o.Vibrato { reg20 |= 0x40 } if o.Sustain { reg20 |= 0x20 } if o.KeyScaleRateSelect { reg20 |= 0x10 } reg20 |= uint8(o.FrequencyMultiplier) & 0x0f return reg20 } func (inst *InstrumentOPL2) getReg40(o *OPL2OperatorData) uint8 { levelScale := o.KeyScaleLevel >> 1 levelScale |= (o.KeyScaleLevel << 1) & 2 //levelScale := o.KeyScaleLevel reg40 := uint8(0x00) reg40 |= uint8(levelScale) << 6 reg40 |= uint8(63-o.Volume) & 0x3f return reg40 } func (inst *InstrumentOPL2) getReg60(o *OPL2OperatorData) uint8 { reg60 := uint8(0x00) reg60 |= (o.AttackRate & 0x0f) << 4 reg60 |= o.DecayRate & 0x0f return reg60 } func (inst *InstrumentOPL2) getReg80(o *OPL2OperatorData) uint8 { reg80 := uint8(0x00) reg80 |= ((15 - o.SustainLevel) & 0x0f) << 4 reg80 |= o.ReleaseRate & 0x0f return reg80 } func (inst *InstrumentOPL2) getRegC0() uint8 { regC0 := uint8(0x00) //regC0 |= 0x40 | 0x20 // channel enable: right | left regC0 |= (uint8(inst.ModulationFeedback) & 0x07) << 1 if inst.AdditiveSynthesis { regC0 |= 0x01 } return regC0 } func (inst *InstrumentOPL2) getRegE0(o *OPL2OperatorData) uint8 { regE0 := uint8(0x00) regE0 |= uint8(o.WaveformSelection) & 0x03 return regE0 } // twoOperatorMelodic var twoOperatorMelodic = [18]uint32{0, 1, 2, 6, 7, 8, 12, 13, 14, 18, 19, 20, 24, 25, 26, 30, 31, 32} func (inst *InstrumentOPL2) getChannelIndex(channelIdx int) uint32 { return twoOperatorMelodic[channelIdx%18] } func (inst *InstrumentOPL2) semitoneToFreqBlock(semitone note.Semitone, c2spd note.C2SPD) (uint16, uint8) { targetFreq := float64(util.FrequencyFromSemitone(semitone, c2spd)) return inst.freqToFreqBlock(targetFreq / 256) } func (inst *InstrumentOPL2) freqToFreqBlock(targetFreq float64) (uint16, uint8) { bestBlk := uint8(8) bestMatchFreqNum := uint16(0) bestMatchFNDelta := float64(1024) for blk := uint8(0); blk < 8; blk++ { fNum := targetFreq * float64(uint32(1<<(20-blk))) / opl2.OPLRATE iNum := int(fNum) fp := fNum - float64(iNum) if iNum < 1024 && iNum >= 0 && fp < bestMatchFNDelta { bestBlk = blk bestMatchFreqNum = uint16(iNum) bestMatchFNDelta = fp } } return bestMatchFreqNum, bestBlk } func (inst *InstrumentOPL2) freqBlockToRegA0B0(freq uint16, block uint8) (uint8, uint8) { regA0 := uint8(freq) regB0 := uint8(uint16(freq)>>8) & 0x03 regB0 |= (block & 0x07) << 3 return regA0, regB0 } // GetKeyOn gets the key on flag for the instrument func (inst *InstrumentOPL2) GetKeyOn(ioc *InstrumentOnChannel) bool { ym := ioc.Data.(*ym3812) ch := ym.ch return ch.GetKeyOn() } // Update advances time by the amount specified by `tickDuration` func (inst *InstrumentOPL2) Update(ioc *InstrumentOnChannel, tickDuration time.Duration) { ym := ioc.Data.(*ym3812) ll := uint(math.Ceil(tickDuration.Seconds() * opl2.OPLRATE)) gen := make([]int32, ll) ym.ch.GenerateBlock2(ll, gen) ym.data = append(ym.data, gen...) }
internal/format/s3m/layout/instrument_opl2.go
0.614625
0.403302
instrument_opl2.go
starcoder
package titles import ( "sort" ) type ResultSet map[AID]Anime // Mapping of AIDs to Anime type Results []Anime // Returns a slice with the AIDs of all anime in the Results. func (res Results) AIDList() (aid []AID) { aid = make([]AID, 0, len(res)) for _, r := range res { aid = append(aid, r.AID) } return } // Converts the SearchMatches (which usually contains various duplicates) // into a ResultSet. Needs the same TitlesDatabase as was used to generate the // SearchMatches. func (matches SearchMatches) ToResultSet(db *TitlesDatabase) (rs ResultSet) { if matches == nil { return nil } db.RLock() defer db.RUnlock() rs = ResultSet{} for _, m := range matches { rs[m.AID] = *db.AnimeMap[m.AID] } return } func (rs ResultSet) unsortedResults() (res Results) { res = make(Results, 0, len(rs)) for _, r := range rs { res = append(res, r) } return } // Returns true if the first parameter should sort before the second parameter type ResultComparer func(*Anime, *Anime) bool var ( aidSort = func(a *Anime, b *Anime) bool { return a.AID < b.AID } titleSort = func(a *Anime, b *Anime) bool { return sort.StringSlice{a.PrimaryTitle, b.PrimaryTitle}.Less(0, 1) } ) // Returns the results sorted by AID func (rs ResultSet) ResultsByAID() (res Results) { return rs.ResultsByFunc(aidSort) } // Returns the results in inverse AID sort func (rs ResultSet) ReverseResultsByAID() (res Results) { return rs.ReverseResultsByFunc(aidSort) } // Returns the results sorted by Primary Title func (rs ResultSet) ResultsByPrimaryTitle() (res Results) { return rs.ResultsByFunc(titleSort) } // Returns the results in inverse Primary Title sort func (rs ResultSet) ReverseResultsByPrimaryTitle() (res Results) { return rs.ReverseResultsByFunc(titleSort) } // Returns the results sorted according to the given ResultComparer func (rs ResultSet) ResultsByFunc(f ResultComparer) (res Results) { res = rs.unsortedResults() f.Sort(res) return } // Returns the results sorted inversely according to the given ResultComparer func (rs ResultSet) ReverseResultsByFunc(f ResultComparer) (res Results) { res = rs.unsortedResults() f.ReverseSort(res) return }
titles/result.go
0.750553
0.449936
result.go
starcoder
package gis import ( "bytes" "math" ) const ( // EarthRadius is the radius of the earth. EarthRadius float64 = 6378137 // MinLatitude is the min latitude of the bing map. MinLatitude float64 = -85.05112878 // MaxLatitude is the max latitude of the bing map. MaxLatitude float64 = 85.05112878 // MinLongitude is the min longitude of the bing map. MinLongitude float64 = -180 // MaxLongitude is the max longitude of the bing map. MaxLongitude float64 = 180 ) // Clip clips a number to the specified minimum and maximum values. func Clip(n, minValue, maxValue float64) float64 { return math.Min(math.Max(n, minValue), maxValue) } // MapSize determines the map width and height (in pixels) at a specified level // of detail. func MapSize(levelOfDetail int) uint { return uint(256 << levelOfDetail) } // GroundResolution determines the ground resolution (in meters per pixel) at a specified // latitude and level of detail. func GroundResolution(latitude float64, levelOfDetail int) float64 { latitude = Clip(latitude, MinLatitude, MaxLatitude) return math.Cos(latitude*math.Pi/180) * 2 * math.Pi * EarthRadius / float64(MapSize(levelOfDetail)) } // MapScale determines the map scale at a specified latitude, level of detail, // and screen resolution. func MapScale(latitude float64, levelOfDetail, screenDpi int) float64 { return GroundResolution(latitude, levelOfDetail) * float64(screenDpi) / 0.0254 } // LatLongToPixelXY converts a point from latitude/longitude WGS-84 coordinates (in degrees) // into pixel XY coordinates at a specified level of detail. func LatLongToPixelXY(latitude, longitude float64, levelOfDetail int) (pixelX, pixelY int) { latitude = Clip(latitude, MinLatitude, MaxLatitude) longitude = Clip(longitude, MinLongitude, MaxLongitude) x := (longitude + 180) / 360 sinLatitude := math.Sin(latitude * math.Pi / 180) y := 0.5 - math.Log((1+sinLatitude)/(1-sinLatitude))/(4*math.Pi) mapSize := float64(MapSize(levelOfDetail)) pixelX = int(Clip(x*mapSize+0.5, 0, mapSize-1)) pixelY = int(Clip(y*mapSize+0.5, 0, mapSize-1)) return } // PixelXYToLatLong converts a pixel from pixel XY coordinates at a specified level of detail // into latitude/longitude WGS-84 coordinates (in degrees). func PixelXYToLatLong(pixelX, pixelY, levelOfDetail int) (latitude, longitude float64) { mapSize := float64(MapSize(levelOfDetail)) x := (Clip(float64(pixelX), 0, mapSize-1) / mapSize) - 0.5 y := 0.5 - (Clip(float64(pixelY), 0, mapSize-1) / mapSize) latitude = 90 - 360*math.Atan(math.Exp(-y*2*math.Pi))/math.Pi longitude = 360 * x return } // PixelXYToTileXY converts pixel XY coordinates into tile XY coordinates of the tile containing // the specified pixel. func PixelXYToTileXY(pixelX, pixelY int) (tileX, tileY int) { tileX = pixelX / 256 tileY = pixelY / 256 return } // TileXYToPixelXY converts tile XY coordinates into pixel XY coordinates of the upper-left pixel // of the specified tile. func TileXYToPixelXY(tileX, tileY int) (pixelX, pixelY int) { pixelX = tileX * 256 pixelY = tileY * 256 return } // TileXYToQuadKey converts tile XY coordinates into a QuadKey at a specified level of detail. func TileXYToQuadKey(tileX, tileY, levelOfDetail int) string { var quadKey bytes.Buffer for i := levelOfDetail; i > 0; i-- { digit := '0' mask := 1 << (i - 1) if (tileX & mask) != 0 { digit++ } if (tileY & mask) != 0 { digit++ digit++ } quadKey.WriteRune(digit) } return quadKey.String() } // QuadKeyToTileXY converts a QuadKey into tile XY coordinates. func QuadKeyToTileXY(quadKey string) (tileX, tileY, levelOfDetail int) { tileX, tileY = 0, 0 levelOfDetail = len(quadKey) for i := levelOfDetail; i > 0; i-- { mask := 1 << (i - 1) switch quadKey[levelOfDetail-i] { default: panic("Invalid QuadKey digit sequence.") case '0': case '1': tileX |= mask case '2': tileY |= mask case '3': tileX |= mask tileY |= mask } } return }
server/server/gis/tile_system.go
0.807764
0.761583
tile_system.go
starcoder
package main // O(n^3) time | O(n^2) space - where N is the height and width of the matrix func SquareOfZeroes(matrix [][]int) bool { infoMatrix := preComputeNumOfZeroes(matrix) n := len(matrix) for topRow := 0; topRow < n; topRow++ { for leftCol := 0; leftCol < n; leftCol++ { squareLen := 2 for squareLen <= n-leftCol && squareLen <= n-topRow { bottomRow := topRow + squareLen - 1 rightCol := leftCol + squareLen - 1 if isSquareOfZeroes(infoMatrix, topRow, leftCol, bottomRow, rightCol) { return true } squareLen += 1 } } } return false } type InfoEntry struct { NumZeroesRight int NumZeroesBelow int } // r1 is the top row, c1 is the left-most column // r2 is the bottom row, c2 is the right-most column func isSquareOfZeroes(infoMatrix [][]InfoEntry, r1, c1, r2, c2 int) bool { squareLen := c2 - c1 + 1 hasTopBorder := infoMatrix[r1][c1].NumZeroesRight >= squareLen hasLeftBorder := infoMatrix[r1][c1].NumZeroesBelow >= squareLen hasBottomBorder := infoMatrix[r2][c1].NumZeroesRight >= squareLen hasRightBorder := infoMatrix[r1][c2].NumZeroesBelow >= squareLen return hasTopBorder && hasLeftBorder && hasBottomBorder && hasRightBorder } func preComputeNumOfZeroes(matrix [][]int) [][]InfoEntry { infoMatrix := make([][]InfoEntry, len(matrix)) for i, row := range matrix { infoMatrix[i] = make([]InfoEntry, len(row)) } n := len(matrix) for row := 0; row < n; row++ { for col := 0; col < n; col++ { numZeroes := 0 if matrix[row][col] == 0 { numZeroes = 1 } infoMatrix[row][col] = InfoEntry{ NumZeroesBelow: numZeroes, NumZeroesRight: numZeroes, } } } lastIdx := len(matrix) - 1 for row := n - 1; row >= 0; row-- { for col := n - 1; col >= 0; col-- { if matrix[row][col] == 1 { continue } if row < lastIdx { infoMatrix[row][col].NumZeroesBelow += infoMatrix[row+1][col].NumZeroesBelow } if col < lastIdx { infoMatrix[row][col].NumZeroesRight += infoMatrix[row][col+1].NumZeroesRight } } } return infoMatrix }
src/dynamic-programming/extreme/square-of-zeroes/go/pre-compute.go
0.674479
0.492798
pre-compute.go
starcoder
package planar import ( "github.com/smyrman/units/linear" ) // Units for Area values. Always multiply with a unit when setting the initial value like you would for // time.Time. This prevents you from having to worry about the internal storage format. const ( SquearNanometer Area = 1e-36 SquearMicrometer Area = 1e-9 SquearMillimeter Area = 1 SquearCentimeter Area = 1e2 SquearDecimeter Area = 1e4 SquearMeter Area = 1e9 SquearKilometer Area = 1e36 SquearInch Area = Area(linear.Inch * linear.Inch) SquearFoot Area = Area(linear.Foot * linear.Foot) SquearChain Area = Area(linear.Chain * linear.Chain) Acre Area = Area(linear.Chain * linear.Furlong) SquearMile Area = Area(linear.Mile * linear.Mile) ) // SquearNanometers returns a as a floating point number of squearnanometers. func (a Area) SquearNanometers() float64 { return float64(a / SquearNanometer) } // SquearMicrometers returns a as a floating point number of squearmicrometers. func (a Area) SquearMicrometers() float64 { return float64(a / SquearMicrometer) } // SquearMillimeters returns a as a floating point number of squearmillimeters. func (a Area) SquearMillimeters() float64 { return float64(a / SquearMillimeter) } // SquearCentimeters returns a as a floating point number of squearcentimeters. func (a Area) SquearCentimeters() float64 { return float64(a / SquearCentimeter) } // SquearDecimeters returns a as a floating point number of squeardecimeters. func (a Area) SquearDecimeters() float64 { return float64(a / SquearDecimeter) } // SquearMeters returns a as a floating point number of squearmeters. func (a Area) SquearMeters() float64 { return float64(a / SquearMeter) } // SquearKilometers returns a as a floating point number of squearkilometers. func (a Area) SquearKilometers() float64 { return float64(a / SquearKilometer) } // SquearInches returns a as a floating point number of squearinches. func (a Area) SquearInches() float64 { return float64(a / SquearInch) } // SquearFeet returns a as a floating point number of squearfeet. func (a Area) SquearFeet() float64 { return float64(a / SquearFoot) } // Chains returns a as a floating point number of chains. func (a Area) Chains() float64 { return float64(a / SquearChain) } // Acre returns a as a floating point number of acre. func (a Area) Acre() float64 { return float64(a / Acre) } // SquearMiles returns a as a floating point number of squearmiles. func (a Area) SquearMiles() float64 { return float64(a / SquearMile) } // Abs returns the absolute value of a as a copy. func (a Area) Abs() Area { if a < 0 { return -a } return a } // Mul returns the product of a * x as a new Area. func (a Area) Mul(x float64) Area { return a * Area(x) } // Div returns the quotient of a / x as a new Area. func (a Area) Div(x float64) Area { return a / Area(x) } // DivArea returns the quotient of a / x as a floating point number. func (a Area) DivArea(x Area) float64 { return float64(a / x) }
planar/area_generated.go
0.928943
0.663069
area_generated.go
starcoder
package validator import ( "fmt" "math/big" "github.com/hyperledger/burrow/crypto" "github.com/tendermint/tendermint/types" ) // Safety margin determined by Tendermint (see comment on source constant) var maxTotalVotingPower = big.NewInt(types.MaxTotalVotingPower) type Bucket struct { // Delta tracks the changes to validator power made since the previous rotation Delta *Set // Previous the value for all validator powers at the point of the last rotation // (the sum of all the deltas over all rotations) - these are the history of the complete validator sets at each rotation Previous *Set // Tracks the current working version of the next set; Previous + Delta Next *Set // Flow tracks the absolute value of all flows (difference between previous cum bucket and current delta) towards and away from each validator (tracking each validator separately to avoid double counting flows made against the same validator Flow *Set } func NewBucket(initialSets ...Iterable) *Bucket { bucket := &Bucket{ Previous: NewTrimSet(), Next: NewTrimSet(), Delta: NewSet(), Flow: NewSet(), } for _, vs := range initialSets { vs.IterateValidators(func(id crypto.Addressable, power *big.Int) error { bucket.Previous.ChangePower(id.GetPublicKey(), power) bucket.Next.ChangePower(id.GetPublicKey(), power) return nil }) } return bucket } // Implement Reader func (vc *Bucket) Power(id crypto.Address) (*big.Int, error) { return vc.Previous.Power(id) } // Updates the current head bucket (accumulator) whilst func (vc *Bucket) AlterPower(id crypto.PublicKey, power *big.Int) (*big.Int, error) { const errHeader = "Bucket.AlterPower():" err := checkPower(power) if err != nil { return nil, fmt.Errorf("%s %v", errHeader, err) } // The max flow we are permitted to allow across all validators maxFlow := vc.Previous.MaxFlow() // The remaining flow we have to play with allowableFlow := new(big.Int).Sub(maxFlow, vc.Flow.totalPower) // The new absolute flow caused by this AlterPower flow := vc.Previous.Flow(id, power) absFlow := new(big.Int).Abs(flow) nextTotalPower := vc.Next.TotalPower() if nextTotalPower.Add(nextTotalPower, vc.Next.Flow(id, power)).Cmp(maxTotalVotingPower) == 1 { return nil, fmt.Errorf("%s cannot change validator power of %v from %v to %v because that would result "+ "in a total power greater than that allowed by tendermint (%v): would make next total power: %v", errHeader, id.GetAddress(), vc.Previous.GetPower(id.GetAddress()), power, maxTotalVotingPower, nextTotalPower) } // If we call vc.flow.ChangePower(id, absFlow) (below) will we induce a change in flow greater than the allowable // flow we have left to spend? if vc.Flow.Flow(id, absFlow).Cmp(allowableFlow) == 1 { return nil, fmt.Errorf("%s cannot change validator power of %v from %v to %v because that would result "+ "in a flow greater than or equal to 1/3 of total power for the next commit: flow induced by change: %v, "+ "current total flow: %v/%v (cumulative/max), remaining allowable flow: %v", errHeader, id.GetAddress(), vc.Previous.GetPower(id.GetAddress()), power, absFlow, vc.Flow.totalPower, maxFlow, allowableFlow) } // Set flow for this id to update flow.totalPower (total flow) for comparison below, keep track of flow for each id // so that we only count flow once for each id vc.Flow.ChangePower(id, absFlow) // Update Delta and Next vc.Delta.ChangePower(id, power) vc.Next.ChangePower(id, power) return absFlow, nil } func (vc *Bucket) SetPower(id crypto.PublicKey, power *big.Int) error { err := checkPower(power) if err != nil { return err } // The new absolute flow caused by this AlterPower absFlow := new(big.Int).Abs(vc.Previous.Flow(id, power)) // Set flow for this id to update flow.totalPower (total flow) for comparison below, keep track of flow for each id // so that we only count flow once for each id vc.Flow.ChangePower(id, absFlow) // Add to total power vc.Delta.ChangePower(id, power) vc.Next.ChangePower(id, power) return nil } func (vc *Bucket) CurrentSet() *Set { return vc.Previous } func (vc *Bucket) String() string { return fmt.Sprintf("Bucket{Previous: %v; Next: %v; Delta: %v}", vc.Previous, vc.Next, vc.Delta) } func (vc *Bucket) Equal(vwOther *Bucket) error { err := vc.Delta.Equal(vwOther.Delta) if err != nil { return fmt.Errorf("bucket delta != other bucket delta: %v", err) } err = vc.Previous.Equal(vwOther.Previous) if err != nil { return fmt.Errorf("bucket cum != other bucket cum: %v", err) } return nil } func checkPower(power *big.Int) error { if power.Sign() == -1 { return fmt.Errorf("cannot set negative validator power: %v", power) } if !power.IsInt64() { return fmt.Errorf("for tendermint compatibility validator power must fit within an int but %v "+ "does not", power) } return nil }
evmcc/vendor/github.com/hyperledger/burrow/acm/validator/bucket.go
0.660501
0.41834
bucket.go
starcoder
package frames import "fmt" // Segment divides signatures into signature segments. // This separation happens on wildcards or when the distance between frames is deemed too great. // E.g. a signature of [BOF 0: "ABCD"][PREV 0-20: "EFG"][PREV Wild: "HI"][EOF 0: "XYZ"] // has three segments: // 1. [BOF 0: "ABCD"][PREV 0-20: "EFG"] // 2. [PREV Wild: "HI"] // 3. [EOF 0: "XYZ"] // The Distance and Range options control the allowable distance and range between frames // (i.e. a fixed offset of 5000 distant might be acceptable, where a range of 1-2000 might not be). var costCount = 1 func (s Signature) Segment(dist, rng, cost, repetition int) []Signature { // first pass: segment just on wild, then check cost of further segmentation wildSegs := s.segment(-1, -1) ret := make([]Signature, 0, 1) for _, v := range wildSegs { if v.costly(cost) && v.repetitive(repetition) { ret = append(ret, machinify(v)) } else { segs := v.segment(dist, rng) for _, se := range segs { ret = append(ret, se) } } } return ret } func (s Signature) costly(cost int) bool { price := 1 for _, v := range s { mm, _, _ := v.MaxMatches(-1) price = price * mm if cost < price { return true } } return false } func (s Signature) repetitive(repetition int) bool { var price int ns := Blockify(s) if len(ns) < 2 { return false } pat := ns[0].Pattern for _, v := range ns[1:] { if v.Pattern.Equals(pat) { price += 1 } pat = v.Pattern } return price > repetition } func (s Signature) segment(dist, rng int) []Signature { if len(s) <= 1 { return []Signature{s} } segments := make([]Signature, 0, 1) segment := Signature{s[0]} thisDist, thisRng := dist, rng var lnk bool for i, frame := range s[1:] { if lnk, thisDist, thisRng = frame.Linked(s[i], thisDist, thisRng); lnk { segment = append(segment, frame) } else { segments = append(segments, segment) segment = Signature{frame} thisDist, thisRng = dist, rng } } return append(segments, segment) } type SigType int const ( Unknown SigType = iota BOFZero // fixed offset, zero length from BOF BOFWindow // offset is a window or fixed value greater than zero from BOF BOFWild Prev Succ EOFZero EOFWindow EOFWild ) // Simple characterisation of a segment: is it relative to the BOF, or the EOF, or is it a prev/succ segment. func (seg Signature) Characterise() SigType { if len(seg) == 0 { return Unknown } switch seg[len(seg)-1].Orientation() { case SUCC: return Succ case EOF: off := seg[len(seg)-1].Max switch { case off == 0: return EOFZero case off < 0: return EOFWild default: return EOFWindow } } switch seg[0].Orientation() { case PREV: return Prev case BOF: off := seg[0].Max switch { case off == 0: return BOFZero case off < 0: return BOFWild } } return BOFWindow } // position of a key frame in a segment: the length (minimum length in bytes), start and end indexes. // The keyframe can span multiple frames in the segment (if they are immediately adjacent and can make sequences) // which is why there is a start and end index // If length is 0, the segment goes to the frame matcher type Position struct { Length int Start int End int } func (p Position) String() string { return fmt.Sprintf("POS Length: %d; Start: %d; End: %d", p.Length, p.Start, p.End) } func VarLength(seg Signature, max int) Position { var cur int var current, greatest Position num := seg[0].NumSequences() if num > 0 && num <= max && NonZero(seg[0]) { current.Length, _ = seg[0].Length() greatest = Position{current.Length, 0, 1} cur = num } if len(seg) > 1 { for i, f := range seg[1:] { if lnk, _, _ := f.Linked(seg[i], 0, 0); lnk { num = f.NumSequences() if num > 0 && num <= max { if current.Length > 0 && cur*num <= max { l, _ := f.Length() current.Length += l current.End = i + 2 cur = cur * num } else { current.Length, _ = f.Length() current.Start, current.End = i+1, i+2 cur = num } } else { current.Length = 0 } } else { num = f.NumSequences() if num > 0 && num <= max && NonZero(seg[i+1]) { current.Length, _ = f.Length() current.Start, current.End = i+1, i+2 cur = num } else { current.Length = 0 } } if current.Length > greatest.Length { greatest = current } } } return greatest } func BOFLength(seg Signature, max int) Position { var cur int var pos Position num := seg[0].NumSequences() if num > 0 && num <= max { pos.Length, _ = seg[0].Length() pos.Start, pos.End = 0, 1 cur = num } if len(seg) > 1 { for i, f := range seg[1:] { if lnk, _, _ := f.Linked(seg[i], 0, 0); lnk { num = f.NumSequences() if num > 0 && num <= max { if pos.Length > 0 && cur*num <= max { l, _ := f.Length() pos.Length += l pos.End = i + 2 cur = cur * num continue } } } break } } return pos } func EOFLength(seg Signature, max int) Position { var cur int var pos Position num := seg[len(seg)-1].NumSequences() if num > 0 && num <= max { pos.Length, _ = seg[len(seg)-1].Length() pos.Start, pos.End = len(seg)-1, len(seg) cur = num } if len(seg) > 1 { for i := len(seg) - 2; i >= 0; i-- { f := seg[i] if lnk, _, _ := seg[i+1].Linked(f, 0, 0); lnk { num = f.NumSequences() if num > 0 && num <= max { if pos.Length > 0 && cur*num <= max { l, _ := f.Length() pos.Length += l pos.Start = i cur = cur * num continue } } } break } } return pos }
internal/bytematcher/frames/segments.go
0.643665
0.436742
segments.go
starcoder
package rfc3464 import ( "net/textproto" "strings" ) /* DSN is RFC3464 Delivery Status Notifications (DSN) Some fields of a DSN apply to all of the delivery attempts described by that DSN. At most, these fields may appear once in any DSN. These fields are used to correlate the DSN with the original message transaction and to provide additional information which may be useful to gateways. per-message-fields = [ original-envelope-id-field CRLF ] reporting-mta-field CRLF [ dsn-gateway-field CRLF ] [ received-from-mta-field CRLF ] [ arrival-date-field CRLF ] *( extension-field CRLF ) */ type DSN struct { /* 2.2.1 The Original-Envelope-Id field The optional Original-Envelope-Id field contains an "envelope identifier" that uniquely identifies the transaction during which the message was submitted, and was either (a) specified by the sender and supplied to the sender's MTA, or (b) generated by the sender's MTA and made available to the sender when the message was submitted. Its purpose is to allow the sender (or her user agent) to associate the returned DSN with the specific transaction in which the message was sent. If such an envelope identifier was present in the envelope that accompanied the message when it arrived at the Reporting MTA, it SHOULD be supplied in the Original-Envelope-Id field of any DSNs issued as a result of an attempt to deliver the message. Except when a DSN is issued by the sender's MTA, an MTA MUST NOT supply this field unless there is an envelope-identifier field in the envelope that accompanied this message on its arrival at the Reporting MTA. The Original-Envelope-Id field is defined as follows: original-envelope-id-field = "Original-Envelope-Id" ":" envelope-id envelope-id = *text There may be at most one Original-Envelope-Id field per DSN. The envelope-id is CASE-SENSITIVE. The DSN MUST preserve the original case and spelling of the envelope-id. NOTE: The Original-Envelope-Id is NOT the same as the Message-Id from the message header. The Message-Id identifies the content of the message, while the Original-Envelope-Id identifies the transaction in which the message is sent. */ OriginalEnvelopeID string /* 2.2.2 The Reporting-MTA DSN field reporting-mta-field = "Reporting-MTA" ":" mta-name-type ";" mta-name mta-name = *text The Reporting-MTA field is defined as follows: A DSN describes the results of attempts to deliver, relay, or gateway a message to one or more recipients. In all cases, the Reporting-MTA is the MTA that attempted to perform the delivery, relay, or gateway operation described in the DSN. This field is required. Note that if an SMTP client attempts to relay a message to an SMTP server and receives an error reply to a RCPT command, the client is responsible for generating the DSN, and the client's domain name will appear in the Reporting-MTA field. (The server's domain name will appear in the Remote-MTA field.) Note that the Reporting-MTA is not necessarily the MTA which actually issued the DSN. For example, if an attempt to deliver a message outside of the Internet resulted in a non-delivery notification which was gatewayed back into Internet mail, the Reporting-MTA field of the resulting DSN would be that of the MTA that originally reported the delivery failure, not that of the gateway which converted the foreign notification into a DSN. See Figure 2. sender's environment recipient's environment ............................ .......................................... : : (1) : : (2) +-----+ +--------+ +--------+ +---------+ +---------+ +------+ | | | | | | |Received-| | | | | | |=>|Original|=>| |->| From |->|Reporting|-->|Remote| | user| | MTA | | | | MTA | | MTA |<No| MTA | |agent| +--------+ |Gateway | +---------+ +----v----+ +------+ | | | | | | | <============| |<-------------------+ +-----+ | |(4) (3) +--------+ : : ...........................: :......................................... Figure 2. DSNs in the presence of gateways (1) message is gatewayed into recipient's environment (2) attempt to relay message fails (3) reporting-mta (in recipient's environment) returns non-delivery notification (4) gateway translates foreign notification into a DSN The mta-name portion of the Reporting-MTA field is formatted according to the conventions indicated by the mta-name-type sub-field. If an MTA functions as a gateway between dissimilar mail environments and thus is known by multiple names depending on the environment, the mta-name sub-field SHOULD contain the name used by the environment from which the message was accepted by the Reporting-MTA. Because the exact spelling of an MTA name may be significant in a particular environment, MTA names are CASE-SENSITIVE. */ ReportingMTA TypeValueField /* 2.2.3 The DSN-Gateway field The DSN-Gateway field indicates the name of the gateway or MTA that translated a foreign (non-Internet) delivery status notification into this DSN. This field MUST appear in any DSN that was translated by a gateway from a foreign system into DSN format, and MUST NOT appear otherwise. dsn-gateway-field = "DSN-Gateway" ":" mta-name-type ";" mta-name For gateways into Internet mail, the MTA-name-type will normally be "dns", and the mta-name will be the Internet domain name of the gateway. */ DsnGateway TypeValueField /* 2.2.4 The Received-From-MTA DSN field The optional Received-From-MTA field indicates the name of the MTA from which the message was received. received-from-mta-field = "Received-From-MTA" ":" mta-name-type ";" mta-name If the message was received from an Internet host via SMTP, the contents of the mta-name sub-field SHOULD be the Internet domain name supplied in the HELO or EHLO command, and the network address used by the SMTP client SHOULD be included as a comment enclosed in parentheses. (In this case, the MTA-name-type will be "dns".) The mta-name portion of the Received-From-MTA field is formatted according to the conventions indicated by the MTA-name-type sub- field. Since case is significant in some mail systems, the exact spelling, including case, of the MTA name SHOULD be preserved. */ ReceivedFromMTA TypeValueField /* 2.2.5 The Arrival-Date DSN field The optional Arrival-Date field indicates the date and time at which the message arrived at the Reporting MTA. If the Last-Attempt-Date field is also provided in a per-recipient field, this can be used to determine the interval between when the message arrived at the Reporting MTA and when the report was issued for that recipient. arrival-date-field = "Arrival-Date" ":" date-time The date and time are expressed in RFC 822 'date-time' format, as modified by RFC1123. Numeric timezones ([+/-]HHMM format) MUST be used. */ ArrivalDate string /* 2.3 Per-Recipient DSN fields A DSN contains information about attempts to deliver a message to one or more recipients. The delivery information for any particular recipient is contained in a group of contiguous per-recipient fields. Each group of per-recipient fields is preceded by a blank line. The syntax for the group of per-recipient fields is as follows: per-recipient-fields = [ original-recipient-field CRLF ] final-recipient-field CRLF action-field CRLF status-field CRLF [ remote-mta-field CRLF ] [ diagnostic-code-field CRLF ] [ last-attempt-date-field CRLF ] [ final-log-id-field CRLF ] [ will-retry-until-field CRLF ] *( extension-field CRLF ) */ Recipients []RecipientRecord /* 2.4 Extension fields Additional per-message or per-recipient DSN fields may be defined in the future by later revisions or extensions to this specification. Extension-field names beginning with "X-" will never be defined as standard fields; such names are reserved for experimental use. DSN field names NOT beginning with "X-" MUST be registered with the Internet Assigned Numbers Authority (IANA) and published in an RFC. Extension DSN fields may be defined for the following reasons: (a) To allow additional information from foreign delivery status reports to be tunneled through Internet DSNs. The names of such DSN fields should begin with an indication of the foreign environment name (e.g., X400-Physical-Forwarding-Address). (b) To allow the transmission of diagnostic information which is specific to a particular mail transport protocol. The names of such DSN fields should begin with an indication of the mail transport being used (e.g., SMTP-Remote-Recipient-Address). Such fields should be used for diagnostic purposes only and not by user agents or mail gateways. (c) To allow transmission of diagnostic information which is specific to a particular message transfer agent (MTA). The names of such DSN fields should begin with an indication of the MTA implementation that produced the DSN. (e.g., Foomail-Queue-ID). MTA implementers are encouraged to provide adequate information, via extension fields if necessary, to allow an MTA maintainer to understand the nature of correctable delivery failures and how to fix them. For example, if message delivery attempts are logged, the DSN might include information that allows the MTA maintainer to easily find the log entry for a failed delivery attempt. If an MTA developer does not wish to register the meanings of such extension fields, "X-" fields may be used for this purpose. To avoid name collisions, the name of the MTA implementation should follow the "X-", (e.g., "X-Foomail-Log-ID"). */ Extensions Extensions } func (dsn *DSN) fillFromHeader(hdr textproto.MIMEHeader) { dsn.Extensions = make(Extensions) var ( keyOriginalEnvelopeID = textproto.CanonicalMIMEHeaderKey("Original-Envelope-Id") keyReportingMTA = textproto.CanonicalMIMEHeaderKey("Reporting-MTA") keyDsnGateway = textproto.CanonicalMIMEHeaderKey("DSN-Gateway") keyReceivedFromMTA = textproto.CanonicalMIMEHeaderKey("Received-From-MTA") keyArrivalDate = textproto.CanonicalMIMEHeaderKey("Arrival-Date") ) for k, v := range hdr { val := strings.Join(v, "\n") switch k { case keyOriginalEnvelopeID: dsn.OriginalEnvelopeID = val case keyReportingMTA: dsn.ReportingMTA = ParseTypeValueField(val) case keyDsnGateway: dsn.DsnGateway = ParseTypeValueField(val) case keyReceivedFromMTA: dsn.ReceivedFromMTA = ParseTypeValueField(val) case keyArrivalDate: dsn.ArrivalDate = val default: dsn.Extensions.Set(k, val) } } }
rfc3464/DSN.go
0.528533
0.472136
DSN.go
starcoder
package queensproblembitarraysolver import ( "bytes" "io" "time" ba "github.com/golang-collections/go-datastructures/bitarray" ) func getIndex(x byte, y byte, sideLength byte) uint64 { // Note: No semicolons ;-) return (uint64)(y*sideLength + x) } func hasQueen(board ba.BitArray, sideLength byte, x byte, y byte) bool { // Note error handling here. Go has no exceptions. // By convention, errors are the last return value and of type `error` // (see https://gobyexample.com/errors) result, _ := board.GetBit(getIndex(x, y, sideLength)) return result } func tryPlaceQueen(board ba.BitArray, sideLength byte, x byte, y byte) bool { // Note: No parentheses ;-) if x >= sideLength || y >= sideLength { return false } if hasQueen(board, sideLength, x, y) { return false } var i byte for i = 1; i < sideLength; i++ { // The following calculations consider byte overflow (0-1 becoming 255) // Note declare-and-initialize syntax // (see https://gobyexample.com/variables) right, left, top, down := x+i, x-i, y-i, y+i rightInside, leftInside, topInside, downInside := right < sideLength, left < sideLength, top < sideLength, down < sideLength if (rightInside && (hasQueen(board, sideLength, right, y) || (topInside && hasQueen(board, sideLength, right, top)) || (downInside && hasQueen(board, sideLength, right, down)))) || (leftInside && (hasQueen(board, sideLength, left, y) || (topInside && hasQueen(board, sideLength, left, top)) || (downInside && hasQueen(board, sideLength, left, down)))) || (topInside && hasQueen(board, sideLength, x, top)) || (downInside && hasQueen(board, sideLength, x, down)) { return false } } board.SetBit(getIndex(x, y, sideLength)) return true } func removeQueen(board ba.BitArray, sideLength byte, x byte, y byte) bool { if x >= sideLength || y >= sideLength { return false } board.ClearBit(getIndex(x, y, sideLength)) return true } // Print prints the given chess board to the given writer func Print(board ba.BitArray, sideLength byte, w io.Writer) { // Credits: Original code for this method see https://github.com/danrl/golibby/blob/9dd8757e94746578c5a9c0e4ca9d5a347fd7de32/queensboard/queensboard.go#L207 // Under MIT license (https://github.com/danrl/golibby/blob/master/LICENSE) // Note naming schema: Uppercase functions are exported, lowercase functions are local // board framing var top, middle, bottom bytes.Buffer top.WriteRune('┏') middle.WriteRune('┠') bottom.WriteRune('┗') var j byte for j = 1; j < sideLength; j++ { top.Write([]byte("━━┯")) middle.Write([]byte("──┼")) bottom.Write([]byte("━━┷")) } top.Write([]byte("━━┓\n")) middle.Write([]byte("──┨\n")) bottom.Write([]byte("━━┛\n")) // compile the field out := bytes.NewBuffer(top.Bytes()) var i byte for i = 0; i < sideLength; i++ { out.WriteRune('┃') var j byte for j = 0; j < sideLength; j++ { if hasQueen, _ := board.GetBit(getIndex(j, i, sideLength)); hasQueen { out.WriteRune('.') out.WriteRune(' ') } else { out.WriteRune(' ') out.WriteRune(' ') } if j < (sideLength - 1) { out.WriteRune('│') } } out.Write([]byte("┃\n")) if i < (sideLength - 1) { out.Write(middle.Bytes()) } } out.Write(bottom.Bytes()) w.Write(out.Bytes()) } func findSolutions(board ba.BitArray, sideLength byte, x byte, solutions []ba.BitArray) []ba.BitArray { var i byte for i = 0; i < sideLength; i++ { if tryPlaceQueen(board, sideLength, x, i) { if x == (sideLength - 1) { solutions = append(solutions, ba.NewBitArray((uint64)(sideLength*sideLength)).Or(board)) removeQueen(board, sideLength, x, i) return solutions } solutions = findSolutions(board, sideLength, x+1, solutions) removeQueen(board, sideLength, x, i) } } return solutions } // Result represents the result of the search for solutions to an n queens problem type Result struct { Solutions []ba.BitArray CalculationTime time.Duration } // FindSolutions finds all solutions of the queens problem on a chess board with the given side length func FindSolutions(sideLength byte) Result { start := time.Now() solutions := findSolutions(ba.NewBitArray((uint64)(sideLength*sideLength)), sideLength, 0, make([]ba.BitArray, 0)) return Result{ Solutions: solutions, CalculationTime: time.Since(start), } }
queens-problem/queens-problem-bitarray-solver/queens-problem-bitarray-solver.go
0.852445
0.435361
queens-problem-bitarray-solver.go
starcoder
package strdist import ( "strings" "unicode/utf8" "github.com/nickwells/golem/mathutil" ) // DfltLevenshteinFinder is a Finder with some suitable default values // suitable for a Levenshtein algorithm already set. var DfltLevenshteinFinder *Finder // CaseBlindLevenshteinFinder is a Finder with some suitable default // values suitable for a Levenshtein algorithm already set. CaseMod is set to // ForceToLower. var CaseBlindLevenshteinFinder *Finder func init() { var err error DfltLevenshteinFinder, err = NewLevenshteinFinder( DfltMinStrLen, DfltLevenshteinThreshold, NoCaseChange) if err != nil { panic("Cannot construct the default LevenshteinFinder: " + err.Error()) } CaseBlindLevenshteinFinder, err = NewLevenshteinFinder( DfltMinStrLen, DfltLevenshteinThreshold, ForceToLower) if err != nil { panic("Cannot construct the case-blind LevenshteinFinder: " + err.Error()) } } // DfltLevenshteinThreshold is a default value for deciding whether a distance // between two strings is sufficiently small for them to be considered // similar const DfltLevenshteinThreshold = 5.0 // LevenshteinAlgo encapsulates the details needed to provide the Levenshtein // distance. type LevenshteinAlgo struct { s string } // NewLevenshteinFinder returns a new Finder having a Levenshtein algo // and an error which will be non-nil if the parameters are invalid - see // NewFinder for details. func NewLevenshteinFinder(minStrLen int, threshold float64, cm CaseMod) (*Finder, error) { return NewFinder(minStrLen, threshold, cm, &LevenshteinAlgo{}) } // Prep for a LevenshteinAlgo will pre-calculate the lower-case equivalent for // the target string if the caseMod is set to ForceToLower func (a *LevenshteinAlgo) Prep(s string, cm CaseMod) { if cm == ForceToLower { a.s = strings.ToLower(s) return } a.s = s } // Dist for a LevenshteinAlgo will calculate the Levenshtein distance between // the two strings func (a *LevenshteinAlgo) Dist(_, s string, cm CaseMod) float64 { if cm == ForceToLower { return float64(LevenshteinDistance(a.s, strings.ToLower(s))) } return float64(LevenshteinDistance(a.s, s)) } // LevenshteinDistance calculates the Levenshtein distance between strings a // and b func LevenshteinDistance(a, b string) int { aLen := utf8.RuneCountInString(a) bLen := utf8.RuneCountInString(b) d := make([][]int, aLen+1) for i := range d { d[i] = make([]int, bLen+1) d[i][0] = i } for i := 1; i <= bLen; i++ { d[0][i] = i } for j, bRune := range b { for i, aRune := range a { var subsCost int if aRune != bRune { subsCost = 1 } del := d[i][j+1] + 1 ins := d[i+1][j] + 1 sub := d[i][j] + subsCost d[i+1][j+1] = mathutil.MinOfInt(del, ins, sub) } } return d[aLen][bLen] }
strdist/levenshtein.go
0.611962
0.467332
levenshtein.go
starcoder
package Alien_Dictionary import ( "strings" ) /* * Alien Dictionary There is a dictionary containing words from an alien language for which we don’t know the ordering of the alphabets. Write a method to find the correct order of the alphabets in the alien language. It is given that the input is a valid dictionary and there exists an ordering among its alphabets. Input: Words: ["ba", "bc", "ac", "cab"] Output: bac Explanation: Given that the words are sorted lexicographically by the rules of the alien language, so from the given words we can conclude the following ordering among its characters: 1. From "ba" and "bc", we can conclude that 'a' comes before 'c'. 2. From "bc" and "ac", we can conclude that 'b' comes before 'a' From the above two points, we can conclude that the correct character order is: "bac" Input: Words: ["cab", "aaa", "aab"] Output: cab Explanation: From the given words we can conclude the following ordering among its characters: 1. From "cab" and "aaa", we can conclude that 'c' comes before 'a'. 2. From "aaa" and "aab", we can conclude that 'a' comes before 'b' From the above two points, we can conclude that the correct character order is: "cab" Input: Words: ["ywx", "wz", "xww", "xz", "zyy", "zwz"] Output: ywxz Explanation: From the given words we can conclude the following ordering among its characters: 1. From "ywx" and "wz", we can conclude that 'y' comes before 'w'. 2. From "wz" and "xww", we can conclude that 'w' comes before 'x'. 3. From "xww" and "xz", we can conclude that 'w' comes before 'z' 4. From "xz" and "zyy", we can conclude that 'x' comes before 'z' 5. From "zyy" and "zwz", we can conclude that 'y' comes before 'w' From the above five points, we can conclude that the correct character order is: "ywxz" */ func findOrder(words []string) string { var ( graph = make(map[rune][]rune) inDegree = make(map[rune]int) queue = make([]rune, 0) res = strings.Builder{} ) n := len(words) for _, s := range words { for _, c := range s { graph[c] = make([]rune, 0) inDegree[c] = 0 } } for i := 0; i < n-1; i++ { w1, w2 := words[i], words[i+1] for j := 0; j < min(len(w1), len(w2)); j++ { var parent, child = rune(w1[j]), rune(w2[j]) if parent != child { graph[parent] = append(graph[parent], child) inDegree[child]++ break } } } for k, v := range inDegree { if v == 0 { queue = append(queue, k) } } for len(queue) != 0 { vertex := queue[0] queue = queue[1:] res.WriteRune(vertex) for _, v := range graph[vertex] { inDegree[v]-- if inDegree[v] == 0 { queue = append(queue, v) } } } return res.String() } func min(x, y int) int { if x < y { return x } return y }
Pattern16 - Topological Sort/Alien_Dictionary/solution.go
0.628977
0.587204
solution.go
starcoder
package iso20022 // Provides information and details on the status of a trade. type TradeData11 struct { // Represents the original reference of the instruction for which the status is given, as assigned by the participant that submitted the foreign exchange trade. OriginatorReference *Max35Text `xml:"OrgtrRef,omitempty"` // Reference to the unique system identification assigned to the trade by the central matching system. MatchingSystemUniqueReference *Max35Text `xml:"MtchgSysUnqRef"` // Reference to the unique matching identification assigned to the trade and to the matching trade from the counterparty by the central matching system. MatchingSystemMatchingReference *Max35Text `xml:"MtchgSysMtchgRef,omitempty"` // Unique reference from the central settlement system that allows the removal of alleged trades once the matched status notification for the matching side has been received. MatchingSystemMatchedSideReference *Max35Text `xml:"MtchgSysMtchdSdRef,omitempty"` // The current settlement date of the notification. CurrentSettlementDate *ISODate `xml:"CurSttlmDt,omitempty"` // Settlement date has been amended. NewSettlementDate *ISODate `xml:"NewSttlmDt,omitempty"` // Specifies the date and time at which the current status was assigned to the individual trade. CurrentStatusDateTime *ISODateTime `xml:"CurStsDtTm,omitempty"` // Product type of the individual trade. ProductType *Max35Text `xml:"PdctTp,omitempty"` // To indicate the requested CLS settlement session that the related trade is part of. SettlementSessionIdentifier *Exact4AlphaNumericText `xml:"SttlmSsnIdr,omitempty"` // Information that is to be provided to trade repositories in the context of the regulatory standards around over-the-counter (OTC) derivatives, central counterparties and trade repositories. RegulatoryReporting *RegulatoryReporting4 `xml:"RgltryRptg,omitempty"` } func (t *TradeData11) SetOriginatorReference(value string) { t.OriginatorReference = (*Max35Text)(&value) } func (t *TradeData11) SetMatchingSystemUniqueReference(value string) { t.MatchingSystemUniqueReference = (*Max35Text)(&value) } func (t *TradeData11) SetMatchingSystemMatchingReference(value string) { t.MatchingSystemMatchingReference = (*Max35Text)(&value) } func (t *TradeData11) SetMatchingSystemMatchedSideReference(value string) { t.MatchingSystemMatchedSideReference = (*Max35Text)(&value) } func (t *TradeData11) SetCurrentSettlementDate(value string) { t.CurrentSettlementDate = (*ISODate)(&value) } func (t *TradeData11) SetNewSettlementDate(value string) { t.NewSettlementDate = (*ISODate)(&value) } func (t *TradeData11) SetCurrentStatusDateTime(value string) { t.CurrentStatusDateTime = (*ISODateTime)(&value) } func (t *TradeData11) SetProductType(value string) { t.ProductType = (*Max35Text)(&value) } func (t *TradeData11) SetSettlementSessionIdentifier(value string) { t.SettlementSessionIdentifier = (*Exact4AlphaNumericText)(&value) } func (t *TradeData11) AddRegulatoryReporting() *RegulatoryReporting4 { t.RegulatoryReporting = new(RegulatoryReporting4) return t.RegulatoryReporting }
TradeData11.go
0.744471
0.516961
TradeData11.go
starcoder
package scanner import ( "bufio" "bytes" "errors" "fmt" "io" "strings" "sql/token" "sql/tools" ) type Scanner interface { // Scan reads the next token from the scanner. Scan() (pos token.Pos, tok token.Token, lit string) // ScanRegex reads a regex token from the scanner. ScanRegex() (pos token.Pos, tok token.Token, lit string) // Peek returns the next rune that would be read by the scanner. Peek() rune // Unscan pushes the previously token back onto the buffer. Unscan() } // bufScanner represents a wrapper for scanner to add a buffer. // It provides a fixed-length circular buffer that can be unread. type bufScanner struct { s *scanner i int // buffer index n int // buffer size buf [3]struct { tok token.Token pos token.Pos lit string } } // NewScanner returns a new buffered scanner for a reader. func NewScanner(r io.Reader) Scanner { return &bufScanner{s: newScanner(r)} } // Scan reads the next token from the scanner. func (s *bufScanner) Scan() (pos token.Pos, tok token.Token, lit string) { return s.ScanFunc(s.s.Scan) } // ScanRegex reads a regex token from the scanner. func (s *bufScanner) ScanRegex() (pos token.Pos, tok token.Token, lit string) { return s.ScanFunc(s.s.ScanRegex) } // ScanFunc uses the provided function to scan the next token. func (s *bufScanner) ScanFunc(scan func() (token.Pos, token.Token, string)) (pos token.Pos, tok token.Token, lit string) { // If we have unread tokens then read them off the buffer first. if s.n > 0 { s.n-- return s.curr() } // Move buffer position forward and save the token. s.i = (s.i + 1) % len(s.buf) buf := &s.buf[s.i] buf.pos, buf.tok, buf.lit = scan() return s.curr() } func (s *bufScanner) Peek() rune { r, _, _ := s.s.r.ReadRune() if r != EOF { _ = s.s.r.UnreadRune() } return r } // Unscan pushes the previously token back onto the buffer. func (s *bufScanner) Unscan() { s.n++ } // curr returns the last read token. func (s *bufScanner) curr() (pos token.Pos, tok token.Token, lit string) { buf := &s.buf[(s.i-s.n+len(s.buf))%len(s.buf)] return buf.pos, buf.tok, buf.lit } // scanner represents a lexical scanner for CnosQL. type scanner struct { r *reader } // newScanner returns a new instance of scanner. func newScanner(r io.Reader) *scanner { return &scanner{r: &reader{r: bufio.NewReader(r)}} } // Scan returns the next token and position from the underlying reader. // Also returns the literal text read for strings, numbers, and duration tokens // since these token types can have different literal representations. func (s *scanner) Scan() (pos token.Pos, tok token.Token, lit string) { // Read next code point. ch0, pos := s.r.read() // If we see whitespace then consume all contiguous whitespace. // If we see a letter, or certain acceptable special characters, then consume // as an ident or reserved word. if tools.IsWhitespace(ch0) { return s.scanWhitespace() } else if tools.IsLetter(ch0) || ch0 == '_' { s.r.unread() return s.scanIdent(true) } else if tools.IsDigit(ch0) { return s.scanNumber() } // Otherwise, parse individual characters. switch ch0 { case EOF: return pos, token.EOF, "" case '"': s.r.unread() return s.scanIdent(true) case '\'': return s.scanString() case '.': ch1, _ := s.r.read() s.r.unread() if tools.IsDigit(ch1) { return s.scanNumber() } return pos, token.DOT, "" case '$': _, tok, lit = s.scanIdent(false) if tok != token.IDENT { return pos, tok, "$" + lit } return pos, token.BOUNDPARAM, "$" + lit case '+': return pos, token.ADD, "" case '-': ch1, _ := s.r.read() if ch1 == '-' { s.skipUntilNewline() return pos, token.COMMENT, "" } s.r.unread() return pos, token.SUB, "" case '*': return pos, token.MUL, "" case '/': ch1, _ := s.r.read() if ch1 == '*' { if err := s.skipUntilEndComment(); err != nil { return pos, token.ILLEGAL, "" } return pos, token.COMMENT, "" } else { s.r.unread() } return pos, token.DIV, "" case '%': return pos, token.MOD, "" case '&': return pos, token.BITAND, "" case '|': return pos, token.BITOR, "" case '^': return pos, token.BITXOR, "" case '=': if ch1, _ := s.r.read(); ch1 == '~' { return pos, token.EQREGEX, "" } s.r.unread() return pos, token.EQ, "" case '!': if ch1, _ := s.r.read(); ch1 == '=' { return pos, token.NEQ, "" } else if ch1 == '~' { return pos, token.NEQREGEX, "" } s.r.unread() case '>': if ch1, _ := s.r.read(); ch1 == '=' { return pos, token.GTE, "" } s.r.unread() return pos, token.GT, "" case '<': if ch1, _ := s.r.read(); ch1 == '=' { return pos, token.LTE, "" } else if ch1 == '>' { return pos, token.NEQ, "" } s.r.unread() return pos, token.LT, "" case '(': return pos, token.LPAREN, "" case ')': return pos, token.RPAREN, "" case ',': return pos, token.COMMA, "" case ';': return pos, token.SEMICOLON, "" case ':': if ch1, _ := s.r.read(); ch1 == ':' { return pos, token.DOUBLECOLON, "" } s.r.unread() return pos, token.COLON, "" } return pos, token.ILLEGAL, string(ch0) } // scanWhitespace consumes the current rune and all contiguous whitespace. func (s *scanner) scanWhitespace() (pos token.Pos, tok token.Token, lit string) { // Create a buffer and read the current character into it. var buf strings.Builder ch, pos := s.r.curr() _, _ = buf.WriteRune(ch) // Read every subsequent whitespace character into the buffer. // Non-whitespace characters and EOF will cause the loop to exit. for { ch, _ = s.r.read() if ch == EOF { break } else if !tools.IsWhitespace(ch) { s.r.unread() break } else { _, _ = buf.WriteRune(ch) } } return pos, token.WS, buf.String() } // skipUntilNewline skips characters until it reaches a newline. func (s *scanner) skipUntilNewline() { for { if ch, _ := s.r.read(); ch == '\n' || ch == EOF { return } } } // skipUntilEndComment skips characters until it reaches a '*/' symbol. func (s *scanner) skipUntilEndComment() error { for { if ch1, _ := s.r.read(); ch1 == '*' { // We might be at the end. star: ch2, _ := s.r.read() if ch2 == '/' { return nil } else if ch2 == '*' { // We are back in the state machine since we see a star. goto star } else if ch2 == EOF { return io.EOF } } else if ch1 == EOF { return io.EOF } } } func (s *scanner) scanIdent(lookup bool) (pos token.Pos, tok token.Token, lit string) { // Save the starting position of the identifier. _, pos = s.r.read() s.r.unread() var buf strings.Builder for { if ch, _ := s.r.read(); ch == EOF { break } else if ch == '"' { pos0, tok0, lit0 := s.scanString() if tok0 == token.BADSTRING || tok0 == token.BADESCAPE { return pos0, tok0, lit0 } return pos, token.IDENT, lit0 } else if tools.IsIdentChar(ch) { s.r.unread() buf.WriteString(ScanBareIdent(s.r)) } else { s.r.unread() break } } lit = buf.String() // If the literal matches a keyword then return that keyword. if lookup { if tok = token.Lookup(lit); tok != token.IDENT { return pos, tok, "" } } return pos, token.IDENT, lit } // scanString consumes a contiguous string of non-quote characters. // Quote characters can be consumed if they're first escaped with a backslash. func (s *scanner) scanString() (pos token.Pos, tok token.Token, lit string) { s.r.unread() _, pos = s.r.curr() var err error lit, err = ScanString(s.r) if err == errBadString { return pos, token.BADSTRING, lit } else if err == errBadEscape { _, pos = s.r.curr() return pos, token.BADESCAPE, lit } return pos, token.STRING, lit } // ScanRegex consumes a token to find escapes func (s *scanner) ScanRegex() (pos token.Pos, tok token.Token, lit string) { _, pos = s.r.curr() // Start & end sentinels. start, end := '/', '/' // Valid escape chars. escapes := map[rune]rune{'/': '/'} b, err := ScanDelimited(s.r, start, end, escapes, true) if err == errBadEscape { _, pos = s.r.curr() return pos, token.BADESCAPE, lit } else if err != nil { return pos, token.BADREGEX, lit } return pos, token.REGEX, string(b) } // scanNumber consumes anything that looks like the start of a number. func (s *scanner) scanNumber() (pos token.Pos, tok token.Token, lit string) { var buf strings.Builder // Check if the initial rune is a ".". ch, pos := s.r.curr() if ch == '.' { // Peek and see if the next rune is a digit. ch1, _ := s.r.read() s.r.unread() if !tools.IsDigit(ch1) { return pos, token.ILLEGAL, "." } // Unread the full stop so we can read it later. s.r.unread() } else { s.r.unread() } // Read as many digits as possible. _, _ = buf.WriteString(s.scanDigits()) // If next code points are a full stop and digit then consume them. isDecimal := false if ch0, _ := s.r.read(); ch0 == '.' { isDecimal = true if ch1, _ := s.r.read(); tools.IsDigit(ch1) { _, _ = buf.WriteRune(ch0) _, _ = buf.WriteRune(ch1) _, _ = buf.WriteString(s.scanDigits()) } else { s.r.unread() } } else { s.r.unread() } // Read as a duration or integer if it doesn't have a fractional part. if !isDecimal { // If the next rune is a letter then this is a duration token. if ch0, _ := s.r.read(); tools.IsLetter(ch0) || ch0 == 'µ' { _, _ = buf.WriteRune(ch0) for { ch1, _ := s.r.read() if !tools.IsLetter(ch1) && ch1 != 'µ' { s.r.unread() break } _, _ = buf.WriteRune(ch1) } // Continue reading digits and letters as part of this token. for { if ch0, _ := s.r.read(); tools.IsLetter(ch0) || ch0 == 'µ' || tools.IsDigit(ch0) { _, _ = buf.WriteRune(ch0) } else { s.r.unread() break } } return pos, token.DURATIONVAL, buf.String() } else { s.r.unread() return pos, token.INTEGER, buf.String() } } return pos, token.NUMBER, buf.String() } // scanDigits consumes a contiguous series of digits. func (s *scanner) scanDigits() string { var buf strings.Builder for { ch, _ := s.r.read() if !tools.IsDigit(ch) { s.r.unread() break } _, _ = buf.WriteRune(ch) } return buf.String() } // reader represents a buffered rune reader used by the scanner. // It provides a fixed-length circular buffer that can be unread. type reader struct { r io.RuneScanner i int // buffer index n int // buffer char count pos token.Pos // last read rune position buf [3]struct { ch rune pos token.Pos } eof bool // true if reader has ever seen eof. } // ReadRune reads the next rune from the reader. // This is a wrapper function to implement the io.RuneReader interface. // Note that this function does not return size. func (r *reader) ReadRune() (ch rune, size int, err error) { ch, _ = r.read() if ch == EOF { err = io.EOF } return } // UnreadRune pushes the previously read rune back onto the buffer. // This is a wrapper function to implement the io.RuneScanner interface. func (r *reader) UnreadRune() error { r.unread() return nil } // read reads the next rune from the reader. func (r *reader) read() (ch rune, pos token.Pos) { // If we have unread characters then read them off the buffer first. if r.n > 0 { r.n-- return r.curr() } // Read next rune from underlying reader. // Any error (including io.EOF) should return as EOF. ch, _, err := r.r.ReadRune() if err != nil { ch = EOF } else if ch == '\r' { if ch, _, err := r.r.ReadRune(); err != nil { // nop } else if ch != '\n' { _ = r.r.UnreadRune() } ch = '\n' } // Save character and position to the buffer. r.i = (r.i + 1) % len(r.buf) buf := &r.buf[r.i] buf.ch, buf.pos = ch, r.pos // Update position. // Only count EOF once. if ch == '\n' { r.pos.Line++ r.pos.Char = 0 } else if !r.eof { r.pos.Char++ } // Mark the reader as EOF. // This is used so we don't double count EOF characters. if ch == EOF { r.eof = true } return r.curr() } // unread pushes the previously read rune back onto the buffer. func (r *reader) unread() { r.n++ } // curr returns the last read character and position. func (r *reader) curr() (ch rune, pos token.Pos) { i := (r.i - r.n + len(r.buf)) % len(r.buf) buf := &r.buf[i] return buf.ch, buf.pos } // EOF is a marker code point to signify that the reader can't read any more. const EOF = rune(0) // ScanDelimited reads a delimited set of runes func ScanDelimited(r io.RuneScanner, start, end rune, escapes map[rune]rune, escapesPassThru bool) ([]byte, error) { // Scan start delimiter. if ch, _, err := r.ReadRune(); err != nil { return nil, err } else if ch != start { return nil, fmt.Errorf("expected %s; found %s", string(start), string(ch)) } var buf bytes.Buffer for { ch0, _, err := r.ReadRune() if ch0 == end { return buf.Bytes(), nil } else if err != nil { return buf.Bytes(), err } else if ch0 == '\n' { return nil, errors.New("delimited text contains new line") } else if ch0 == '\\' { // If the next character is an escape then write the escaped char. // If it's not a valid escape then return an error. ch1, _, err := r.ReadRune() if err != nil { return nil, err } c, ok := escapes[ch1] if !ok { if escapesPassThru { // Unread ch1 (char after the \) _ = r.UnreadRune() // Write ch0 (\) to the output buffer. _, _ = buf.WriteRune(ch0) continue } else { buf.Reset() _, _ = buf.WriteRune(ch0) _, _ = buf.WriteRune(ch1) return buf.Bytes(), errBadEscape } } _, _ = buf.WriteRune(c) } else { _, _ = buf.WriteRune(ch0) } } } // ScanString reads a quoted string from a rune reader. func ScanString(r io.RuneScanner) (string, error) { ending, _, err := r.ReadRune() if err != nil { return "", errBadString } var buf strings.Builder for { ch0, _, err := r.ReadRune() if ch0 == ending { return buf.String(), nil } else if err != nil || ch0 == '\n' { return buf.String(), errBadString } else if ch0 == '\\' { // If the next character is an escape then write the escaped char. // If it's not a valid escape then return an error. ch1, _, _ := r.ReadRune() if ch1 == 'n' { _, _ = buf.WriteRune('\n') } else if ch1 == '\\' { _, _ = buf.WriteRune('\\') } else if ch1 == '"' { _, _ = buf.WriteRune('"') } else if ch1 == '\'' { _, _ = buf.WriteRune('\'') } else { return string(ch0) + string(ch1), errBadEscape } } else { _, _ = buf.WriteRune(ch0) } } } var errBadString = errors.New("bad string") var errBadEscape = errors.New("bad escape") // ScanBareIdent reads bare identifier from a rune reader. func ScanBareIdent(r io.RuneScanner) string { // Read every ident character into the buffer. // Non-ident characters and EOF will cause the loop to exit. var buf strings.Builder for { ch, _, err := r.ReadRune() if err != nil { break } else if !tools.IsIdentChar(ch) { _ = r.UnreadRune() break } else { _, _ = buf.WriteRune(ch) } } return buf.String() }
scanner/scanner.go
0.675229
0.426859
scanner.go
starcoder
package dilithium import ( "golang.org/x/crypto/sha3" ) //Poly represents a polynomial of deg n with coefs in [0, Q) type Poly [n]int32 //freeze calls Freeze on each coef func (a *Poly) freeze() { for i := 0; i < n; i++ { a[i] = freeze(a[i]) } } //reduce calls Reduce32 on each coef func (a *Poly) reduce() { for i := 0; i < n; i++ { a[i] = reduce32(a[i]) } } //add two Poly without normalization func add(a, b Poly) Poly { var c Poly for i := 0; i < n; i++ { c[i] = a[i] + b[i] } return c } //addQ calls addQ on eah coefficient func (a *Poly) addQ() { for i := 0; i < n; i++ { a[i] = addQ(a[i]) } } //sub substracts b from a without normalization func sub(a, b Poly) Poly { var c Poly for i := 0; i < n; i++ { c[i] = a[i] - b[i] } return c } //shift mult all coefs by 2^d func (a *Poly) shift() { for i := 0; i < n; i++ { a[i] <<= d } } //montMul perfroms pointwise mutl (to be used with nTT Poly) //poly_pointwise_montgomery in ref implementation func montMul(a, b Poly) Poly { var c Poly for i := 0; i < n; i++ { c[i] = montgomeryReduce(int64(a[i]) * int64(b[i])) } return c } //isBelow returns true if all coefs are in [Q-b, Q+b] func (a Poly) isBelow(bound int32) bool { res := true if bound > (q-1)/8 { return false } for i := 0; i < n; i++ { t := a[i] >> 31 t = a[i] - (t & 2 * a[i]) res = res && (t < bound) } return res } //rej fills a with coefs in [0, Q) generated with buf using rejection sampling func rej(a []int32, buf []byte) int { ctr, buflen, alen := 0, len(buf), len(a) for pos := 0; pos+3 < buflen && ctr < alen; pos += 3 { var t uint32 t = uint32(buf[pos]) t |= uint32(buf[pos+1]) << 8 t |= uint32(buf[pos+2]) << 16 t &= 0x7fffff if t < q { a[ctr] = int32(t) ctr++ } } return ctr } //polyUniform samples a polynomial with coefs in [0, Q] func polyUniform(seed [SEEDBYTES]byte, nonce uint16) Poly { var a Poly var outbuf [5 * shake128Rate]byte state := sha3.NewShake128() state.Write(seed[:]) state.Write([]byte{byte(nonce), byte(nonce >> 8)}) state.Read(outbuf[:]) ctr := rej(a[:], outbuf[:]) for ctr < n { off := 5 * shake128Rate % 3 for i := 0; i < off; i++ { outbuf[i] = outbuf[5*shake128Rate-off+i] } state.Read(outbuf[off:]) ctr += rej(a[ctr:], outbuf[:]) } return a } //rejEta fills a with coefs in [0, ETA) generated with buf using rejection sampling func rejEta(a []int32, buf []byte, ETA int32) int { ctr, buflen, alen := 0, len(buf), len(a) for pos := 0; pos < buflen && ctr < alen; pos++ { var t0, t1 int32 t0 = int32(buf[pos]) & 0x0F t1 = int32(buf[pos]) >> 4 if ETA == 2 { if t0 < 15 { t0 -= (205 * t0 >> 10) * 5 a[ctr] = ETA - t0 ctr++ } if t1 < 15 && ctr < alen { t1 -= (205 * t1 >> 10) * 5 a[ctr] = ETA - t1 ctr++ } } if ETA == 4 { if t0 < 9 { a[ctr] = ETA - t0 ctr++ } if t1 < 9 && ctr < alen { a[ctr] = ETA - t1 ctr++ } } } return ctr } //polyUniformEta samples a polynomial with coefs in [Q-eta, Q+eta] func polyUniformEta(seed [2 * SEEDBYTES]byte, nonce uint16, ETA int32) Poly { var a Poly blocks := 1 //ETA == 2 if ETA == 4 { blocks = 2 } outbuf := make([]byte, shake256Rate*blocks) state := sha3.NewShake256() state.Write(seed[:]) state.Write([]byte{uint8(nonce), uint8(nonce >> 8)}) state.Read(outbuf[:]) ctr := rejEta(a[:], outbuf[:], ETA) for ctr < n { sub := outbuf[:shake256Rate] state.Read(sub) ctr += rejEta(a[ctr:], sub, ETA) } return a } //polyUniformGamma1 samples a polynomial with coefs in [Q-gamma1, Q+gamma1] func polyUniformGamma1(rhoP [2 * SEEDBYTES]byte, nonce uint16, GAMMA1 int32) Poly { var outbuf [shake256Rate * 5]byte state := sha3.NewShake256() state.Write(rhoP[:]) state.Write([]byte{uint8(nonce), uint8(nonce >> 8)}) state.Read(outbuf[:]) POLYSIZE := 640 if GAMMA1 == (q-1)/88 { POLYSIZE = 576 } a := unpackZ(outbuf[:], 1, POLYSIZE, GAMMA1) return a[0] } //equal returns true if b is equal to a (all coefs are) func (a Poly) equal(b Poly) bool { res := true for i := 0; i < n; i++ { if a[i] != b[i] { res = false } } return res } //polyPower2Round calls power2Round on each coef func polyPower2Round(p Poly) (Poly, Poly) { var p1, p0 Poly for j := 0; j < n; j++ { p1[j], p0[j] = power2Round(p[j]) } return p1, p0 } //polyDecompose calls decompose on each coef func polyDecompose(p Poly, GAMMA2 int32) (Poly, Poly) { var p1, p0 Poly for j := 0; j < n; j++ { p1[j], p0[j] = decompose(p[j], GAMMA2) } return p1, p0 } //polyUseHint uses the hint to correct the hight bits of u func polyUseHint(u, h Poly, GAMMA2 int32) Poly { var p Poly for j := 0; j < n; j++ { p[j] = useHint(u[j], h[j], GAMMA2) } return p } //tomont converts a poly to its montgomery representation func (p *Poly) tomont() { for i := 0; i < n; i++ { p[i] = montgomeryReduce(int64(p[i])) } } //fromMont converts back to [0, Q] func (p *Poly) fromMont() { inv := uint64(8265825) for i := uint(0); i < n; i++ { p[i] = int32((uint64(p[i]) * inv) % q) } }
crystals-dilithium/poly.go
0.719778
0.431285
poly.go
starcoder
package cios import ( "encoding/json" ) // SeriesDataLocation デバイス位置情報。コレクションの定義に依存。schema.location_typeが”POINT“の場合必須、”NONE”の場合はlocationをリクエストに含めることはできない type SeriesDataLocation struct { // Point固定 Type string `json:"type"` Coordinates []float32 `json:"coordinates"` } // NewSeriesDataLocation instantiates a new SeriesDataLocation object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed func NewSeriesDataLocation(type_ string, coordinates []float32, ) *SeriesDataLocation { this := SeriesDataLocation{} this.Type = type_ this.Coordinates = coordinates return &this } // NewSeriesDataLocationWithDefaults instantiates a new SeriesDataLocation object // This constructor will only assign default values to properties that have it defined, // but it doesn't guarantee that properties required by API are set func NewSeriesDataLocationWithDefaults() *SeriesDataLocation { this := SeriesDataLocation{} return &this } // GetType returns the Type field value func (o *SeriesDataLocation) GetType() string { if o == nil { var ret string return ret } return o.Type } // GetTypeOk returns a tuple with the Type field value // and a boolean to check if the value has been set. func (o *SeriesDataLocation) GetTypeOk() (*string, bool) { if o == nil { return nil, false } return &o.Type, true } // SetType sets field value func (o *SeriesDataLocation) SetType(v string) { o.Type = v } // GetCoordinates returns the Coordinates field value func (o *SeriesDataLocation) GetCoordinates() []float32 { if o == nil { var ret []float32 return ret } return o.Coordinates } // GetCoordinatesOk returns a tuple with the Coordinates field value // and a boolean to check if the value has been set. func (o *SeriesDataLocation) GetCoordinatesOk() (*[]float32, bool) { if o == nil { return nil, false } return &o.Coordinates, true } // SetCoordinates sets field value func (o *SeriesDataLocation) SetCoordinates(v []float32) { o.Coordinates = v } func (o SeriesDataLocation) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if true { toSerialize["type"] = o.Type } if true { toSerialize["coordinates"] = o.Coordinates } return json.Marshal(toSerialize) } type NullableSeriesDataLocation struct { value *SeriesDataLocation isSet bool } func (v NullableSeriesDataLocation) Get() *SeriesDataLocation { return v.value } func (v *NullableSeriesDataLocation) Set(val *SeriesDataLocation) { v.value = val v.isSet = true } func (v NullableSeriesDataLocation) IsSet() bool { return v.isSet } func (v *NullableSeriesDataLocation) Unset() { v.value = nil v.isSet = false } func NewNullableSeriesDataLocation(val *SeriesDataLocation) *NullableSeriesDataLocation { return &NullableSeriesDataLocation{value: val, isSet: true} } func (v NullableSeriesDataLocation) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableSeriesDataLocation) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }
cios/model_series_data_location.go
0.70416
0.456228
model_series_data_location.go
starcoder
package zkbpp //This file contains declaration for all basic gates for Z2 import "math/big" func mpcZ2Xor(x, y []*big.Int, c *Circuit) (z []*big.Int) { z = []*big.Int{big.NewInt(0), big.NewInt(0), big.NewInt(0)} z[0] = Xor(x[0], y[0]) z[1] = Xor(x[1], y[1]) z[2] = Xor(x[2], y[2]) return } func mpcZ2XorVerif(x, y []*big.Int, c *Circuit) (z []*big.Int) { z = []*big.Int{big.NewInt(0), big.NewInt(0), big.NewInt(0)} z[0] = Xor(x[0], y[0]) z[1] = Xor(x[1], y[1]) return } func mpcZ2Or(x, y []*big.Int, c *Circuit) (z []*big.Int) { xn := mpcZ2Not(x, nil, c) yn := mpcZ2Not(y, nil, c) zn := mpcZ2And(xn, yn, c) z = mpcZ2Not(zn, nil, c) return } func mpcZ2OrVerif(x, y []*big.Int, c *Circuit) (z []*big.Int) { xn := mpcZ2NotVerif(x, nil, c) yn := mpcZ2NotVerif(y, nil, c) zn := mpcZ2AndVerif(xn, yn, c) z = mpcZ2NotVerif(zn, nil, c) return } func mpcZ2Not(x, y []*big.Int, c *Circuit) (z []*big.Int) { z = []*big.Int{big.NewInt(0), big.NewInt(0), big.NewInt(0)} z[0].Not(x[0]) z[1].Not(x[1]) z[2].Not(x[2]) return } func mpcZ2NotVerif(x, y []*big.Int, c *Circuit) (z []*big.Int) { z = []*big.Int{big.NewInt(0), big.NewInt(0), big.NewInt(0)} z[0].Not(x[0]) z[1].Not(x[1]) return } func mpcZ2And(x, y []*big.Int, circ *Circuit) (z []*big.Int) { z = []*big.Int{big.NewInt(0), big.NewInt(0), big.NewInt(0)} a := []*big.Int{circ.generateRandomZ2Elem(0), circ.generateRandomZ2Elem(1), circ.generateRandomZ2Elem(2)} b := []*big.Int{circ.generateRandomZ2Elem(0), circ.generateRandomZ2Elem(1), circ.generateRandomZ2Elem(2)} c := []*big.Int{circ.generateRandomZ2Elem(0), circ.generateRandomZ2Elem(1), circ.generateRandomZ2Elem(2)} c = mpcZ2Xor(c, []*big.Int{circ.preprocessing.deltas[circ.preprocessing.deltasIndex], circ.preprocessing.deltas[circ.preprocessing.deltasIndex], circ.preprocessing.deltas[circ.preprocessing.deltasIndex]}, circ) circ.preprocessing.deltasIndex++ //compute and reconstruct alpha = (x-a), betas = y-b alphas := circ.z2Gates.xor(x, a, circ) betas := circ.z2Gates.xor(y, b, circ) alpha := Xor(alphas[0], alphas[1], alphas[2]) beta := Xor(betas[0], betas[1], betas[2]) for i := 0; i < 3; i++ { z[i] = new(big.Int) tmp := new(big.Int).And(y[i], alpha) tmp1 := new(big.Int).And(x[i], beta) tmp2 := new(big.Int).And(alpha, beta) z[i].Xor(c[i], tmp) tmp3 := new(big.Int).Xor(tmp1, tmp2) z[i].Xor(z[i], tmp3) } //THIS IS NOT A BUG. If player x is hidden, we want her alpha and beta to be sent. //If x is hidden, the sent view will be x-1, hence this weird indexing circ.views.player1 = append(circ.views.player1, Copy(alphas[1]), Copy(betas[1])) circ.views.player2 = append(circ.views.player2, Copy(alphas[2]), Copy(betas[2])) circ.views.player3 = append(circ.views.player3, Copy(alphas[0]), Copy(betas[0])) return } func mpcZ2AndVerif(x, y []*big.Int, circ *Circuit) (z []*big.Int) { z = []*big.Int{big.NewInt(0), big.NewInt(0), big.NewInt(0)} a := []*big.Int{circ.generateRandomZ2Elem(0), circ.generateRandomZ2Elem(1)} b := []*big.Int{circ.generateRandomZ2Elem(0), circ.generateRandomZ2Elem(1)} c := []*big.Int{circ.generateRandomZ2Elem(0), circ.generateRandomZ2Elem(1)} c = mpcZ2XorVerif(c, []*big.Int{circ.preprocessing.deltas[circ.preprocessing.deltasIndex], circ.preprocessing.deltas[circ.preprocessing.deltasIndex]}, circ) circ.preprocessing.deltasIndex++ //compute and reconstruct alpha = (x-a), betas = y-b alphas := circ.z2Gates.xor(x, a, circ) betas := circ.z2Gates.xor(y, b, circ) //get alpha2 and beta2 from views alphas[2] = Copy(circ.views.player2[circ.views.currentIndex]) circ.views.currentIndex++ betas[2] = Copy(circ.views.player2[circ.views.currentIndex]) circ.views.currentIndex++ alpha := Xor(alphas[0], alphas[1], alphas[2]) beta := Xor(betas[0], betas[1], betas[2]) for i := 0; i < 2; i++ { z[i] = new(big.Int) tmp := new(big.Int).And(y[i], alpha) tmp1 := new(big.Int).And(x[i], beta) tmp2 := new(big.Int).And(alpha, beta) z[i].Xor(c[i], tmp) tmp3 := new(big.Int).Xor(tmp1, tmp2) z[i].Xor(z[i], tmp3) } circ.views.player1 = append(circ.views.player1, Copy(alphas[1]), Copy(betas[1])) return } func mpcZ2RightShift(x []*big.Int, i uint, c *Circuit) (z []*big.Int) { z = []*big.Int{big.NewInt(0), big.NewInt(0), big.NewInt(0)} z[0].Rsh(x[0], i) z[1].Rsh(x[1], i) z[2].Rsh(x[2], i) return } func mpcZ2RightShiftVerif(x []*big.Int, i uint, c *Circuit) (z []*big.Int) { z = []*big.Int{big.NewInt(0), big.NewInt(0), big.NewInt(0)} z[0].Rsh(x[0], i) z[1].Rsh(x[1], i) return } func mpcZ2Add(x, y []*big.Int, c *Circuit) (z []*big.Int) { z = []*big.Int{big.NewInt(0), big.NewInt(0), big.NewInt(0)} carry := []*big.Int{big.NewInt(0), big.NewInt(0), big.NewInt(0)} tmp := mpcZ2And(x, y, c) tmp2 := mpcZ2Xor(x, y, c) for i := 0; i < c.z2.bitlen; i++ { tmp3 := mpcZ2And(carry, tmp2, c) t := mpcZ2Or(tmp3, tmp, c) carry[0].SetBit(carry[0], i+1, t[0].Bit(i)) carry[1].SetBit(carry[1], i+1, t[1].Bit(i)) carry[2].SetBit(carry[2], i+1, t[2].Bit(i)) } z[0] = Xor(x[0], y[0], carry[0]) z[1] = Xor(x[1], y[1], carry[1]) z[2] = Xor(x[2], y[2], carry[2]) return } func mpcZ2AddVerif(x, y []*big.Int, c *Circuit) (z []*big.Int) { z = []*big.Int{big.NewInt(0), big.NewInt(0), big.NewInt(0)} carry := []*big.Int{big.NewInt(0), big.NewInt(0), big.NewInt(0)} tmp := mpcZ2AndVerif(x, y, c) tmp2 := mpcZ2XorVerif(x, y, c) for i := 0; i < c.z2.bitlen; i++ { tmp3 := mpcZ2AndVerif(carry, tmp2, c) t := mpcZ2OrVerif(tmp3, tmp, c) carry[0].SetBit(carry[0], i+1, t[0].Bit(i)) carry[1].SetBit(carry[1], i+1, t[1].Bit(i)) } z[0] = Xor(x[0], y[0], carry[0]) z[1] = Xor(x[1], y[1], carry[1]) return } func mpcZ2AddK(x, k []*big.Int, c *Circuit) (z []*big.Int) { //since k^k^k = k , we can simply call add with the second var being (k,k,k) z = mpcZ2Add(x, []*big.Int{k[0], k[0], k[0]}, c) return } func mpcZ2AddKVerif(x, k []*big.Int, c *Circuit) (z []*big.Int) { //since k^k^k = k , we can simply call add with the second var being (k,k,k) z = mpcZ2AddVerif(x, []*big.Int{k[0], k[0], k[0]}, c) return } //================================================================ // PREPROCESS GATES //================================================================ func mpcZ2NoOpInt(x []*big.Int, k uint, c *Circuit) (z []*big.Int) { return } func mpcZ2NoOp(x, y []*big.Int, c *Circuit) (z []*big.Int) { return } func mpcZ2Preprocess(x []*big.Int, y []*big.Int, circ *Circuit) (z []*big.Int) { a_shares := []*big.Int{circ.generateRandomZ2Elem(0), circ.generateRandomZ2Elem(1), circ.generateRandomZ2Elem(2)} b_shares := []*big.Int{circ.generateRandomZ2Elem(0), circ.generateRandomZ2Elem(1), circ.generateRandomZ2Elem(2)} c_shares := []*big.Int{circ.generateRandomZ2Elem(0), circ.generateRandomZ2Elem(1), circ.generateRandomZ2Elem(2)} triples := circ.reconstruct( []ZKBVar{{z2Shares: a_shares}, {z2Shares: b_shares}, {z2Shares: c_shares}}) a := triples[0].Z2Value b := triples[1].Z2Value c := new(big.Int).And(a, b) delta := new(big.Int).Xor(c, triples[2].Z2Value) circ.preprocessing.deltas = append(circ.preprocessing.deltas, delta) return } func mpcZ2AddPreprocess(x, y []*big.Int, c *Circuit) (z []*big.Int) { mpcZ2Preprocess(nil, nil, c) for i := 0; i < c.z2.bitlen; i++ { mpcZ2Preprocess(nil, nil, c) mpcZ2Preprocess(nil, nil, c) } return }
CRISP_go/zkbpp/gates_z2_basic.go
0.521715
0.607983
gates_z2_basic.go
starcoder
package cxgo import ( "go/ast" "go/token" "github.com/gotranspile/cxgo/types" ) // BoolExpr is a expression that returns a bool value. type BoolExpr interface { Expr // Negate a bool expression. Alternative of !x, but for any expression. // It may invert the comparison operator or just return !x. Negate() BoolExpr } // ToBool converts an expression to bool expression. func (g *translator) ToBool(x Expr) BoolExpr { if x, ok := cUnwrap(x).(BoolExpr); ok { return x } if v, ok := cIsBoolConst(x); ok { if v { return Bool(true) } return Bool(false) } if x, ok := cUnwrap(x).(IntLit); ok { if x.IsZero() { return Bool(false) } else if x.IsOne() { return Bool(true) } } if x.CType(nil).Kind().IsBool() { if x, ok := x.(Ident); ok { return BoolIdent{x.Identifier()} } return BoolAssert{x} } if types.IsPtr(x.CType(nil)) { return ComparePtrs( g.ToPointer(x), BinOpNeq, g.Nil(), ) } return g.Compare( x, BinOpNeq, cIntLit(0), ) } func cIsBoolConst(x Expr) (bool, bool) { x = cUnwrap(x) switch x := x.(type) { case Bool: if x { return true, true } return false, true case IntLit: if x.IsOne() { return true, true } else if x.IsZero() { return false, true } } return false, false } var ( _ BoolExpr = Bool(false) ) // Bool is a constant bool value. type Bool bool func (Bool) Visit(v Visitor) {} func (e Bool) CType(types.Type) types.Type { return types.BoolT() } func (e Bool) AsExpr() GoExpr { if e { return ident("true") } return ident("false") } func (e Bool) IsConst() bool { return true } func (e Bool) HasSideEffects() bool { return false } func (e Bool) Negate() BoolExpr { return !e } func (e Bool) Uses() []types.Usage { return nil } var ( _ BoolExpr = BoolIdent{} _ Ident = BoolIdent{} ) type BoolIdent struct { *types.Ident } func (BoolIdent) Visit(v Visitor) {} func (e BoolIdent) Identifier() *types.Ident { return e.Ident } func (e BoolIdent) IsConst() bool { return false } func (e BoolIdent) HasSideEffects() bool { return false } func (e BoolIdent) AsExpr() GoExpr { return e.GoIdent() } func (e BoolIdent) Negate() BoolExpr { return &Not{X: e} } func (e BoolIdent) Uses() []types.Usage { return []types.Usage{{Ident: e.Ident, Access: types.AccessUnknown}} } var _ BoolExpr = (*Not)(nil) // Not negates a bool expression. It's only useful for identifiers and function calls. type Not struct { X BoolExpr } func (e *Not) Visit(v Visitor) { v(e.X) } func (e *Not) CType(types.Type) types.Type { return types.BoolT() } func (e *Not) AsExpr() GoExpr { return &ast.UnaryExpr{ Op: token.NOT, X: e.X.AsExpr(), } } func (e *Not) IsConst() bool { return e.X.IsConst() } func (e *Not) HasSideEffects() bool { return e.X.HasSideEffects() } func (e *Not) Negate() BoolExpr { return e.X } func (e *Not) Uses() []types.Usage { return e.X.Uses() } func (g *translator) cNot(x Expr) BoolExpr { if x, ok := x.(BoolExpr); ok { return x.Negate() } return g.ToBool(x).Negate() } const ( BinOpAnd BoolOp = "&&" BinOpOr BoolOp = "||" ) type BoolOp string func (op BoolOp) GoToken() token.Token { var tok token.Token switch op { case BinOpAnd: tok = token.LAND case BinOpOr: tok = token.LOR default: panic(op) } return tok } func And(x, y BoolExpr) BoolExpr { return &BinaryBoolExpr{ X: x, Op: BinOpAnd, Y: y, } } func Or(x, y BoolExpr) BoolExpr { return &BinaryBoolExpr{ X: x, Op: BinOpOr, Y: y, } } var _ BoolExpr = (*BinaryBoolExpr)(nil) type BinaryBoolExpr struct { X BoolExpr Op BoolOp Y BoolExpr } func (e *BinaryBoolExpr) Visit(v Visitor) { v(e.X) v(e.Y) } func (e *BinaryBoolExpr) CType(types.Type) types.Type { return types.BoolT() } func (e *BinaryBoolExpr) AsExpr() GoExpr { return &ast.BinaryExpr{ X: e.X.AsExpr(), Op: e.Op.GoToken(), Y: e.Y.AsExpr(), } } func (e *BinaryBoolExpr) IsConst() bool { return e.X.IsConst() && e.Y.IsConst() } func (e *BinaryBoolExpr) HasSideEffects() bool { return e.X.HasSideEffects() || e.Y.HasSideEffects() } func (e *BinaryBoolExpr) Negate() BoolExpr { return &Not{X: e} } func (e *BinaryBoolExpr) Uses() []types.Usage { return types.UseRead(e.X, e.Y) } const ( BinOpEq ComparisonOp = "==" BinOpNeq ComparisonOp = "!=" BinOpLt ComparisonOp = "<" BinOpGt ComparisonOp = ">" BinOpLte ComparisonOp = "<=" BinOpGte ComparisonOp = ">=" ) // ComparisonOp is a comparison operator. type ComparisonOp string func (op ComparisonOp) IsEquality() bool { return op == BinOpEq || op == BinOpNeq } func (op ComparisonOp) IsRelational() bool { switch op { case BinOpLt, BinOpGt, BinOpLte, BinOpGte: return true } return false } func (op ComparisonOp) Negate() ComparisonOp { switch op { case BinOpEq: return BinOpNeq case BinOpNeq: return BinOpEq case BinOpLt: return BinOpGte case BinOpGt: return BinOpLte case BinOpLte: return BinOpGt case BinOpGte: return BinOpLt } panic(op) } func (op ComparisonOp) GoToken() token.Token { var tok token.Token switch op { case BinOpLt: tok = token.LSS case BinOpGt: tok = token.GTR case BinOpLte: tok = token.LEQ case BinOpGte: tok = token.GEQ case BinOpEq: tok = token.EQL case BinOpNeq: tok = token.NEQ default: panic(op) } return tok } // Compare two expression values. func (g *translator) Compare(x Expr, op ComparisonOp, y Expr) BoolExpr { // compare pointers and functions separately if xt := x.CType(nil); xt.Kind().IsFunc() { fx := g.ToFunc(x, nil) return CompareFuncs(fx, op, g.ToFunc(y, fx.FuncType(nil))) } if yt := y.CType(nil); yt.Kind().IsFunc() { fy := g.ToFunc(y, nil) return CompareFuncs(g.ToFunc(x, fy.FuncType(nil)), op, fy) } if x.CType(nil).Kind().IsPtr() || y.CType(nil).Kind().IsPtr() { return ComparePtrs(g.ToPointer(x), op, g.ToPointer(y)) } if x.CType(nil).Kind().Is(types.Array) || y.CType(nil).Kind().Is(types.Array) { return ComparePtrs(g.ToPointer(x), op, g.ToPointer(y)) } if op.IsRelational() { typ := g.env.CommonType(x.CType(nil), y.CType(nil)) x = g.cCast(typ, x) y = g.cCast(typ, y) return &Comparison{ g: g, X: x, Op: op, Y: y, } } if !op.IsEquality() { panic("must not happen") } // always check equality with the constant on the right if x.IsConst() && !y.IsConst() { return g.Compare(y, op, x) } // optimizations for bool equality if v, ok := cIsBoolConst(y); ok { x := cUnwrap(x) if x.CType(nil).Kind().IsBool() { x = g.ToBool(x) } if x, ok := x.(BoolExpr); ok { if v == (op == BinOpEq) { // (bool(x) == true) -> (x) // (bool(x) != false) -> (x) return x } // (bool(x) != true) -> (!x) // (bool(x) == false) -> (!x) return x.Negate() } } typ := g.env.CommonType(x.CType(nil), y.CType(nil)) x = g.cCast(typ, x) y = g.cCast(typ, y) return &Comparison{ g: g, X: x, Op: op, Y: y, } } var _ BoolExpr = (*Comparison)(nil) type Comparison struct { g *translator X Expr Op ComparisonOp Y Expr } func (e *Comparison) Visit(v Visitor) { v(e.X) v(e.Y) } func (e *Comparison) CType(types.Type) types.Type { return types.BoolT() } func (e *Comparison) AsExpr() GoExpr { x := e.X.AsExpr() if _, ok := x.(*ast.CompositeLit); ok { x = paren(x) } y := e.Y.AsExpr() if _, ok := y.(*ast.CompositeLit); ok { y = paren(y) } return &ast.BinaryExpr{ X: x, Op: e.Op.GoToken(), Y: y, } } func (e *Comparison) IsConst() bool { return e.X.IsConst() && e.Y.IsConst() } func (e *Comparison) HasSideEffects() bool { return e.X.HasSideEffects() || e.Y.HasSideEffects() } func (e *Comparison) Negate() BoolExpr { return e.g.Compare(e.X, e.Op.Negate(), e.Y) } func (e *Comparison) Uses() []types.Usage { return types.UseRead(e.X, e.Y) } var _ BoolExpr = BoolAssert{} type BoolAssert struct { X Expr } func (e BoolAssert) Visit(v Visitor) { v(e.X) } func (e BoolAssert) CType(types.Type) types.Type { return types.BoolT() } func (e BoolAssert) AsExpr() GoExpr { return e.X.AsExpr() } func (e BoolAssert) IsConst() bool { return false } func (e BoolAssert) HasSideEffects() bool { return e.X.HasSideEffects() } func (e BoolAssert) Negate() BoolExpr { return &Not{X: e} } func (e BoolAssert) Uses() []types.Usage { return e.X.Uses() } var _ Expr = (*BoolToInt)(nil) type BoolToInt struct { X BoolExpr } func (e *BoolToInt) Visit(v Visitor) { v(e.X) } func (e *BoolToInt) CType(types.Type) types.Type { return types.IntT(4) } func (e *BoolToInt) AsExpr() GoExpr { return call(ident("libc.BoolToInt"), e.X.AsExpr()) } func (e *BoolToInt) IsConst() bool { return false } func (e *BoolToInt) HasSideEffects() bool { return e.X.HasSideEffects() } func (e *BoolToInt) Uses() []types.Usage { return e.X.Uses() }
bools.go
0.672332
0.455441
bools.go
starcoder
package allot import ( "regexp" "strconv" "strings" ) var regexpMapping = map[string]string{ RemaingStringType: `([\s\S]*)`, StringType: `([^\s]+)`, OptionalStringType: `(\s?[^\s]+)?`, IntegerType: `([0-9]+)`, OptionalIntegerType: `(\s?[0-9]+)?`, } // GetRegexpExpression returns the regexp for a data type func GetRegexpExpression(datatype string) *regexp.Regexp { if exp, ok := regexpMapping[datatype]; ok { return regexp.MustCompile(exp) } return nil } // ParameterInterface describes how to access a Parameter type ParameterInterface interface { Equals(param ParameterInterface) bool Expression() *regexp.Regexp Name() string Datatype() string } // Parameter is the Parameter definition type Parameter struct { name string datatype string expr *regexp.Regexp } // Expression returns the regexp behind the type func (p Parameter) Expression() *regexp.Regexp { return p.expr } // Name returns the Parameter name func (p Parameter) Name() string { return p.name } // Datatype returns the Parameter datatype func (p Parameter) Datatype() string { return p.datatype } // IsOptional returns whether the parameter is optional or not func (p Parameter) IsOptional() bool { return p.datatype == OptionalStringType || p.datatype == OptionalIntegerType } // Equals checks if two parameter are equal func (p Parameter) Equals(param ParameterInterface) bool { return p.Name() == param.Name() && strings.Contains(p.Datatype(), param.Datatype()) } // NewParameterWithType returns a Parameter func NewParameterWithType(name string, datatype string) Parameter { return Parameter{name, datatype, GetRegexpExpression(datatype)} } // Parse parses parameter info func Parse(token string, paramterPosition int) Parameter { definedParameterRegex := regexp.MustCompile(definedParameterPattern) definedOptionsRegex := regexp.MustCompile(definedOptionsPattern) var name, datatype string switch { case definedParameterRegex.MatchString(token): name, datatype = parseDefinedParameterType(token) case definedOptionsRegex.MatchString(token): name, datatype = parseDefinedOptionsParameterType(token, paramterPosition) default: name, datatype = parseParamterType(token) } return NewParameterWithType(name, datatype) } func parseDefinedParameterType(token string) (string, string) { tokenWithoutAngleBrackets := token[1 : len(token)-1] return parseParamterType(tokenWithoutAngleBrackets) } func parseDefinedOptionsParameterType(token string, paramterPosition int) (string, string) { tokenWithoutCurlyBrackets := token[1 : len(token)-1] numberPatternRegex := regexp.MustCompile(numberPattern) datatype := "string" name := "option" + strconv.Itoa(paramterPosition) if numberPatternRegex.MatchString(tokenWithoutCurlyBrackets) { datatype = "integer" } return name, datatype } func parseParamterType(token string) (string, string) { datatype := "string" name := token if strings.Contains(token, ":") { splits := strings.Split(token, ":") if splits[1] == "?" { datatype = "string?" } else { datatype = splits[1] } name = splits[0] } return name, datatype }
pkg/parameter.go
0.743634
0.436502
parameter.go
starcoder
package cluster import ( "encoding/json" "fmt" "github.com/flexiant/concerto/api/types" "github.com/flexiant/concerto/utils" "github.com/stretchr/testify/assert" "testing" ) // GetClusterListMocked test mocked function func GetClusterListMocked(t *testing.T, clustersIn *[]types.Cluster) *[]types.Cluster { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // to json dIn, err := json.Marshal(clustersIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Get", "/v1/kaas/fleets").Return(dIn, 200, nil) clustersOut, err := ds.GetClusterList() assert.Nil(err, "Error getting cluster list") assert.Equal(*clustersIn, clustersOut, "GetClusterList returned different clusters") return &clustersOut } // GetClusterListFailErrMocked test mocked function func GetClusterListFailErrMocked(t *testing.T, clustersIn *[]types.Cluster) *[]types.Cluster { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // to json dIn, err := json.Marshal(clustersIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Get", "/v1/kaas/fleets").Return(dIn, 200, fmt.Errorf("Mocked error")) clustersOut, err := ds.GetClusterList() assert.NotNil(err, "We are expecting an error") assert.Nil(clustersOut, "Expecting nil output") assert.Equal(err.Error(), "Mocked error", "Error should be 'Mocked error'") return &clustersOut } // GetClusterListFailStatusMocked test mocked function func GetClusterListFailStatusMocked(t *testing.T, clustersIn *[]types.Cluster) *[]types.Cluster { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // to json dIn, err := json.Marshal(clustersIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Get", "/v1/kaas/fleets").Return(dIn, 499, nil) clustersOut, err := ds.GetClusterList() assert.NotNil(err, "We are expecting an status code error") assert.Nil(clustersOut, "Expecting nil output") assert.Contains(err.Error(), "499", "Error should contain http code 499") return &clustersOut } // GetClusterListFailJSONMocked test mocked function func GetClusterListFailJSONMocked(t *testing.T, clustersIn *[]types.Cluster) *[]types.Cluster { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // wrong json dIn := []byte{10, 20, 30} // call service cs.On("Get", "/v1/kaas/fleets").Return(dIn, 200, nil) clustersOut, err := ds.GetClusterList() assert.NotNil(err, "We are expecting a marshalling error") assert.Nil(clustersOut, "Expecting nil output") assert.Contains(err.Error(), "invalid character", "Error message should include the string 'invalid character'") return &clustersOut } // CreateClusterMocked test mocked function func CreateClusterMocked(t *testing.T, clusterIn *types.Cluster) *types.Cluster { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // convertMap mapIn, err := utils.ItemConvertParams(*clusterIn) assert.Nil(err, "Cluster test data corrupted") // to json dOut, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Post", "/v1/kaas/fleets", mapIn).Return(dOut, 200, nil) clusterOut, err := ds.CreateCluster(mapIn) assert.Nil(err, "Error creating cluster list") assert.Equal(clusterIn, clusterOut, "CreateCluster returned different clusters") return clusterOut } // CreateClusterFailErrMocked test mocked function func CreateClusterFailErrMocked(t *testing.T, clusterIn *types.Cluster) *types.Cluster { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // convertMap mapIn, err := utils.ItemConvertParams(*clusterIn) assert.Nil(err, "Cluster test data corrupted") // to json dOut, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Post", "/v1/kaas/fleets", mapIn).Return(dOut, 200, fmt.Errorf("Mocked error")) clusterOut, err := ds.CreateCluster(mapIn) assert.NotNil(err, "We are expecting an error") assert.Nil(clusterOut, "Expecting nil output") assert.Equal(err.Error(), "Mocked error", "Error should be 'Mocked error'") return clusterOut } // CreateClusterFailStatusMocked test mocked function func CreateClusterFailStatusMocked(t *testing.T, clusterIn *types.Cluster) *types.Cluster { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // convertMap mapIn, err := utils.ItemConvertParams(*clusterIn) assert.Nil(err, "Cluster test data corrupted") // to json dOut, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Post", "/v1/kaas/fleets", mapIn).Return(dOut, 499, nil) clusterOut, err := ds.CreateCluster(mapIn) assert.NotNil(err, "We are expecting an status code error") assert.Nil(clusterOut, "Expecting nil output") assert.Contains(err.Error(), "499", "Error should contain http code 499") return clusterOut } // CreateClusterFailJSONMocked test mocked function func CreateClusterFailJSONMocked(t *testing.T, clusterIn *types.Cluster) *types.Cluster { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // convertMap mapIn, err := utils.ItemConvertParams(*clusterIn) assert.Nil(err, "Cluster test data corrupted") // wrong json dIn := []byte{10, 20, 30} // call service cs.On("Post", "/v1/kaas/fleets", mapIn).Return(dIn, 200, nil) clusterOut, err := ds.CreateCluster(mapIn) assert.NotNil(err, "We are expecting a marshalling error") assert.Nil(clusterOut, "Expecting nil output") assert.Contains(err.Error(), "invalid character", "Error message should include the string 'invalid character'") return clusterOut } // DeleteClusterMocked test mocked function func DeleteClusterMocked(t *testing.T, clusterIn *types.Cluster) { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // to json dIn, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Delete", fmt.Sprintf("/v1/kaas/fleets/%s", clusterIn.Id)).Return(dIn, 200, nil) err = ds.DeleteCluster(clusterIn.Id) assert.Nil(err, "Error deleting cluster") } // DeleteClusterFailErrMocked test mocked function func DeleteClusterFailErrMocked(t *testing.T, clusterIn *types.Cluster) { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // to json dIn, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Delete", fmt.Sprintf("/v1/kaas/fleets/%s", clusterIn.Id)).Return(dIn, 200, fmt.Errorf("Mocked error")) err = ds.DeleteCluster(clusterIn.Id) assert.NotNil(err, "We are expecting an error") assert.Equal(err.Error(), "Mocked error", "Error should be 'Mocked error'") } // DeleteClusterFailStatusMocked test mocked function func DeleteClusterFailStatusMocked(t *testing.T, clusterIn *types.Cluster) { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // to json dIn, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Delete", fmt.Sprintf("/v1/kaas/fleets/%s", clusterIn.Id)).Return(dIn, 499, nil) err = ds.DeleteCluster(clusterIn.Id) assert.NotNil(err, "We are expecting an status code error") assert.Contains(err.Error(), "499", "Error should contain http code 499") } // StartClusterMocked test mocked function func StartClusterMocked(t *testing.T, clusterIn *types.Cluster) { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // convertMap mapIn, err := utils.ItemConvertParams(*clusterIn) assert.Nil(err, "Cluster test data corrupted") // to json dOut, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Put", fmt.Sprintf("/v1/kaas/fleets/%s/start", clusterIn.Id), mapIn).Return(dOut, 200, nil) err = ds.StartCluster(mapIn, clusterIn.Id) assert.Nil(err, "Error updating cluster list") } // StartClusterFailErrMocked test mocked function func StartClusterFailErrMocked(t *testing.T, clusterIn *types.Cluster) { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // convertMap mapIn, err := utils.ItemConvertParams(*clusterIn) assert.Nil(err, "Cluster test data corrupted") // to json dOut, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Put", fmt.Sprintf("/v1/kaas/fleets/%s/start", clusterIn.Id), mapIn).Return(dOut, 200, fmt.Errorf("Mocked error")) err = ds.StartCluster(mapIn, clusterIn.Id) assert.NotNil(err, "We are expecting an error") assert.Equal(err.Error(), "Mocked error", "Error should be 'Mocked error'") } // StartClusterFailStatusMocked test mocked function func StartClusterFailStatusMocked(t *testing.T, clusterIn *types.Cluster) { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // convertMap mapIn, err := utils.ItemConvertParams(*clusterIn) assert.Nil(err, "Cluster test data corrupted") // to json dOut, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Put", fmt.Sprintf("/v1/kaas/fleets/%s/start", clusterIn.Id), mapIn).Return(dOut, 499, nil) err = ds.StartCluster(mapIn, clusterIn.Id) assert.NotNil(err, "We are expecting an status code error") assert.Contains(err.Error(), "499", "Error should contain http code 499") } // StopClusterMocked test mocked function func StopClusterMocked(t *testing.T, clusterIn *types.Cluster) { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // convertMap mapIn, err := utils.ItemConvertParams(*clusterIn) assert.Nil(err, "Cluster test data corrupted") // to json dOut, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Put", fmt.Sprintf("/v1/kaas/fleets/%s/stop", clusterIn.Id), mapIn).Return(dOut, 200, nil) err = ds.StopCluster(mapIn, clusterIn.Id) assert.Nil(err, "Error updating cluster list") } // StopClusterFailErrMocked test mocked function func StopClusterFailErrMocked(t *testing.T, clusterIn *types.Cluster) { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // convertMap mapIn, err := utils.ItemConvertParams(*clusterIn) assert.Nil(err, "Cluster test data corrupted") // to json dOut, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Put", fmt.Sprintf("/v1/kaas/fleets/%s/stop", clusterIn.Id), mapIn).Return(dOut, 200, fmt.Errorf("Mocked error")) err = ds.StopCluster(mapIn, clusterIn.Id) assert.NotNil(err, "We are expecting an error") assert.Equal(err.Error(), "Mocked error", "Error should be 'Mocked error'") } // StopClusterFailStatusMocked test mocked function func StopClusterFailStatusMocked(t *testing.T, clusterIn *types.Cluster) { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // convertMap mapIn, err := utils.ItemConvertParams(*clusterIn) assert.Nil(err, "Cluster test data corrupted") // to json dOut, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Put", fmt.Sprintf("/v1/kaas/fleets/%s/stop", clusterIn.Id), mapIn).Return(dOut, 499, nil) err = ds.StopCluster(mapIn, clusterIn.Id) assert.NotNil(err, "We are expecting an status code error") assert.Contains(err.Error(), "499", "Error should contain http code 499") } // EmptyClusterMocked test mocked function func EmptyClusterMocked(t *testing.T, clusterIn *types.Cluster) { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // convertMap mapIn, err := utils.ItemConvertParams(*clusterIn) assert.Nil(err, "Cluster test data corrupted") // to json dOut, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Put", fmt.Sprintf("/v1/kaas/fleets/%s/empty", clusterIn.Id), mapIn).Return(dOut, 200, nil) err = ds.EmptyCluster(mapIn, clusterIn.Id) assert.Nil(err, "Error updating cluster list") } // EmptyClusterFailErrMocked test mocked function func EmptyClusterFailErrMocked(t *testing.T, clusterIn *types.Cluster) { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // convertMap mapIn, err := utils.ItemConvertParams(*clusterIn) assert.Nil(err, "Cluster test data corrupted") // to json dOut, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Put", fmt.Sprintf("/v1/kaas/fleets/%s/empty", clusterIn.Id), mapIn).Return(dOut, 200, fmt.Errorf("Mocked error")) err = ds.EmptyCluster(mapIn, clusterIn.Id) assert.NotNil(err, "We are expecting an error") assert.Equal(err.Error(), "Mocked error", "Error should be 'Mocked error'") } // EmptyClusterFailStatusMocked test mocked function func EmptyClusterFailStatusMocked(t *testing.T, clusterIn *types.Cluster) { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewClusterService(cs) assert.Nil(err, "Couldn't load cluster service") assert.NotNil(ds, "Cluster service not instanced") // convertMap mapIn, err := utils.ItemConvertParams(*clusterIn) assert.Nil(err, "Cluster test data corrupted") // to json dOut, err := json.Marshal(clusterIn) assert.Nil(err, "Cluster test data corrupted") // call service cs.On("Put", fmt.Sprintf("/v1/kaas/fleets/%s/empty", clusterIn.Id), mapIn).Return(dOut, 499, nil) err = ds.EmptyCluster(mapIn, clusterIn.Id) assert.NotNil(err, "We are expecting an status code error") assert.Contains(err.Error(), "499", "Error should contain http code 499") }
api/cluster/cluster_api_mocked.go
0.704668
0.509154
cluster_api_mocked.go
starcoder
package command import ( "fmt" "io" "github.com/inkyblackness/res/geometry" "github.com/inkyblackness/res/serial" ) // LoadModel tries to decode a geometry model from a serialized list of model // commands. func LoadModel(source io.ReadSeeker) (model geometry.Model, err error) { defer func() { if r := recover(); r != nil { err = fmt.Errorf("%s", r) } }() if source == nil { panic(fmt.Errorf("source is nil")) } coder := serial.NewPositioningDecoder(source) unknownHeader := make([]byte, 6) expectedFaces := uint16(0) coder.Code(unknownHeader) coder.Code(&expectedFaces) dynamicModel := geometry.NewDynamicModel() loadNodeData(coder, dynamicModel, dynamicModel) model = dynamicModel return } func loadNodeData(coder serial.PositioningCoder, model *geometry.DynamicModel, node geometry.ExtensibleNode) { pendingNodes := make(map[uint32]geometry.ExtensibleNode) done := false for !done { startPos := coder.CurPos() rawCommand := uint16(0) coder.Code(&rawCommand) switch ModelCommandID(rawCommand) { case CmdEndOfNode: { done = true } case CmdDefineVertex: { unknown := uint16(0) vector := new(Vector) coder.Code(&unknown) vector.Code(coder) model.AddVertex(geometry.NewSimpleVertex(NewFixedVector(*vector))) } case CmdDefineVertices: { unknown := uint16(0) vertexCount := uint16(0) coder.Code(&vertexCount) coder.Code(&unknown) for i := uint16(0); i < vertexCount; i++ { vector := new(Vector) vector.Code(coder) model.AddVertex(geometry.NewSimpleVertex(NewFixedVector(*vector))) } } case CmdDefineOffsetVertexX: { loadDefineOffsetVertexOne(coder, model, AddingModifier, singleIdentityModifier, singleIdentityModifier) } case CmdDefineOffsetVertexY: { loadDefineOffsetVertexOne(coder, model, singleIdentityModifier, AddingModifier, singleIdentityModifier) } case CmdDefineOffsetVertexZ: { loadDefineOffsetVertexOne(coder, model, singleIdentityModifier, singleIdentityModifier, AddingModifier) } case CmdDefineOffsetVertexXY: { loadDefineOffsetVertexTwo(coder, model, func(offset1, offset2 float32) Modifier { return AddingModifier(offset1) }, func(offset1, offset2 float32) Modifier { return AddingModifier(offset2) }, doubleIdentityModifier) } case CmdDefineOffsetVertexXZ: { loadDefineOffsetVertexTwo(coder, model, func(offset1, offset2 float32) Modifier { return AddingModifier(offset1) }, doubleIdentityModifier, func(offset1, offset2 float32) Modifier { return AddingModifier(offset2) }) } case CmdDefineOffsetVertexYZ: { loadDefineOffsetVertexTwo(coder, model, doubleIdentityModifier, func(offset1, offset2 float32) Modifier { return AddingModifier(offset1) }, func(offset1, offset2 float32) Modifier { return AddingModifier(offset2) }) } case CmdDefineNodeAnchor: { normal := new(Vector) reference := new(Vector) leftOffset := uint16(0) rightOffset := uint16(0) normal.Code(coder) reference.Code(coder) coder.Code(&leftOffset) coder.Code(&rightOffset) left := geometry.NewDynamicNode() right := geometry.NewDynamicNode() anchor := geometry.NewSimpleNodeAnchor(NewFixedVector(*normal), NewFixedVector(*reference), left, right) node.AddAnchor(anchor) pendingNodes[startPos+uint32(leftOffset)] = left pendingNodes[startPos+uint32(rightOffset)] = right } case CmdDefineFaceAnchor: { normal := new(Vector) reference := new(Vector) size := uint16(0) coder.Code(&size) normal.Code(coder) reference.Code(coder) endPos := startPos + uint32(size) anchor := geometry.NewDynamicFaceAnchor(NewFixedVector(*normal), NewFixedVector(*reference)) node.AddAnchor(anchor) loadFaces(coder, anchor, endPos) } default: { panic(fmt.Errorf("Unknown model command 0x%04X at offset 0x%X", rawCommand, startPos)) } } } for curPos := coder.CurPos(); pendingNodes[curPos] != nil; curPos = coder.CurPos() { pendingNode := pendingNodes[curPos] delete(pendingNodes, curPos) loadNodeData(coder, model, pendingNode) } if len(pendingNodes) != 0 { panic(fmt.Errorf("Wrong offset values for node anchor")) } } type singleModifierFactory func(float32) Modifier type doubleModifierFactory func(float32, float32) Modifier func singleIdentityModifier(offset float32) Modifier { return IdentityModifier } func doubleIdentityModifier(offset1 float32, offset2 float32) Modifier { return IdentityModifier } func loadDefineOffsetVertexOne(coder serial.PositioningCoder, model *geometry.DynamicModel, xModFactory singleModifierFactory, yModFactory singleModifierFactory, zModFactory singleModifierFactory) { newIndex := uint16(0) referenceIndex := uint16(0) fixedOffset := Fixed(0) coder.Code(&newIndex) coder.Code(&referenceIndex) CodeFixed(coder, &fixedOffset) if int(newIndex) != model.VertexCount() { panic(fmt.Errorf("Offset vertex uses invalid newIndex (%d)", newIndex)) } reference := model.Vertex(int(referenceIndex)) offset := fixedOffset.Float() model.AddVertex(geometry.NewSimpleVertex(NewModifiedVector(reference.Position(), xModFactory(offset), yModFactory(offset), zModFactory(offset)))) } func loadDefineOffsetVertexTwo(coder serial.PositioningCoder, model *geometry.DynamicModel, xModFactory doubleModifierFactory, yModFactory doubleModifierFactory, zModFactory doubleModifierFactory) { newIndex := uint16(0) referenceIndex := uint16(0) fixedOffset1 := Fixed(0) fixedOffset2 := Fixed(0) coder.Code(&newIndex) coder.Code(&referenceIndex) CodeFixed(coder, &fixedOffset1) CodeFixed(coder, &fixedOffset2) if int(newIndex) != model.VertexCount() { panic(fmt.Errorf("Offset vertex uses invalid newIndex (%d)", newIndex)) } reference := model.Vertex(int(referenceIndex)) offset1 := fixedOffset1.Float() offset2 := fixedOffset2.Float() model.AddVertex(geometry.NewSimpleVertex(NewModifiedVector(reference.Position(), xModFactory(offset1, offset2), yModFactory(offset1, offset2), zModFactory(offset1, offset2)))) } func loadFaces(coder serial.PositioningCoder, anchor *geometry.DynamicFaceAnchor, endPos uint32) { currentColor := uint16(0) currentShade := uint16(0xFFFF) var textureCoordinates []geometry.TextureCoordinate for startPos := coder.CurPos(); startPos < endPos; startPos = coder.CurPos() { rawCommand := uint16(0) coder.Code(&rawCommand) switch ModelCommandID(rawCommand) { case CmdSetColor: { coder.Code(&currentColor) } case CmdSetColorAndShade: { coder.Code(&currentColor) coder.Code(&currentShade) } case CmdColoredFace: { vertexCount := uint16(0) coder.Code(&vertexCount) vertices := make([]int, int(vertexCount)) for i := uint16(0); i < vertexCount; i++ { index := uint16(0) coder.Code(&index) vertices[i] = int(index) } if currentShade == 0xFFFF { anchor.AddFace(geometry.NewSimpleFlatColoredFace(vertices, geometry.ColorIndex(currentColor))) } else { anchor.AddFace(geometry.NewSimpleShadeColoredFace(vertices, geometry.ColorIndex(currentColor), currentShade)) } } case CmdTextureMapping: { entryCount := uint16(0) coder.Code(&entryCount) textureCoordinates = make([]geometry.TextureCoordinate, int(entryCount)) for i := uint16(0); i < entryCount; i++ { vertex := uint16(0) u := Fixed(0) v := Fixed(0) coder.Code(&vertex) CodeFixed(coder, &u) CodeFixed(coder, &v) textureCoordinates[i] = geometry.NewSimpleTextureCoordinate(int(vertex), u.Float(), v.Float()) } } case CmdTexturedFace: { textureId := uint16(0) vertexCount := uint16(0) coder.Code(&textureId) coder.Code(&vertexCount) vertices := make([]int, int(vertexCount)) for i := uint16(0); i < vertexCount; i++ { index := uint16(0) coder.Code(&index) vertices[i] = int(index) } anchor.AddFace(geometry.NewSimpleTextureMappedFace(vertices, textureId, textureCoordinates)) } default: { panic(fmt.Errorf("Unknown face command 0x%04X at offset 0x%X", rawCommand, startPos)) } } } }
geometry/command/LoadModel.go
0.802903
0.463444
LoadModel.go
starcoder
package render import ( "image" "image/draw" "github.com/oakmound/oak/alg/floatgeom" "github.com/oakmound/oak/render/mod" ) // CompositeM Types display all of their parts at the same time, // and respect the positions of their parts as relative to the // position of the composite itself type CompositeM struct { LayeredPoint rs []Modifiable } // NewCompositeM creates a CompositeM func NewCompositeM(sl ...Modifiable) *CompositeM { cs := new(CompositeM) cs.LayeredPoint = NewLayeredPoint(0, 0, 0) cs.rs = sl return cs } // AppendOffset adds a new offset modifiable to the CompositeM func (cs *CompositeM) AppendOffset(r Modifiable, p floatgeom.Point2) { r.SetPos(p.X(), p.Y()) cs.Append(r) } // Append adds a renderable as is to the CompositeM func (cs *CompositeM) Append(r Modifiable) { cs.rs = append(cs.rs, r) } // Prepend adds a new renderable to the front of the CompositeMR. func (cs *CompositeM) Prepend(r Modifiable) { cs.rs = append([]Modifiable{r}, cs.rs...) } // SetIndex places a renderable at a certain point in the CompositeMs renderable slice func (cs *CompositeM) SetIndex(i int, r Modifiable) { cs.rs[i] = r } // Len returns the number of renderables in this CompositeM. func (cs *CompositeM) Len() int { return len(cs.rs) } // AddOffset offsets all renderables in the CompositeM by a vector func (cs *CompositeM) AddOffset(i int, p floatgeom.Point2) { if i < len(cs.rs) { cs.rs[i].SetPos(p.X(), p.Y()) } } // SetOffsets applies the initial offsets to the entire CompositeM func (cs *CompositeM) SetOffsets(vs ...floatgeom.Point2) { for i, v := range vs { if i < len(cs.rs) { cs.rs[i].SetPos(v.X(), v.Y()) } } } // Get returns a renderable at the given index within the CompositeM func (cs *CompositeM) Get(i int) Modifiable { return cs.rs[i] } // DrawOffset draws the CompositeM with some offset from its logical position (and therefore sub renderables logical positions). func (cs *CompositeM) DrawOffset(buff draw.Image, xOff, yOff float64) { for _, c := range cs.rs { c.DrawOffset(buff, cs.X()+xOff, cs.Y()+yOff) } } // Draw draws the CompositeM at its logical position func (cs *CompositeM) Draw(buff draw.Image) { for _, c := range cs.rs { c.DrawOffset(buff, cs.X(), cs.Y()) } } // Undraw stops the CompositeM from being drawn func (cs *CompositeM) Undraw() { cs.layer = Undraw for _, c := range cs.rs { c.Undraw() } } // GetRGBA does not work on a CompositeM and therefore returns nil func (cs *CompositeM) GetRGBA() *image.RGBA { return nil } // Modify applies mods to the CompositeM func (cs *CompositeM) Modify(ms ...mod.Mod) Modifiable { for _, r := range cs.rs { r.Modify(ms...) } return cs } // Filter filters each component part of this CompositeM by all of the inputs. func (cs *CompositeM) Filter(fs ...mod.Filter) { for _, r := range cs.rs { r.Filter(fs...) } } // Copy makes a new CompositeM with the same renderables func (cs *CompositeM) Copy() Modifiable { cs2 := new(CompositeM) cs2.layer = cs.layer cs2.Vector = cs.Vector cs2.rs = make([]Modifiable, len(cs.rs)) for i, v := range cs.rs { cs2.rs[i] = v.Copy() } return cs2 }
render/compositeM.go
0.752468
0.504394
compositeM.go
starcoder
package config /** * Configuration for rewrite action resource. */ type Rewriteaction struct { /** * Name for the user-defined rewrite action. Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyphen (-), period (.) hash (#), space ( ), at (@), equals (=), colon (:), and underscore characters. Can be changed after the rewrite policy is added. The following requirement applies only to the Citrix ADC CLI: If the name includes one or more spaces, enclose the name in double or single quotation marks (for example, "my rewrite action" or 'my rewrite action'). */ Name string `json:"name,omitempty"` /** * Type of user-defined rewrite action. The information that you provide for, and the effect of, each type are as follows:: * REPLACE <target> <string_builder_expr>. Replaces the string with the string-builder expression. * REPLACE_ALL <target> <string_builder_expr1> -(pattern|search) <string_builder_expr2>. In the request or response specified by <target>, replaces all occurrences of the string defined by <string_builder_expr1> with the string defined by <string_builder_expr2>. You can use a PCRE-format pattern or the search facility to find the strings to be replaced. * REPLACE_HTTP_RES <string_builder_expr>. Replaces the complete HTTP response with the string defined by the string-builder expression. * REPLACE_SIP_RES <target> - Replaces the complete SIP response with the string specified by <target>. * INSERT_HTTP_HEADER <header_string_builder_expr> <contents_string_builder_expr>. Inserts the HTTP header specified by <header_string_builder_expr> and header contents specified by <contents_string_builder_expr>. * DELETE_HTTP_HEADER <target>. Deletes the HTTP header specified by <target>. * CORRUPT_HTTP_HEADER <target>. Replaces the header name of all occurrences of the HTTP header specified by <target> with a corrupted name, so that it will not be recognized by the receiver Example: MY_HEADER is changed to MHEY_ADER. * INSERT_BEFORE <string_builder_expr1> <string_builder_expr1>. Finds the string specified in <string_builder_expr1> and inserts the string in <string_builder_expr2> before it. * INSERT_BEFORE_ALL <target> <string_builder_expr1> -(pattern|search) <string_builder_expr2>. In the request or response specified by <target>, locates all occurrences of the string specified in <string_builder_expr1> and inserts the string specified in <string_builder_expr2> before each. You can use a PCRE-format pattern or the search facility to find the strings. * INSERT_AFTER <string_builder_expr1> <string_builder_expr2>. Finds the string specified in <string_builder_expr1>, and inserts the string specified in <string_builder_expr2> after it. * INSERT_AFTER_ALL <target> <string_builder_expr1> -(pattern|search) <string_builder_expr>. In the request or response specified by <target>, locates all occurrences of the string specified by <string_builder_expr1> and inserts the string specified by <string_builder_expr2> after each. You can use a PCRE-format pattern or the search facility to find the strings. * DELETE <target>. Finds and deletes the specified target. * DELETE_ALL <target> -(pattern|search) <string_builder_expr>. In the request or response specified by <target>, locates and deletes all occurrences of the string specified by <string_builder_expr>. You can use a PCRE-format pattern or the search facility to find the strings. * REPLACE_DIAMETER_HEADER_FIELD <target> <field value>. In the request or response modify the header field specified by <target>. Use Diameter.req.flags.SET(<flag>) or Diameter.req.flags.UNSET<flag> as 'stringbuilderexpression' to set or unset flags. * REPLACE_DNS_HEADER_FIELD <target>. In the request or response modify the header field specified by <target>. * REPLACE_DNS_ANSWER_SECTION <target>. Replace the DNS answer section in the response. This is currently applicable for A and AAAA records only. Use DNS.NEW_RRSET_A & DNS.NEW_RRSET_AAAA expressions to configure the new answer section */ Type string `json:"type,omitempty"` /** * Expression that specifies which part of the request or response to rewrite. */ Target string `json:"target,omitempty"` /** * Expression that specifies the content to insert into the request or response at the specified location, or that replaces the specified string. */ Stringbuilderexpr string `json:"stringbuilderexpr,omitempty"` /** * DEPRECATED in favor of -search: Pattern that is used to match multiple strings in the request or response. The pattern may be a string literal (without quotes) or a PCRE-format regular expression with a delimiter that consists of any printable ASCII non-alphanumeric character except for the underscore (_) and space ( ) that is not otherwise used in the expression. Example: re~https?://|HTTPS?://~ The preceding regular expression can use the tilde (~) as the delimiter because that character does not appear in the regular expression itself. Used in the INSERT_BEFORE_ALL, INSERT_AFTER_ALL, REPLACE_ALL, and DELETE_ALL action types. */ Pattern string `json:"pattern,omitempty"` /** * Search facility that is used to match multiple strings in the request or response. Used in the INSERT_BEFORE_ALL, INSERT_AFTER_ALL, REPLACE_ALL, and DELETE_ALL action types. The following search types are supported: * Text ("text(string)") - A literal string. Example: -search text("hello") * Regular expression ("regex(re<delimiter>regular exp<delimiter>)") - Pattern that is used to match multiple strings in the request or response. The pattern may be a PCRE-format regular expression with a delimiter that consists of any printable ASCII non-alphanumeric character except for the underscore (_) and space ( ) that is not otherwise used in the expression. Example: -search regex(re~^hello*~) The preceding regular expression can use the tilde (~) as the delimiter because that character does not appear in the regular expression itself. * XPath ("xpath(xp<delimiter>xpath expression<delimiter>)") - An XPath expression to search XML. The delimiter has the same rules as for regex. Example: -search xpath(xp%/a/b%) * JSON ("xpath_json(xp<delimiter>xpath expression<delimiter>)") - An XPath expression to search JSON. The delimiter has the same rules as for regex. Example: -search xpath_json(xp%/a/b%) NOTE: JSON searches use the same syntax as XPath searches, but operate on JSON files instead of standard XML files. * HTML ("xpath_html(xp<delimiter>xpath expression<delimiter>)") - An XPath expression to search HTML. The delimiter has the same rules as for regex. Example: -search xpath_html(xp%/html/body%) NOTE: HTML searches use the same syntax as XPath searches, but operate on HTML files instead of standard XML files; HTML 5 rules for the file syntax are used; HTML 4 and later are supported. * Patset ("patset(patset)") - A predefined pattern set. Example: -search patset("patset1"). * Datset ("dataset(dataset)") - A predefined dataset. Example: -search dataset("dataset1"). * AVP ("avp(avp number)") - AVP number that is used to match multiple AVPs in a Diameter/Radius Message. Example: -search avp(999) Note: for all these the TARGET prefix can be used in the replacement expression to specify the text that was selected by the -search parameter, optionally adjusted by the -refineSearch parameter. Example: TARGET.BEFORE_STR(",") */ Search string `json:"search,omitempty"` /** * Bypass the safety check and allow unsafe expressions. An unsafe expression is one that contains references to message elements that might not be present in all messages. If an expression refers to a missing request element, an empty string is used instead. */ Bypasssafetycheck string `json:"bypasssafetycheck,omitempty"` /** * Specify additional criteria to refine the results of the search. Always starts with the "extend(m,n)" operation, where 'm' specifies number of bytes to the left of selected data and 'n' specifies number of bytes to the right of selected data to extend the selected area. You can use refineSearch only on body expressions, and for the INSERT_BEFORE_ALL, INSERT_AFTER_ALL, REPLACE_ALL, and DELETE_ALL action types. Example: -refineSearch 'EXTEND(10, 20).REGEX_SELECT(re~0x[0-9a-zA-Z]+~). */ Refinesearch string `json:"refinesearch,omitempty"` /** * Comment. Can be used to preserve information about this rewrite action. */ Comment string `json:"comment,omitempty"` /** * New name for the rewrite action. Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyphen (-), period (.) hash (#), space ( ), at (@), equals (=), colon (:), and underscore characters. Can be changed after the rewrite policy is added. The following requirement applies only to the Citrix ADC CLI: If the name includes one or more spaces, enclose the name in double or single quotation marks (for example, "my rewrite action" or 'my rewrite action'). */ Newname string `json:"newname,omitempty"` //------- Read only Parameter ---------; Hits string `json:"hits,omitempty"` Undefhits string `json:"undefhits,omitempty"` Referencecount string `json:"referencecount,omitempty"` Description string `json:"description,omitempty"` Isdefault string `json:"isdefault,omitempty"` Builtin string `json:"builtin,omitempty"` Feature string `json:"feature,omitempty"` }
resource/config/rewriteaction.go
0.760206
0.482612
rewriteaction.go
starcoder
package Euler2D type PartitionMap struct { MaxIndex int // MaxIndex is partitioned into ParallelDegree partitions ParallelDegree int Partitions [][2]int // Beginning and end index of partitions } func NewPartitionMap(ParallelDegree, maxIndex int) (pm *PartitionMap) { pm = &PartitionMap{ MaxIndex: maxIndex, ParallelDegree: ParallelDegree, Partitions: make([][2]int, ParallelDegree), } for n := 0; n < ParallelDegree; n++ { pm.Partitions[n] = pm.Split1D(n) } return } func (pm *PartitionMap) GetBucket(kDim int) (bucketNum, min, max int) { _, bucketNum, min, max = pm.getBucketWithTryCount(kDim) return } func (pm *PartitionMap) getBucketWithTryCount(kDim int) (tryCount, bucketNum, min, max int) { // Initial guess bucketNum = int(float64(pm.ParallelDegree*kDim) / float64(pm.MaxIndex)) for !(pm.Partitions[bucketNum][0] <= kDim && pm.Partitions[bucketNum][1] > kDim) { if pm.Partitions[bucketNum][0] > kDim { bucketNum-- } else { bucketNum++ } if bucketNum == -1 || bucketNum == pm.ParallelDegree { return 0, -1, 0, 0 } tryCount++ } min, max = pm.Partitions[bucketNum][0], pm.Partitions[bucketNum][1] /* if tryCount != 0 { fmt.Printf("bn, kDim, maxIndex, ParallelDegree, tryCount = %d, %d, %d, %d, %d\n", bucketNum, kDim, pm.MaxIndex, pm.ParallelDegree, tryCount) } */ return } func (pm *PartitionMap) GetBucketRange(bucketNum int) (kMin, kMax int) { kMin, kMax = pm.Partitions[bucketNum][0], pm.Partitions[bucketNum][1] return } func (pm *PartitionMap) GetLocalK(baseK int) (k, Kmax, bn int) { var ( kmin, kmax int ) bn, kmin, kmax = pm.GetBucket(baseK) Kmax = kmax - kmin k = baseK - kmin return } func (pm *PartitionMap) GetGlobalK(kLocal, bn int) (kGlobal int) { if bn == -1 { kGlobal = kLocal return } var ( kMin = pm.Partitions[bn][0] ) kGlobal = kMin + kLocal return } func (pm *PartitionMap) GetBucketDimension(bn int) (kMax int) { if bn == -1 { kMax = pm.MaxIndex return } var ( k1, k2 = pm.GetBucketRange(bn) ) kMax = k2 - k1 return } func (pm *PartitionMap) Split1D(threadNum int) (bucket [2]int) { // This routine splits one dimension into c.ParallelDegree pieces, with a maximum imbalance of one item var ( Npart = pm.MaxIndex / (pm.ParallelDegree) startAdd, endAdd int remainder int ) remainder = pm.MaxIndex % pm.ParallelDegree if remainder != 0 { // spread the remainder over the first chunks evenly if threadNum+1 > remainder { startAdd = remainder endAdd = 0 } else { startAdd = threadNum endAdd = 1 } } bucket[0] = threadNum*Npart + startAdd bucket[1] = bucket[0] + Npart + endAdd return }
model_problems/Euler2D/indexing.go
0.544559
0.580174
indexing.go
starcoder
package concurrent import . "github.com/zx80live/gofp/fp" func (f BoolFuture) FlatMapBool(t func(Bool) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapString(t func(Bool) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapInt(t func(Bool) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapInt64(t func(Bool) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapByte(t func(Bool) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapRune(t func(Bool) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapFloat32(t func(Bool) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapFloat64(t func(Bool) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapAny(t func(Bool) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapBoolOption(t func(Bool) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapStringOption(t func(Bool) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapIntOption(t func(Bool) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapInt64Option(t func(Bool) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapByteOption(t func(Bool) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapRuneOption(t func(Bool) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapFloat32Option(t func(Bool) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapFloat64Option(t func(Bool) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapAnyOption(t func(Bool) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapBoolListOption(t func(Bool) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapStringListOption(t func(Bool) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapIntListOption(t func(Bool) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapInt64ListOption(t func(Bool) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapByteListOption(t func(Bool) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapRuneListOption(t func(Bool) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapFloat32ListOption(t func(Bool) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapFloat64ListOption(t func(Bool) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapAnyListOption(t func(Bool) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapBoolArrayOption(t func(Bool) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapStringArrayOption(t func(Bool) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapIntArrayOption(t func(Bool) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapInt64ArrayOption(t func(Bool) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapByteArrayOption(t func(Bool) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapRuneArrayOption(t func(Bool) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapFloat32ArrayOption(t func(Bool) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapFloat64ArrayOption(t func(Bool) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapAnyArrayOption(t func(Bool) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapBoolList(t func(Bool) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapStringList(t func(Bool) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapIntList(t func(Bool) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapInt64List(t func(Bool) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapByteList(t func(Bool) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapRuneList(t func(Bool) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapFloat32List(t func(Bool) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapFloat64List(t func(Bool) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapAnyList(t func(Bool) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapBoolArray(t func(Bool) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapStringArray(t func(Bool) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapIntArray(t func(Bool) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapInt64Array(t func(Bool) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapByteArray(t func(Bool) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapRuneArray(t func(Bool) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapFloat32Array(t func(Bool) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapFloat64Array(t func(Bool) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f BoolFuture) FlatMapAnyArray(t func(Bool) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapBool(t func(String) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapString(t func(String) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapInt(t func(String) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapInt64(t func(String) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapByte(t func(String) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapRune(t func(String) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapFloat32(t func(String) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapFloat64(t func(String) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapAny(t func(String) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapBoolOption(t func(String) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapStringOption(t func(String) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapIntOption(t func(String) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapInt64Option(t func(String) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapByteOption(t func(String) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapRuneOption(t func(String) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapFloat32Option(t func(String) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapFloat64Option(t func(String) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapAnyOption(t func(String) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapBoolListOption(t func(String) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapStringListOption(t func(String) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapIntListOption(t func(String) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapInt64ListOption(t func(String) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapByteListOption(t func(String) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapRuneListOption(t func(String) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapFloat32ListOption(t func(String) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapFloat64ListOption(t func(String) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapAnyListOption(t func(String) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapBoolArrayOption(t func(String) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapStringArrayOption(t func(String) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapIntArrayOption(t func(String) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapInt64ArrayOption(t func(String) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapByteArrayOption(t func(String) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapRuneArrayOption(t func(String) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapFloat32ArrayOption(t func(String) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapFloat64ArrayOption(t func(String) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapAnyArrayOption(t func(String) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapBoolList(t func(String) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapStringList(t func(String) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapIntList(t func(String) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapInt64List(t func(String) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapByteList(t func(String) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapRuneList(t func(String) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapFloat32List(t func(String) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapFloat64List(t func(String) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapAnyList(t func(String) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapBoolArray(t func(String) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapStringArray(t func(String) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapIntArray(t func(String) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapInt64Array(t func(String) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapByteArray(t func(String) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapRuneArray(t func(String) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapFloat32Array(t func(String) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapFloat64Array(t func(String) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f StringFuture) FlatMapAnyArray(t func(String) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapBool(t func(Int) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapString(t func(Int) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapInt(t func(Int) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapInt64(t func(Int) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapByte(t func(Int) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapRune(t func(Int) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapFloat32(t func(Int) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapFloat64(t func(Int) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapAny(t func(Int) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapBoolOption(t func(Int) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapStringOption(t func(Int) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapIntOption(t func(Int) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapInt64Option(t func(Int) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapByteOption(t func(Int) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapRuneOption(t func(Int) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapFloat32Option(t func(Int) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapFloat64Option(t func(Int) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapAnyOption(t func(Int) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapBoolListOption(t func(Int) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapStringListOption(t func(Int) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapIntListOption(t func(Int) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapInt64ListOption(t func(Int) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapByteListOption(t func(Int) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapRuneListOption(t func(Int) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapFloat32ListOption(t func(Int) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapFloat64ListOption(t func(Int) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapAnyListOption(t func(Int) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapBoolArrayOption(t func(Int) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapStringArrayOption(t func(Int) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapIntArrayOption(t func(Int) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapInt64ArrayOption(t func(Int) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapByteArrayOption(t func(Int) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapRuneArrayOption(t func(Int) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapFloat32ArrayOption(t func(Int) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapFloat64ArrayOption(t func(Int) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapAnyArrayOption(t func(Int) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapBoolList(t func(Int) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapStringList(t func(Int) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapIntList(t func(Int) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapInt64List(t func(Int) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapByteList(t func(Int) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapRuneList(t func(Int) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapFloat32List(t func(Int) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapFloat64List(t func(Int) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapAnyList(t func(Int) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapBoolArray(t func(Int) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapStringArray(t func(Int) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapIntArray(t func(Int) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapInt64Array(t func(Int) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapByteArray(t func(Int) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapRuneArray(t func(Int) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapFloat32Array(t func(Int) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapFloat64Array(t func(Int) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f IntFuture) FlatMapAnyArray(t func(Int) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapBool(t func(Int64) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapString(t func(Int64) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapInt(t func(Int64) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapInt64(t func(Int64) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapByte(t func(Int64) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapRune(t func(Int64) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapFloat32(t func(Int64) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapFloat64(t func(Int64) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapAny(t func(Int64) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapBoolOption(t func(Int64) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapStringOption(t func(Int64) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapIntOption(t func(Int64) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapInt64Option(t func(Int64) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapByteOption(t func(Int64) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapRuneOption(t func(Int64) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapFloat32Option(t func(Int64) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapFloat64Option(t func(Int64) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapAnyOption(t func(Int64) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapBoolListOption(t func(Int64) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapStringListOption(t func(Int64) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapIntListOption(t func(Int64) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapInt64ListOption(t func(Int64) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapByteListOption(t func(Int64) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapRuneListOption(t func(Int64) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapFloat32ListOption(t func(Int64) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapFloat64ListOption(t func(Int64) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapAnyListOption(t func(Int64) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapBoolArrayOption(t func(Int64) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapStringArrayOption(t func(Int64) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapIntArrayOption(t func(Int64) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapInt64ArrayOption(t func(Int64) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapByteArrayOption(t func(Int64) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapRuneArrayOption(t func(Int64) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapFloat32ArrayOption(t func(Int64) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapFloat64ArrayOption(t func(Int64) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapAnyArrayOption(t func(Int64) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapBoolList(t func(Int64) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapStringList(t func(Int64) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapIntList(t func(Int64) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapInt64List(t func(Int64) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapByteList(t func(Int64) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapRuneList(t func(Int64) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapFloat32List(t func(Int64) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapFloat64List(t func(Int64) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapAnyList(t func(Int64) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapBoolArray(t func(Int64) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapStringArray(t func(Int64) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapIntArray(t func(Int64) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapInt64Array(t func(Int64) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapByteArray(t func(Int64) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapRuneArray(t func(Int64) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapFloat32Array(t func(Int64) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapFloat64Array(t func(Int64) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Int64Future) FlatMapAnyArray(t func(Int64) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapBool(t func(Byte) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapString(t func(Byte) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapInt(t func(Byte) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapInt64(t func(Byte) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapByte(t func(Byte) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapRune(t func(Byte) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapFloat32(t func(Byte) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapFloat64(t func(Byte) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapAny(t func(Byte) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapBoolOption(t func(Byte) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapStringOption(t func(Byte) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapIntOption(t func(Byte) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapInt64Option(t func(Byte) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapByteOption(t func(Byte) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapRuneOption(t func(Byte) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapFloat32Option(t func(Byte) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapFloat64Option(t func(Byte) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapAnyOption(t func(Byte) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapBoolListOption(t func(Byte) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapStringListOption(t func(Byte) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapIntListOption(t func(Byte) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapInt64ListOption(t func(Byte) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapByteListOption(t func(Byte) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapRuneListOption(t func(Byte) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapFloat32ListOption(t func(Byte) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapFloat64ListOption(t func(Byte) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapAnyListOption(t func(Byte) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapBoolArrayOption(t func(Byte) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapStringArrayOption(t func(Byte) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapIntArrayOption(t func(Byte) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapInt64ArrayOption(t func(Byte) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapByteArrayOption(t func(Byte) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapRuneArrayOption(t func(Byte) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapFloat32ArrayOption(t func(Byte) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapFloat64ArrayOption(t func(Byte) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapAnyArrayOption(t func(Byte) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapBoolList(t func(Byte) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapStringList(t func(Byte) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapIntList(t func(Byte) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapInt64List(t func(Byte) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapByteList(t func(Byte) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapRuneList(t func(Byte) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapFloat32List(t func(Byte) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapFloat64List(t func(Byte) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapAnyList(t func(Byte) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapBoolArray(t func(Byte) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapStringArray(t func(Byte) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapIntArray(t func(Byte) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapInt64Array(t func(Byte) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapByteArray(t func(Byte) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapRuneArray(t func(Byte) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapFloat32Array(t func(Byte) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapFloat64Array(t func(Byte) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f ByteFuture) FlatMapAnyArray(t func(Byte) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapBool(t func(Rune) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapString(t func(Rune) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapInt(t func(Rune) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapInt64(t func(Rune) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapByte(t func(Rune) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapRune(t func(Rune) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapFloat32(t func(Rune) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapFloat64(t func(Rune) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapAny(t func(Rune) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapBoolOption(t func(Rune) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapStringOption(t func(Rune) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapIntOption(t func(Rune) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapInt64Option(t func(Rune) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapByteOption(t func(Rune) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapRuneOption(t func(Rune) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapFloat32Option(t func(Rune) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapFloat64Option(t func(Rune) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapAnyOption(t func(Rune) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapBoolListOption(t func(Rune) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapStringListOption(t func(Rune) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapIntListOption(t func(Rune) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapInt64ListOption(t func(Rune) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapByteListOption(t func(Rune) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapRuneListOption(t func(Rune) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapFloat32ListOption(t func(Rune) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapFloat64ListOption(t func(Rune) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapAnyListOption(t func(Rune) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapBoolArrayOption(t func(Rune) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapStringArrayOption(t func(Rune) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapIntArrayOption(t func(Rune) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapInt64ArrayOption(t func(Rune) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapByteArrayOption(t func(Rune) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapRuneArrayOption(t func(Rune) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapFloat32ArrayOption(t func(Rune) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapFloat64ArrayOption(t func(Rune) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapAnyArrayOption(t func(Rune) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapBoolList(t func(Rune) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapStringList(t func(Rune) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapIntList(t func(Rune) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapInt64List(t func(Rune) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapByteList(t func(Rune) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapRuneList(t func(Rune) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapFloat32List(t func(Rune) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapFloat64List(t func(Rune) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapAnyList(t func(Rune) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapBoolArray(t func(Rune) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapStringArray(t func(Rune) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapIntArray(t func(Rune) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapInt64Array(t func(Rune) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapByteArray(t func(Rune) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapRuneArray(t func(Rune) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapFloat32Array(t func(Rune) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapFloat64Array(t func(Rune) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f RuneFuture) FlatMapAnyArray(t func(Rune) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapBool(t func(Float32) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapString(t func(Float32) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapInt(t func(Float32) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapInt64(t func(Float32) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapByte(t func(Float32) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapRune(t func(Float32) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapFloat32(t func(Float32) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapFloat64(t func(Float32) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapAny(t func(Float32) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapBoolOption(t func(Float32) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapStringOption(t func(Float32) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapIntOption(t func(Float32) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapInt64Option(t func(Float32) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapByteOption(t func(Float32) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapRuneOption(t func(Float32) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapFloat32Option(t func(Float32) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapFloat64Option(t func(Float32) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapAnyOption(t func(Float32) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapBoolListOption(t func(Float32) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapStringListOption(t func(Float32) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapIntListOption(t func(Float32) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapInt64ListOption(t func(Float32) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapByteListOption(t func(Float32) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapRuneListOption(t func(Float32) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapFloat32ListOption(t func(Float32) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapFloat64ListOption(t func(Float32) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapAnyListOption(t func(Float32) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapBoolArrayOption(t func(Float32) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapStringArrayOption(t func(Float32) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapIntArrayOption(t func(Float32) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapInt64ArrayOption(t func(Float32) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapByteArrayOption(t func(Float32) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapRuneArrayOption(t func(Float32) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapFloat32ArrayOption(t func(Float32) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapFloat64ArrayOption(t func(Float32) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapAnyArrayOption(t func(Float32) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapBoolList(t func(Float32) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapStringList(t func(Float32) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapIntList(t func(Float32) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapInt64List(t func(Float32) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapByteList(t func(Float32) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapRuneList(t func(Float32) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapFloat32List(t func(Float32) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapFloat64List(t func(Float32) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapAnyList(t func(Float32) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapBoolArray(t func(Float32) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapStringArray(t func(Float32) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapIntArray(t func(Float32) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapInt64Array(t func(Float32) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapByteArray(t func(Float32) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapRuneArray(t func(Float32) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapFloat32Array(t func(Float32) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapFloat64Array(t func(Float32) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Float32Future) FlatMapAnyArray(t func(Float32) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapBool(t func(Float64) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapString(t func(Float64) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapInt(t func(Float64) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapInt64(t func(Float64) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapByte(t func(Float64) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapRune(t func(Float64) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapFloat32(t func(Float64) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapFloat64(t func(Float64) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapAny(t func(Float64) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapBoolOption(t func(Float64) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapStringOption(t func(Float64) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapIntOption(t func(Float64) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapInt64Option(t func(Float64) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapByteOption(t func(Float64) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapRuneOption(t func(Float64) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapFloat32Option(t func(Float64) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapFloat64Option(t func(Float64) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapAnyOption(t func(Float64) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapBoolListOption(t func(Float64) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapStringListOption(t func(Float64) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapIntListOption(t func(Float64) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapInt64ListOption(t func(Float64) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapByteListOption(t func(Float64) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapRuneListOption(t func(Float64) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapFloat32ListOption(t func(Float64) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapFloat64ListOption(t func(Float64) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapAnyListOption(t func(Float64) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapBoolArrayOption(t func(Float64) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapStringArrayOption(t func(Float64) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapIntArrayOption(t func(Float64) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapInt64ArrayOption(t func(Float64) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapByteArrayOption(t func(Float64) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapRuneArrayOption(t func(Float64) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapFloat32ArrayOption(t func(Float64) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapFloat64ArrayOption(t func(Float64) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapAnyArrayOption(t func(Float64) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapBoolList(t func(Float64) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapStringList(t func(Float64) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapIntList(t func(Float64) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapInt64List(t func(Float64) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapByteList(t func(Float64) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapRuneList(t func(Float64) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapFloat32List(t func(Float64) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapFloat64List(t func(Float64) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapAnyList(t func(Float64) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapBoolArray(t func(Float64) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapStringArray(t func(Float64) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapIntArray(t func(Float64) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapInt64Array(t func(Float64) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapByteArray(t func(Float64) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapRuneArray(t func(Float64) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapFloat32Array(t func(Float64) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapFloat64Array(t func(Float64) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Float64Future) FlatMapAnyArray(t func(Float64) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapBool(t func(Any) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapString(t func(Any) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapInt(t func(Any) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapInt64(t func(Any) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapByte(t func(Any) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapRune(t func(Any) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapFloat32(t func(Any) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapFloat64(t func(Any) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapAny(t func(Any) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapBoolOption(t func(Any) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapStringOption(t func(Any) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapIntOption(t func(Any) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapInt64Option(t func(Any) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapByteOption(t func(Any) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapRuneOption(t func(Any) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapFloat32Option(t func(Any) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapFloat64Option(t func(Any) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapAnyOption(t func(Any) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapBoolListOption(t func(Any) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapStringListOption(t func(Any) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapIntListOption(t func(Any) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapInt64ListOption(t func(Any) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapByteListOption(t func(Any) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapRuneListOption(t func(Any) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapFloat32ListOption(t func(Any) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapFloat64ListOption(t func(Any) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapAnyListOption(t func(Any) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapBoolArrayOption(t func(Any) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapStringArrayOption(t func(Any) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapIntArrayOption(t func(Any) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapInt64ArrayOption(t func(Any) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapByteArrayOption(t func(Any) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapRuneArrayOption(t func(Any) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapFloat32ArrayOption(t func(Any) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapFloat64ArrayOption(t func(Any) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapAnyArrayOption(t func(Any) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapBoolList(t func(Any) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapStringList(t func(Any) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapIntList(t func(Any) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapInt64List(t func(Any) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapByteList(t func(Any) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapRuneList(t func(Any) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapFloat32List(t func(Any) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapFloat64List(t func(Any) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapAnyList(t func(Any) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapBoolArray(t func(Any) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapStringArray(t func(Any) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapIntArray(t func(Any) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapInt64Array(t func(Any) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapByteArray(t func(Any) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapRuneArray(t func(Any) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapFloat32Array(t func(Any) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapFloat64Array(t func(Any) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f AnyFuture) FlatMapAnyArray(t func(Any) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapBool(t func(BoolOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapString(t func(BoolOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapInt(t func(BoolOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapInt64(t func(BoolOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapByte(t func(BoolOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapRune(t func(BoolOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapFloat32(t func(BoolOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapFloat64(t func(BoolOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapAny(t func(BoolOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapBoolOption(t func(BoolOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapStringOption(t func(BoolOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapIntOption(t func(BoolOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapInt64Option(t func(BoolOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapByteOption(t func(BoolOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapRuneOption(t func(BoolOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapFloat32Option(t func(BoolOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapFloat64Option(t func(BoolOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapAnyOption(t func(BoolOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapBoolListOption(t func(BoolOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapStringListOption(t func(BoolOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapIntListOption(t func(BoolOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapInt64ListOption(t func(BoolOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapByteListOption(t func(BoolOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapRuneListOption(t func(BoolOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapFloat32ListOption(t func(BoolOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapFloat64ListOption(t func(BoolOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapAnyListOption(t func(BoolOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapBoolArrayOption(t func(BoolOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapStringArrayOption(t func(BoolOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapIntArrayOption(t func(BoolOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapInt64ArrayOption(t func(BoolOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapByteArrayOption(t func(BoolOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapRuneArrayOption(t func(BoolOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapFloat32ArrayOption(t func(BoolOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapFloat64ArrayOption(t func(BoolOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapAnyArrayOption(t func(BoolOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapBoolList(t func(BoolOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapStringList(t func(BoolOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapIntList(t func(BoolOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapInt64List(t func(BoolOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapByteList(t func(BoolOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapRuneList(t func(BoolOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapFloat32List(t func(BoolOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapFloat64List(t func(BoolOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapAnyList(t func(BoolOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapBoolArray(t func(BoolOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapStringArray(t func(BoolOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapIntArray(t func(BoolOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapInt64Array(t func(BoolOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapByteArray(t func(BoolOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapRuneArray(t func(BoolOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapFloat32Array(t func(BoolOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapFloat64Array(t func(BoolOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f BoolOptionFuture) FlatMapAnyArray(t func(BoolOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapBool(t func(StringOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapString(t func(StringOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapInt(t func(StringOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapInt64(t func(StringOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapByte(t func(StringOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapRune(t func(StringOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapFloat32(t func(StringOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapFloat64(t func(StringOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapAny(t func(StringOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapBoolOption(t func(StringOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapStringOption(t func(StringOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapIntOption(t func(StringOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapInt64Option(t func(StringOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapByteOption(t func(StringOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapRuneOption(t func(StringOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapFloat32Option(t func(StringOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapFloat64Option(t func(StringOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapAnyOption(t func(StringOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapBoolListOption(t func(StringOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapStringListOption(t func(StringOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapIntListOption(t func(StringOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapInt64ListOption(t func(StringOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapByteListOption(t func(StringOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapRuneListOption(t func(StringOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapFloat32ListOption(t func(StringOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapFloat64ListOption(t func(StringOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapAnyListOption(t func(StringOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapBoolArrayOption(t func(StringOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapStringArrayOption(t func(StringOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapIntArrayOption(t func(StringOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapInt64ArrayOption(t func(StringOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapByteArrayOption(t func(StringOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapRuneArrayOption(t func(StringOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapFloat32ArrayOption(t func(StringOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapFloat64ArrayOption(t func(StringOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapAnyArrayOption(t func(StringOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapBoolList(t func(StringOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapStringList(t func(StringOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapIntList(t func(StringOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapInt64List(t func(StringOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapByteList(t func(StringOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapRuneList(t func(StringOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapFloat32List(t func(StringOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapFloat64List(t func(StringOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapAnyList(t func(StringOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapBoolArray(t func(StringOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapStringArray(t func(StringOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapIntArray(t func(StringOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapInt64Array(t func(StringOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapByteArray(t func(StringOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapRuneArray(t func(StringOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapFloat32Array(t func(StringOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapFloat64Array(t func(StringOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f StringOptionFuture) FlatMapAnyArray(t func(StringOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapBool(t func(IntOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapString(t func(IntOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapInt(t func(IntOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapInt64(t func(IntOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapByte(t func(IntOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapRune(t func(IntOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapFloat32(t func(IntOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapFloat64(t func(IntOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapAny(t func(IntOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapBoolOption(t func(IntOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapStringOption(t func(IntOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapIntOption(t func(IntOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapInt64Option(t func(IntOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapByteOption(t func(IntOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapRuneOption(t func(IntOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapFloat32Option(t func(IntOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapFloat64Option(t func(IntOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapAnyOption(t func(IntOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapBoolListOption(t func(IntOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapStringListOption(t func(IntOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapIntListOption(t func(IntOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapInt64ListOption(t func(IntOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapByteListOption(t func(IntOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapRuneListOption(t func(IntOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapFloat32ListOption(t func(IntOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapFloat64ListOption(t func(IntOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapAnyListOption(t func(IntOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapBoolArrayOption(t func(IntOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapStringArrayOption(t func(IntOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapIntArrayOption(t func(IntOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapInt64ArrayOption(t func(IntOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapByteArrayOption(t func(IntOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapRuneArrayOption(t func(IntOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapFloat32ArrayOption(t func(IntOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapFloat64ArrayOption(t func(IntOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapAnyArrayOption(t func(IntOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapBoolList(t func(IntOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapStringList(t func(IntOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapIntList(t func(IntOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapInt64List(t func(IntOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapByteList(t func(IntOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapRuneList(t func(IntOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapFloat32List(t func(IntOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapFloat64List(t func(IntOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapAnyList(t func(IntOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapBoolArray(t func(IntOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapStringArray(t func(IntOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapIntArray(t func(IntOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapInt64Array(t func(IntOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapByteArray(t func(IntOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapRuneArray(t func(IntOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapFloat32Array(t func(IntOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapFloat64Array(t func(IntOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f IntOptionFuture) FlatMapAnyArray(t func(IntOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapBool(t func(Int64Option) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapString(t func(Int64Option) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapInt(t func(Int64Option) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapInt64(t func(Int64Option) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapByte(t func(Int64Option) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapRune(t func(Int64Option) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapFloat32(t func(Int64Option) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapFloat64(t func(Int64Option) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapAny(t func(Int64Option) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapBoolOption(t func(Int64Option) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapStringOption(t func(Int64Option) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapIntOption(t func(Int64Option) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapInt64Option(t func(Int64Option) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapByteOption(t func(Int64Option) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapRuneOption(t func(Int64Option) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapFloat32Option(t func(Int64Option) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapFloat64Option(t func(Int64Option) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapAnyOption(t func(Int64Option) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapBoolListOption(t func(Int64Option) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapStringListOption(t func(Int64Option) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapIntListOption(t func(Int64Option) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapInt64ListOption(t func(Int64Option) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapByteListOption(t func(Int64Option) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapRuneListOption(t func(Int64Option) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapFloat32ListOption(t func(Int64Option) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapFloat64ListOption(t func(Int64Option) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapAnyListOption(t func(Int64Option) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapBoolArrayOption(t func(Int64Option) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapStringArrayOption(t func(Int64Option) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapIntArrayOption(t func(Int64Option) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapInt64ArrayOption(t func(Int64Option) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapByteArrayOption(t func(Int64Option) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapRuneArrayOption(t func(Int64Option) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapFloat32ArrayOption(t func(Int64Option) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapFloat64ArrayOption(t func(Int64Option) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapAnyArrayOption(t func(Int64Option) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapBoolList(t func(Int64Option) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapStringList(t func(Int64Option) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapIntList(t func(Int64Option) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapInt64List(t func(Int64Option) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapByteList(t func(Int64Option) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapRuneList(t func(Int64Option) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapFloat32List(t func(Int64Option) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapFloat64List(t func(Int64Option) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapAnyList(t func(Int64Option) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapBoolArray(t func(Int64Option) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapStringArray(t func(Int64Option) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapIntArray(t func(Int64Option) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapInt64Array(t func(Int64Option) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapByteArray(t func(Int64Option) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapRuneArray(t func(Int64Option) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapFloat32Array(t func(Int64Option) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapFloat64Array(t func(Int64Option) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Int64OptionFuture) FlatMapAnyArray(t func(Int64Option) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapBool(t func(ByteOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapString(t func(ByteOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapInt(t func(ByteOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapInt64(t func(ByteOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapByte(t func(ByteOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapRune(t func(ByteOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapFloat32(t func(ByteOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapFloat64(t func(ByteOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapAny(t func(ByteOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapBoolOption(t func(ByteOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapStringOption(t func(ByteOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapIntOption(t func(ByteOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapInt64Option(t func(ByteOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapByteOption(t func(ByteOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapRuneOption(t func(ByteOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapFloat32Option(t func(ByteOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapFloat64Option(t func(ByteOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapAnyOption(t func(ByteOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapBoolListOption(t func(ByteOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapStringListOption(t func(ByteOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapIntListOption(t func(ByteOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapInt64ListOption(t func(ByteOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapByteListOption(t func(ByteOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapRuneListOption(t func(ByteOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapFloat32ListOption(t func(ByteOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapFloat64ListOption(t func(ByteOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapAnyListOption(t func(ByteOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapBoolArrayOption(t func(ByteOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapStringArrayOption(t func(ByteOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapIntArrayOption(t func(ByteOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapInt64ArrayOption(t func(ByteOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapByteArrayOption(t func(ByteOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapRuneArrayOption(t func(ByteOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapFloat32ArrayOption(t func(ByteOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapFloat64ArrayOption(t func(ByteOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapAnyArrayOption(t func(ByteOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapBoolList(t func(ByteOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapStringList(t func(ByteOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapIntList(t func(ByteOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapInt64List(t func(ByteOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapByteList(t func(ByteOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapRuneList(t func(ByteOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapFloat32List(t func(ByteOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapFloat64List(t func(ByteOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapAnyList(t func(ByteOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapBoolArray(t func(ByteOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapStringArray(t func(ByteOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapIntArray(t func(ByteOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapInt64Array(t func(ByteOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapByteArray(t func(ByteOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapRuneArray(t func(ByteOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapFloat32Array(t func(ByteOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapFloat64Array(t func(ByteOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f ByteOptionFuture) FlatMapAnyArray(t func(ByteOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapBool(t func(RuneOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapString(t func(RuneOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapInt(t func(RuneOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapInt64(t func(RuneOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapByte(t func(RuneOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapRune(t func(RuneOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapFloat32(t func(RuneOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapFloat64(t func(RuneOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapAny(t func(RuneOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapBoolOption(t func(RuneOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapStringOption(t func(RuneOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapIntOption(t func(RuneOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapInt64Option(t func(RuneOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapByteOption(t func(RuneOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapRuneOption(t func(RuneOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapFloat32Option(t func(RuneOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapFloat64Option(t func(RuneOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapAnyOption(t func(RuneOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapBoolListOption(t func(RuneOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapStringListOption(t func(RuneOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapIntListOption(t func(RuneOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapInt64ListOption(t func(RuneOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapByteListOption(t func(RuneOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapRuneListOption(t func(RuneOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapFloat32ListOption(t func(RuneOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapFloat64ListOption(t func(RuneOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapAnyListOption(t func(RuneOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapBoolArrayOption(t func(RuneOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapStringArrayOption(t func(RuneOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapIntArrayOption(t func(RuneOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapInt64ArrayOption(t func(RuneOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapByteArrayOption(t func(RuneOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapRuneArrayOption(t func(RuneOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapFloat32ArrayOption(t func(RuneOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapFloat64ArrayOption(t func(RuneOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapAnyArrayOption(t func(RuneOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapBoolList(t func(RuneOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapStringList(t func(RuneOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapIntList(t func(RuneOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapInt64List(t func(RuneOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapByteList(t func(RuneOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapRuneList(t func(RuneOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapFloat32List(t func(RuneOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapFloat64List(t func(RuneOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapAnyList(t func(RuneOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapBoolArray(t func(RuneOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapStringArray(t func(RuneOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapIntArray(t func(RuneOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapInt64Array(t func(RuneOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapByteArray(t func(RuneOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapRuneArray(t func(RuneOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapFloat32Array(t func(RuneOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapFloat64Array(t func(RuneOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f RuneOptionFuture) FlatMapAnyArray(t func(RuneOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapBool(t func(Float32Option) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapString(t func(Float32Option) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapInt(t func(Float32Option) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapInt64(t func(Float32Option) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapByte(t func(Float32Option) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapRune(t func(Float32Option) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapFloat32(t func(Float32Option) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapFloat64(t func(Float32Option) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapAny(t func(Float32Option) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapBoolOption(t func(Float32Option) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapStringOption(t func(Float32Option) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapIntOption(t func(Float32Option) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapInt64Option(t func(Float32Option) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapByteOption(t func(Float32Option) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapRuneOption(t func(Float32Option) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapFloat32Option(t func(Float32Option) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapFloat64Option(t func(Float32Option) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapAnyOption(t func(Float32Option) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapBoolListOption(t func(Float32Option) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapStringListOption(t func(Float32Option) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapIntListOption(t func(Float32Option) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapInt64ListOption(t func(Float32Option) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapByteListOption(t func(Float32Option) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapRuneListOption(t func(Float32Option) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapFloat32ListOption(t func(Float32Option) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapFloat64ListOption(t func(Float32Option) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapAnyListOption(t func(Float32Option) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapBoolArrayOption(t func(Float32Option) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapStringArrayOption(t func(Float32Option) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapIntArrayOption(t func(Float32Option) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapInt64ArrayOption(t func(Float32Option) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapByteArrayOption(t func(Float32Option) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapRuneArrayOption(t func(Float32Option) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapFloat32ArrayOption(t func(Float32Option) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapFloat64ArrayOption(t func(Float32Option) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapAnyArrayOption(t func(Float32Option) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapBoolList(t func(Float32Option) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapStringList(t func(Float32Option) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapIntList(t func(Float32Option) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapInt64List(t func(Float32Option) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapByteList(t func(Float32Option) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapRuneList(t func(Float32Option) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapFloat32List(t func(Float32Option) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapFloat64List(t func(Float32Option) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapAnyList(t func(Float32Option) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapBoolArray(t func(Float32Option) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapStringArray(t func(Float32Option) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapIntArray(t func(Float32Option) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapInt64Array(t func(Float32Option) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapByteArray(t func(Float32Option) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapRuneArray(t func(Float32Option) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapFloat32Array(t func(Float32Option) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapFloat64Array(t func(Float32Option) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Float32OptionFuture) FlatMapAnyArray(t func(Float32Option) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapBool(t func(Float64Option) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapString(t func(Float64Option) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapInt(t func(Float64Option) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapInt64(t func(Float64Option) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapByte(t func(Float64Option) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapRune(t func(Float64Option) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapFloat32(t func(Float64Option) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapFloat64(t func(Float64Option) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapAny(t func(Float64Option) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapBoolOption(t func(Float64Option) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapStringOption(t func(Float64Option) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapIntOption(t func(Float64Option) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapInt64Option(t func(Float64Option) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapByteOption(t func(Float64Option) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapRuneOption(t func(Float64Option) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapFloat32Option(t func(Float64Option) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapFloat64Option(t func(Float64Option) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapAnyOption(t func(Float64Option) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapBoolListOption(t func(Float64Option) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapStringListOption(t func(Float64Option) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapIntListOption(t func(Float64Option) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapInt64ListOption(t func(Float64Option) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapByteListOption(t func(Float64Option) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapRuneListOption(t func(Float64Option) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapFloat32ListOption(t func(Float64Option) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapFloat64ListOption(t func(Float64Option) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapAnyListOption(t func(Float64Option) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapBoolArrayOption(t func(Float64Option) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapStringArrayOption(t func(Float64Option) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapIntArrayOption(t func(Float64Option) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapInt64ArrayOption(t func(Float64Option) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapByteArrayOption(t func(Float64Option) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapRuneArrayOption(t func(Float64Option) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapFloat32ArrayOption(t func(Float64Option) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapFloat64ArrayOption(t func(Float64Option) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapAnyArrayOption(t func(Float64Option) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapBoolList(t func(Float64Option) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapStringList(t func(Float64Option) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapIntList(t func(Float64Option) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapInt64List(t func(Float64Option) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapByteList(t func(Float64Option) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapRuneList(t func(Float64Option) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapFloat32List(t func(Float64Option) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapFloat64List(t func(Float64Option) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapAnyList(t func(Float64Option) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapBoolArray(t func(Float64Option) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapStringArray(t func(Float64Option) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapIntArray(t func(Float64Option) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapInt64Array(t func(Float64Option) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapByteArray(t func(Float64Option) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapRuneArray(t func(Float64Option) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapFloat32Array(t func(Float64Option) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapFloat64Array(t func(Float64Option) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Float64OptionFuture) FlatMapAnyArray(t func(Float64Option) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapBool(t func(AnyOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapString(t func(AnyOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapInt(t func(AnyOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapInt64(t func(AnyOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapByte(t func(AnyOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapRune(t func(AnyOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapFloat32(t func(AnyOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapFloat64(t func(AnyOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapAny(t func(AnyOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapBoolOption(t func(AnyOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapStringOption(t func(AnyOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapIntOption(t func(AnyOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapInt64Option(t func(AnyOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapByteOption(t func(AnyOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapRuneOption(t func(AnyOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapFloat32Option(t func(AnyOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapFloat64Option(t func(AnyOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapAnyOption(t func(AnyOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapBoolListOption(t func(AnyOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapStringListOption(t func(AnyOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapIntListOption(t func(AnyOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapInt64ListOption(t func(AnyOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapByteListOption(t func(AnyOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapRuneListOption(t func(AnyOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapFloat32ListOption(t func(AnyOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapFloat64ListOption(t func(AnyOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapAnyListOption(t func(AnyOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapBoolArrayOption(t func(AnyOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapStringArrayOption(t func(AnyOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapIntArrayOption(t func(AnyOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapInt64ArrayOption(t func(AnyOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapByteArrayOption(t func(AnyOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapRuneArrayOption(t func(AnyOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapFloat32ArrayOption(t func(AnyOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapFloat64ArrayOption(t func(AnyOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapAnyArrayOption(t func(AnyOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapBoolList(t func(AnyOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapStringList(t func(AnyOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapIntList(t func(AnyOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapInt64List(t func(AnyOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapByteList(t func(AnyOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapRuneList(t func(AnyOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapFloat32List(t func(AnyOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapFloat64List(t func(AnyOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapAnyList(t func(AnyOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapBoolArray(t func(AnyOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapStringArray(t func(AnyOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapIntArray(t func(AnyOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapInt64Array(t func(AnyOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapByteArray(t func(AnyOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapRuneArray(t func(AnyOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapFloat32Array(t func(AnyOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapFloat64Array(t func(AnyOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f AnyOptionFuture) FlatMapAnyArray(t func(AnyOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapBool(t func(BoolListOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapString(t func(BoolListOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapInt(t func(BoolListOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapInt64(t func(BoolListOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapByte(t func(BoolListOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapRune(t func(BoolListOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapFloat32(t func(BoolListOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapFloat64(t func(BoolListOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapAny(t func(BoolListOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapBoolOption(t func(BoolListOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapStringOption(t func(BoolListOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapIntOption(t func(BoolListOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapInt64Option(t func(BoolListOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapByteOption(t func(BoolListOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapRuneOption(t func(BoolListOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapFloat32Option(t func(BoolListOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapFloat64Option(t func(BoolListOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapAnyOption(t func(BoolListOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapBoolListOption(t func(BoolListOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapStringListOption(t func(BoolListOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapIntListOption(t func(BoolListOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapInt64ListOption(t func(BoolListOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapByteListOption(t func(BoolListOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapRuneListOption(t func(BoolListOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapFloat32ListOption(t func(BoolListOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapFloat64ListOption(t func(BoolListOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapAnyListOption(t func(BoolListOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapBoolArrayOption(t func(BoolListOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapStringArrayOption(t func(BoolListOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapIntArrayOption(t func(BoolListOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapInt64ArrayOption(t func(BoolListOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapByteArrayOption(t func(BoolListOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapRuneArrayOption(t func(BoolListOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapFloat32ArrayOption(t func(BoolListOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapFloat64ArrayOption(t func(BoolListOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapAnyArrayOption(t func(BoolListOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapBoolList(t func(BoolListOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapStringList(t func(BoolListOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapIntList(t func(BoolListOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapInt64List(t func(BoolListOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapByteList(t func(BoolListOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapRuneList(t func(BoolListOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapFloat32List(t func(BoolListOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapFloat64List(t func(BoolListOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapAnyList(t func(BoolListOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapBoolArray(t func(BoolListOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapStringArray(t func(BoolListOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapIntArray(t func(BoolListOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapInt64Array(t func(BoolListOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapByteArray(t func(BoolListOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapRuneArray(t func(BoolListOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapFloat32Array(t func(BoolListOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapFloat64Array(t func(BoolListOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f BoolListOptionFuture) FlatMapAnyArray(t func(BoolListOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapBool(t func(StringListOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapString(t func(StringListOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapInt(t func(StringListOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapInt64(t func(StringListOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapByte(t func(StringListOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapRune(t func(StringListOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapFloat32(t func(StringListOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapFloat64(t func(StringListOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapAny(t func(StringListOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapBoolOption(t func(StringListOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapStringOption(t func(StringListOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapIntOption(t func(StringListOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapInt64Option(t func(StringListOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapByteOption(t func(StringListOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapRuneOption(t func(StringListOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapFloat32Option(t func(StringListOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapFloat64Option(t func(StringListOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapAnyOption(t func(StringListOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapBoolListOption(t func(StringListOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapStringListOption(t func(StringListOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapIntListOption(t func(StringListOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapInt64ListOption(t func(StringListOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapByteListOption(t func(StringListOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapRuneListOption(t func(StringListOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapFloat32ListOption(t func(StringListOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapFloat64ListOption(t func(StringListOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapAnyListOption(t func(StringListOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapBoolArrayOption(t func(StringListOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapStringArrayOption(t func(StringListOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapIntArrayOption(t func(StringListOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapInt64ArrayOption(t func(StringListOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapByteArrayOption(t func(StringListOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapRuneArrayOption(t func(StringListOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapFloat32ArrayOption(t func(StringListOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapFloat64ArrayOption(t func(StringListOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapAnyArrayOption(t func(StringListOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapBoolList(t func(StringListOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapStringList(t func(StringListOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapIntList(t func(StringListOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapInt64List(t func(StringListOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapByteList(t func(StringListOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapRuneList(t func(StringListOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapFloat32List(t func(StringListOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapFloat64List(t func(StringListOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapAnyList(t func(StringListOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapBoolArray(t func(StringListOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapStringArray(t func(StringListOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapIntArray(t func(StringListOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapInt64Array(t func(StringListOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapByteArray(t func(StringListOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapRuneArray(t func(StringListOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapFloat32Array(t func(StringListOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapFloat64Array(t func(StringListOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f StringListOptionFuture) FlatMapAnyArray(t func(StringListOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapBool(t func(IntListOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapString(t func(IntListOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapInt(t func(IntListOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapInt64(t func(IntListOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapByte(t func(IntListOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapRune(t func(IntListOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapFloat32(t func(IntListOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapFloat64(t func(IntListOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapAny(t func(IntListOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapBoolOption(t func(IntListOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapStringOption(t func(IntListOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapIntOption(t func(IntListOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapInt64Option(t func(IntListOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapByteOption(t func(IntListOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapRuneOption(t func(IntListOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapFloat32Option(t func(IntListOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapFloat64Option(t func(IntListOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapAnyOption(t func(IntListOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapBoolListOption(t func(IntListOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapStringListOption(t func(IntListOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapIntListOption(t func(IntListOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapInt64ListOption(t func(IntListOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapByteListOption(t func(IntListOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapRuneListOption(t func(IntListOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapFloat32ListOption(t func(IntListOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapFloat64ListOption(t func(IntListOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapAnyListOption(t func(IntListOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapBoolArrayOption(t func(IntListOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapStringArrayOption(t func(IntListOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapIntArrayOption(t func(IntListOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapInt64ArrayOption(t func(IntListOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapByteArrayOption(t func(IntListOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapRuneArrayOption(t func(IntListOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapFloat32ArrayOption(t func(IntListOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapFloat64ArrayOption(t func(IntListOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapAnyArrayOption(t func(IntListOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapBoolList(t func(IntListOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapStringList(t func(IntListOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapIntList(t func(IntListOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapInt64List(t func(IntListOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapByteList(t func(IntListOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapRuneList(t func(IntListOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapFloat32List(t func(IntListOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapFloat64List(t func(IntListOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapAnyList(t func(IntListOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapBoolArray(t func(IntListOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapStringArray(t func(IntListOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapIntArray(t func(IntListOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapInt64Array(t func(IntListOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapByteArray(t func(IntListOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapRuneArray(t func(IntListOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapFloat32Array(t func(IntListOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapFloat64Array(t func(IntListOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f IntListOptionFuture) FlatMapAnyArray(t func(IntListOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapBool(t func(Int64ListOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapString(t func(Int64ListOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapInt(t func(Int64ListOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapInt64(t func(Int64ListOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapByte(t func(Int64ListOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapRune(t func(Int64ListOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapFloat32(t func(Int64ListOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapFloat64(t func(Int64ListOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapAny(t func(Int64ListOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapBoolOption(t func(Int64ListOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapStringOption(t func(Int64ListOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapIntOption(t func(Int64ListOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapInt64Option(t func(Int64ListOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapByteOption(t func(Int64ListOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapRuneOption(t func(Int64ListOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapFloat32Option(t func(Int64ListOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapFloat64Option(t func(Int64ListOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapAnyOption(t func(Int64ListOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapBoolListOption(t func(Int64ListOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapStringListOption(t func(Int64ListOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapIntListOption(t func(Int64ListOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapInt64ListOption(t func(Int64ListOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapByteListOption(t func(Int64ListOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapRuneListOption(t func(Int64ListOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapFloat32ListOption(t func(Int64ListOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapFloat64ListOption(t func(Int64ListOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapAnyListOption(t func(Int64ListOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapBoolArrayOption(t func(Int64ListOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapStringArrayOption(t func(Int64ListOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapIntArrayOption(t func(Int64ListOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapInt64ArrayOption(t func(Int64ListOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapByteArrayOption(t func(Int64ListOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapRuneArrayOption(t func(Int64ListOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapFloat32ArrayOption(t func(Int64ListOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapFloat64ArrayOption(t func(Int64ListOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapAnyArrayOption(t func(Int64ListOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapBoolList(t func(Int64ListOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapStringList(t func(Int64ListOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapIntList(t func(Int64ListOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapInt64List(t func(Int64ListOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapByteList(t func(Int64ListOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapRuneList(t func(Int64ListOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapFloat32List(t func(Int64ListOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapFloat64List(t func(Int64ListOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapAnyList(t func(Int64ListOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapBoolArray(t func(Int64ListOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapStringArray(t func(Int64ListOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapIntArray(t func(Int64ListOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapInt64Array(t func(Int64ListOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapByteArray(t func(Int64ListOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapRuneArray(t func(Int64ListOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapFloat32Array(t func(Int64ListOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapFloat64Array(t func(Int64ListOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Int64ListOptionFuture) FlatMapAnyArray(t func(Int64ListOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapBool(t func(ByteListOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapString(t func(ByteListOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapInt(t func(ByteListOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapInt64(t func(ByteListOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapByte(t func(ByteListOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapRune(t func(ByteListOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapFloat32(t func(ByteListOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapFloat64(t func(ByteListOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapAny(t func(ByteListOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapBoolOption(t func(ByteListOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapStringOption(t func(ByteListOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapIntOption(t func(ByteListOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapInt64Option(t func(ByteListOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapByteOption(t func(ByteListOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapRuneOption(t func(ByteListOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapFloat32Option(t func(ByteListOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapFloat64Option(t func(ByteListOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapAnyOption(t func(ByteListOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapBoolListOption(t func(ByteListOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapStringListOption(t func(ByteListOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapIntListOption(t func(ByteListOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapInt64ListOption(t func(ByteListOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapByteListOption(t func(ByteListOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapRuneListOption(t func(ByteListOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapFloat32ListOption(t func(ByteListOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapFloat64ListOption(t func(ByteListOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapAnyListOption(t func(ByteListOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapBoolArrayOption(t func(ByteListOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapStringArrayOption(t func(ByteListOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapIntArrayOption(t func(ByteListOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapInt64ArrayOption(t func(ByteListOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapByteArrayOption(t func(ByteListOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapRuneArrayOption(t func(ByteListOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapFloat32ArrayOption(t func(ByteListOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapFloat64ArrayOption(t func(ByteListOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapAnyArrayOption(t func(ByteListOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapBoolList(t func(ByteListOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapStringList(t func(ByteListOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapIntList(t func(ByteListOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapInt64List(t func(ByteListOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapByteList(t func(ByteListOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapRuneList(t func(ByteListOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapFloat32List(t func(ByteListOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapFloat64List(t func(ByteListOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapAnyList(t func(ByteListOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapBoolArray(t func(ByteListOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapStringArray(t func(ByteListOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapIntArray(t func(ByteListOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapInt64Array(t func(ByteListOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapByteArray(t func(ByteListOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapRuneArray(t func(ByteListOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapFloat32Array(t func(ByteListOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapFloat64Array(t func(ByteListOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f ByteListOptionFuture) FlatMapAnyArray(t func(ByteListOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapBool(t func(RuneListOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapString(t func(RuneListOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapInt(t func(RuneListOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapInt64(t func(RuneListOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapByte(t func(RuneListOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapRune(t func(RuneListOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapFloat32(t func(RuneListOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapFloat64(t func(RuneListOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapAny(t func(RuneListOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapBoolOption(t func(RuneListOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapStringOption(t func(RuneListOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapIntOption(t func(RuneListOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapInt64Option(t func(RuneListOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapByteOption(t func(RuneListOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapRuneOption(t func(RuneListOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapFloat32Option(t func(RuneListOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapFloat64Option(t func(RuneListOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapAnyOption(t func(RuneListOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapBoolListOption(t func(RuneListOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapStringListOption(t func(RuneListOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapIntListOption(t func(RuneListOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapInt64ListOption(t func(RuneListOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapByteListOption(t func(RuneListOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapRuneListOption(t func(RuneListOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapFloat32ListOption(t func(RuneListOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapFloat64ListOption(t func(RuneListOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapAnyListOption(t func(RuneListOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapBoolArrayOption(t func(RuneListOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapStringArrayOption(t func(RuneListOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapIntArrayOption(t func(RuneListOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapInt64ArrayOption(t func(RuneListOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapByteArrayOption(t func(RuneListOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapRuneArrayOption(t func(RuneListOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapFloat32ArrayOption(t func(RuneListOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapFloat64ArrayOption(t func(RuneListOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapAnyArrayOption(t func(RuneListOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapBoolList(t func(RuneListOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapStringList(t func(RuneListOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapIntList(t func(RuneListOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapInt64List(t func(RuneListOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapByteList(t func(RuneListOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapRuneList(t func(RuneListOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapFloat32List(t func(RuneListOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapFloat64List(t func(RuneListOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapAnyList(t func(RuneListOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapBoolArray(t func(RuneListOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapStringArray(t func(RuneListOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapIntArray(t func(RuneListOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapInt64Array(t func(RuneListOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapByteArray(t func(RuneListOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapRuneArray(t func(RuneListOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapFloat32Array(t func(RuneListOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapFloat64Array(t func(RuneListOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f RuneListOptionFuture) FlatMapAnyArray(t func(RuneListOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapBool(t func(Float32ListOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapString(t func(Float32ListOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapInt(t func(Float32ListOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapInt64(t func(Float32ListOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapByte(t func(Float32ListOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapRune(t func(Float32ListOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapFloat32(t func(Float32ListOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapFloat64(t func(Float32ListOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapAny(t func(Float32ListOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapBoolOption(t func(Float32ListOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapStringOption(t func(Float32ListOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapIntOption(t func(Float32ListOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapInt64Option(t func(Float32ListOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapByteOption(t func(Float32ListOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapRuneOption(t func(Float32ListOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapFloat32Option(t func(Float32ListOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapFloat64Option(t func(Float32ListOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapAnyOption(t func(Float32ListOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapBoolListOption(t func(Float32ListOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapStringListOption(t func(Float32ListOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapIntListOption(t func(Float32ListOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapInt64ListOption(t func(Float32ListOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapByteListOption(t func(Float32ListOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapRuneListOption(t func(Float32ListOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapFloat32ListOption(t func(Float32ListOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapFloat64ListOption(t func(Float32ListOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapAnyListOption(t func(Float32ListOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapBoolArrayOption(t func(Float32ListOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapStringArrayOption(t func(Float32ListOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapIntArrayOption(t func(Float32ListOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapInt64ArrayOption(t func(Float32ListOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapByteArrayOption(t func(Float32ListOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapRuneArrayOption(t func(Float32ListOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapFloat32ArrayOption(t func(Float32ListOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapFloat64ArrayOption(t func(Float32ListOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapAnyArrayOption(t func(Float32ListOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapBoolList(t func(Float32ListOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapStringList(t func(Float32ListOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapIntList(t func(Float32ListOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapInt64List(t func(Float32ListOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapByteList(t func(Float32ListOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapRuneList(t func(Float32ListOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapFloat32List(t func(Float32ListOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapFloat64List(t func(Float32ListOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapAnyList(t func(Float32ListOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapBoolArray(t func(Float32ListOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapStringArray(t func(Float32ListOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapIntArray(t func(Float32ListOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapInt64Array(t func(Float32ListOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapByteArray(t func(Float32ListOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapRuneArray(t func(Float32ListOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapFloat32Array(t func(Float32ListOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapFloat64Array(t func(Float32ListOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Float32ListOptionFuture) FlatMapAnyArray(t func(Float32ListOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapBool(t func(Float64ListOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapString(t func(Float64ListOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapInt(t func(Float64ListOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapInt64(t func(Float64ListOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapByte(t func(Float64ListOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapRune(t func(Float64ListOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapFloat32(t func(Float64ListOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapFloat64(t func(Float64ListOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapAny(t func(Float64ListOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapBoolOption(t func(Float64ListOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapStringOption(t func(Float64ListOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapIntOption(t func(Float64ListOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapInt64Option(t func(Float64ListOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapByteOption(t func(Float64ListOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapRuneOption(t func(Float64ListOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapFloat32Option(t func(Float64ListOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapFloat64Option(t func(Float64ListOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapAnyOption(t func(Float64ListOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapBoolListOption(t func(Float64ListOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapStringListOption(t func(Float64ListOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapIntListOption(t func(Float64ListOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapInt64ListOption(t func(Float64ListOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapByteListOption(t func(Float64ListOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapRuneListOption(t func(Float64ListOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapFloat32ListOption(t func(Float64ListOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapFloat64ListOption(t func(Float64ListOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapAnyListOption(t func(Float64ListOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapBoolArrayOption(t func(Float64ListOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapStringArrayOption(t func(Float64ListOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapIntArrayOption(t func(Float64ListOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapInt64ArrayOption(t func(Float64ListOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapByteArrayOption(t func(Float64ListOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapRuneArrayOption(t func(Float64ListOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapFloat32ArrayOption(t func(Float64ListOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapFloat64ArrayOption(t func(Float64ListOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapAnyArrayOption(t func(Float64ListOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapBoolList(t func(Float64ListOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapStringList(t func(Float64ListOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapIntList(t func(Float64ListOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapInt64List(t func(Float64ListOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapByteList(t func(Float64ListOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapRuneList(t func(Float64ListOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapFloat32List(t func(Float64ListOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapFloat64List(t func(Float64ListOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapAnyList(t func(Float64ListOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapBoolArray(t func(Float64ListOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapStringArray(t func(Float64ListOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapIntArray(t func(Float64ListOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapInt64Array(t func(Float64ListOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapByteArray(t func(Float64ListOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapRuneArray(t func(Float64ListOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapFloat32Array(t func(Float64ListOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapFloat64Array(t func(Float64ListOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Float64ListOptionFuture) FlatMapAnyArray(t func(Float64ListOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapBool(t func(AnyListOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapString(t func(AnyListOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapInt(t func(AnyListOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapInt64(t func(AnyListOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapByte(t func(AnyListOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapRune(t func(AnyListOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapFloat32(t func(AnyListOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapFloat64(t func(AnyListOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapAny(t func(AnyListOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapBoolOption(t func(AnyListOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapStringOption(t func(AnyListOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapIntOption(t func(AnyListOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapInt64Option(t func(AnyListOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapByteOption(t func(AnyListOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapRuneOption(t func(AnyListOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapFloat32Option(t func(AnyListOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapFloat64Option(t func(AnyListOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapAnyOption(t func(AnyListOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapBoolListOption(t func(AnyListOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapStringListOption(t func(AnyListOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapIntListOption(t func(AnyListOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapInt64ListOption(t func(AnyListOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapByteListOption(t func(AnyListOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapRuneListOption(t func(AnyListOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapFloat32ListOption(t func(AnyListOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapFloat64ListOption(t func(AnyListOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapAnyListOption(t func(AnyListOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapBoolArrayOption(t func(AnyListOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapStringArrayOption(t func(AnyListOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapIntArrayOption(t func(AnyListOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapInt64ArrayOption(t func(AnyListOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapByteArrayOption(t func(AnyListOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapRuneArrayOption(t func(AnyListOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapFloat32ArrayOption(t func(AnyListOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapFloat64ArrayOption(t func(AnyListOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapAnyArrayOption(t func(AnyListOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapBoolList(t func(AnyListOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapStringList(t func(AnyListOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapIntList(t func(AnyListOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapInt64List(t func(AnyListOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapByteList(t func(AnyListOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapRuneList(t func(AnyListOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapFloat32List(t func(AnyListOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapFloat64List(t func(AnyListOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapAnyList(t func(AnyListOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapBoolArray(t func(AnyListOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapStringArray(t func(AnyListOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapIntArray(t func(AnyListOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapInt64Array(t func(AnyListOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapByteArray(t func(AnyListOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapRuneArray(t func(AnyListOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapFloat32Array(t func(AnyListOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapFloat64Array(t func(AnyListOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f AnyListOptionFuture) FlatMapAnyArray(t func(AnyListOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapBool(t func(BoolArrayOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapString(t func(BoolArrayOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapInt(t func(BoolArrayOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapInt64(t func(BoolArrayOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapByte(t func(BoolArrayOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapRune(t func(BoolArrayOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapFloat32(t func(BoolArrayOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapFloat64(t func(BoolArrayOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapAny(t func(BoolArrayOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapBoolOption(t func(BoolArrayOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapStringOption(t func(BoolArrayOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapIntOption(t func(BoolArrayOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapInt64Option(t func(BoolArrayOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapByteOption(t func(BoolArrayOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapRuneOption(t func(BoolArrayOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapFloat32Option(t func(BoolArrayOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapFloat64Option(t func(BoolArrayOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapAnyOption(t func(BoolArrayOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapBoolListOption(t func(BoolArrayOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapStringListOption(t func(BoolArrayOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapIntListOption(t func(BoolArrayOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapInt64ListOption(t func(BoolArrayOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapByteListOption(t func(BoolArrayOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapRuneListOption(t func(BoolArrayOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapFloat32ListOption(t func(BoolArrayOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapFloat64ListOption(t func(BoolArrayOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapAnyListOption(t func(BoolArrayOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapBoolArrayOption(t func(BoolArrayOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapStringArrayOption(t func(BoolArrayOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapIntArrayOption(t func(BoolArrayOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapInt64ArrayOption(t func(BoolArrayOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapByteArrayOption(t func(BoolArrayOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapRuneArrayOption(t func(BoolArrayOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapFloat32ArrayOption(t func(BoolArrayOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapFloat64ArrayOption(t func(BoolArrayOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapAnyArrayOption(t func(BoolArrayOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapBoolList(t func(BoolArrayOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapStringList(t func(BoolArrayOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapIntList(t func(BoolArrayOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapInt64List(t func(BoolArrayOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapByteList(t func(BoolArrayOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapRuneList(t func(BoolArrayOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapFloat32List(t func(BoolArrayOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapFloat64List(t func(BoolArrayOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapAnyList(t func(BoolArrayOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapBoolArray(t func(BoolArrayOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapStringArray(t func(BoolArrayOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapIntArray(t func(BoolArrayOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapInt64Array(t func(BoolArrayOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapByteArray(t func(BoolArrayOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapRuneArray(t func(BoolArrayOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapFloat32Array(t func(BoolArrayOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapFloat64Array(t func(BoolArrayOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f BoolArrayOptionFuture) FlatMapAnyArray(t func(BoolArrayOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapBool(t func(StringArrayOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapString(t func(StringArrayOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapInt(t func(StringArrayOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapInt64(t func(StringArrayOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapByte(t func(StringArrayOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapRune(t func(StringArrayOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapFloat32(t func(StringArrayOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapFloat64(t func(StringArrayOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapAny(t func(StringArrayOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapBoolOption(t func(StringArrayOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapStringOption(t func(StringArrayOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapIntOption(t func(StringArrayOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapInt64Option(t func(StringArrayOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapByteOption(t func(StringArrayOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapRuneOption(t func(StringArrayOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapFloat32Option(t func(StringArrayOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapFloat64Option(t func(StringArrayOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapAnyOption(t func(StringArrayOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapBoolListOption(t func(StringArrayOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapStringListOption(t func(StringArrayOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapIntListOption(t func(StringArrayOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapInt64ListOption(t func(StringArrayOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapByteListOption(t func(StringArrayOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapRuneListOption(t func(StringArrayOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapFloat32ListOption(t func(StringArrayOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapFloat64ListOption(t func(StringArrayOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapAnyListOption(t func(StringArrayOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapBoolArrayOption(t func(StringArrayOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapStringArrayOption(t func(StringArrayOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapIntArrayOption(t func(StringArrayOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapInt64ArrayOption(t func(StringArrayOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapByteArrayOption(t func(StringArrayOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapRuneArrayOption(t func(StringArrayOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapFloat32ArrayOption(t func(StringArrayOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapFloat64ArrayOption(t func(StringArrayOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapAnyArrayOption(t func(StringArrayOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapBoolList(t func(StringArrayOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapStringList(t func(StringArrayOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapIntList(t func(StringArrayOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapInt64List(t func(StringArrayOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapByteList(t func(StringArrayOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapRuneList(t func(StringArrayOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapFloat32List(t func(StringArrayOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapFloat64List(t func(StringArrayOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapAnyList(t func(StringArrayOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapBoolArray(t func(StringArrayOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapStringArray(t func(StringArrayOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapIntArray(t func(StringArrayOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapInt64Array(t func(StringArrayOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapByteArray(t func(StringArrayOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapRuneArray(t func(StringArrayOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapFloat32Array(t func(StringArrayOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapFloat64Array(t func(StringArrayOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f StringArrayOptionFuture) FlatMapAnyArray(t func(StringArrayOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapBool(t func(IntArrayOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapString(t func(IntArrayOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapInt(t func(IntArrayOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapInt64(t func(IntArrayOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapByte(t func(IntArrayOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapRune(t func(IntArrayOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapFloat32(t func(IntArrayOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapFloat64(t func(IntArrayOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapAny(t func(IntArrayOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapBoolOption(t func(IntArrayOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapStringOption(t func(IntArrayOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapIntOption(t func(IntArrayOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapInt64Option(t func(IntArrayOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapByteOption(t func(IntArrayOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapRuneOption(t func(IntArrayOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapFloat32Option(t func(IntArrayOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapFloat64Option(t func(IntArrayOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapAnyOption(t func(IntArrayOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapBoolListOption(t func(IntArrayOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapStringListOption(t func(IntArrayOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapIntListOption(t func(IntArrayOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapInt64ListOption(t func(IntArrayOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapByteListOption(t func(IntArrayOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapRuneListOption(t func(IntArrayOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapFloat32ListOption(t func(IntArrayOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapFloat64ListOption(t func(IntArrayOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapAnyListOption(t func(IntArrayOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapBoolArrayOption(t func(IntArrayOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapStringArrayOption(t func(IntArrayOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapIntArrayOption(t func(IntArrayOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapInt64ArrayOption(t func(IntArrayOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapByteArrayOption(t func(IntArrayOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapRuneArrayOption(t func(IntArrayOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapFloat32ArrayOption(t func(IntArrayOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapFloat64ArrayOption(t func(IntArrayOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapAnyArrayOption(t func(IntArrayOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapBoolList(t func(IntArrayOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapStringList(t func(IntArrayOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapIntList(t func(IntArrayOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapInt64List(t func(IntArrayOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapByteList(t func(IntArrayOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapRuneList(t func(IntArrayOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapFloat32List(t func(IntArrayOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapFloat64List(t func(IntArrayOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapAnyList(t func(IntArrayOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapBoolArray(t func(IntArrayOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapStringArray(t func(IntArrayOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapIntArray(t func(IntArrayOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapInt64Array(t func(IntArrayOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapByteArray(t func(IntArrayOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapRuneArray(t func(IntArrayOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapFloat32Array(t func(IntArrayOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapFloat64Array(t func(IntArrayOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f IntArrayOptionFuture) FlatMapAnyArray(t func(IntArrayOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapBool(t func(Int64ArrayOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapString(t func(Int64ArrayOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapInt(t func(Int64ArrayOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapInt64(t func(Int64ArrayOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapByte(t func(Int64ArrayOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapRune(t func(Int64ArrayOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapFloat32(t func(Int64ArrayOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapFloat64(t func(Int64ArrayOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapAny(t func(Int64ArrayOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapBoolOption(t func(Int64ArrayOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapStringOption(t func(Int64ArrayOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapIntOption(t func(Int64ArrayOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapInt64Option(t func(Int64ArrayOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapByteOption(t func(Int64ArrayOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapRuneOption(t func(Int64ArrayOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapFloat32Option(t func(Int64ArrayOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapFloat64Option(t func(Int64ArrayOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapAnyOption(t func(Int64ArrayOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapBoolListOption(t func(Int64ArrayOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapStringListOption(t func(Int64ArrayOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapIntListOption(t func(Int64ArrayOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapInt64ListOption(t func(Int64ArrayOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapByteListOption(t func(Int64ArrayOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapRuneListOption(t func(Int64ArrayOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapFloat32ListOption(t func(Int64ArrayOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapFloat64ListOption(t func(Int64ArrayOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapAnyListOption(t func(Int64ArrayOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapBoolArrayOption(t func(Int64ArrayOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapStringArrayOption(t func(Int64ArrayOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapIntArrayOption(t func(Int64ArrayOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapInt64ArrayOption(t func(Int64ArrayOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapByteArrayOption(t func(Int64ArrayOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapRuneArrayOption(t func(Int64ArrayOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapFloat32ArrayOption(t func(Int64ArrayOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapFloat64ArrayOption(t func(Int64ArrayOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapAnyArrayOption(t func(Int64ArrayOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapBoolList(t func(Int64ArrayOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapStringList(t func(Int64ArrayOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapIntList(t func(Int64ArrayOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapInt64List(t func(Int64ArrayOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapByteList(t func(Int64ArrayOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapRuneList(t func(Int64ArrayOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapFloat32List(t func(Int64ArrayOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapFloat64List(t func(Int64ArrayOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapAnyList(t func(Int64ArrayOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapBoolArray(t func(Int64ArrayOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapStringArray(t func(Int64ArrayOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapIntArray(t func(Int64ArrayOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapInt64Array(t func(Int64ArrayOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapByteArray(t func(Int64ArrayOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapRuneArray(t func(Int64ArrayOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapFloat32Array(t func(Int64ArrayOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapFloat64Array(t func(Int64ArrayOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Int64ArrayOptionFuture) FlatMapAnyArray(t func(Int64ArrayOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapBool(t func(ByteArrayOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapString(t func(ByteArrayOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapInt(t func(ByteArrayOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapInt64(t func(ByteArrayOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapByte(t func(ByteArrayOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapRune(t func(ByteArrayOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapFloat32(t func(ByteArrayOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapFloat64(t func(ByteArrayOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapAny(t func(ByteArrayOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapBoolOption(t func(ByteArrayOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapStringOption(t func(ByteArrayOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapIntOption(t func(ByteArrayOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapInt64Option(t func(ByteArrayOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapByteOption(t func(ByteArrayOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapRuneOption(t func(ByteArrayOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapFloat32Option(t func(ByteArrayOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapFloat64Option(t func(ByteArrayOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapAnyOption(t func(ByteArrayOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapBoolListOption(t func(ByteArrayOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapStringListOption(t func(ByteArrayOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapIntListOption(t func(ByteArrayOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapInt64ListOption(t func(ByteArrayOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapByteListOption(t func(ByteArrayOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapRuneListOption(t func(ByteArrayOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapFloat32ListOption(t func(ByteArrayOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapFloat64ListOption(t func(ByteArrayOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapAnyListOption(t func(ByteArrayOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapBoolArrayOption(t func(ByteArrayOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapStringArrayOption(t func(ByteArrayOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapIntArrayOption(t func(ByteArrayOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapInt64ArrayOption(t func(ByteArrayOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapByteArrayOption(t func(ByteArrayOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapRuneArrayOption(t func(ByteArrayOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapFloat32ArrayOption(t func(ByteArrayOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapFloat64ArrayOption(t func(ByteArrayOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapAnyArrayOption(t func(ByteArrayOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapBoolList(t func(ByteArrayOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapStringList(t func(ByteArrayOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapIntList(t func(ByteArrayOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapInt64List(t func(ByteArrayOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapByteList(t func(ByteArrayOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapRuneList(t func(ByteArrayOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapFloat32List(t func(ByteArrayOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapFloat64List(t func(ByteArrayOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapAnyList(t func(ByteArrayOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapBoolArray(t func(ByteArrayOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapStringArray(t func(ByteArrayOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapIntArray(t func(ByteArrayOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapInt64Array(t func(ByteArrayOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapByteArray(t func(ByteArrayOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapRuneArray(t func(ByteArrayOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapFloat32Array(t func(ByteArrayOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapFloat64Array(t func(ByteArrayOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f ByteArrayOptionFuture) FlatMapAnyArray(t func(ByteArrayOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapBool(t func(RuneArrayOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapString(t func(RuneArrayOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapInt(t func(RuneArrayOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapInt64(t func(RuneArrayOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapByte(t func(RuneArrayOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapRune(t func(RuneArrayOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapFloat32(t func(RuneArrayOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapFloat64(t func(RuneArrayOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapAny(t func(RuneArrayOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapBoolOption(t func(RuneArrayOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapStringOption(t func(RuneArrayOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapIntOption(t func(RuneArrayOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapInt64Option(t func(RuneArrayOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapByteOption(t func(RuneArrayOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapRuneOption(t func(RuneArrayOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapFloat32Option(t func(RuneArrayOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapFloat64Option(t func(RuneArrayOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapAnyOption(t func(RuneArrayOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapBoolListOption(t func(RuneArrayOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapStringListOption(t func(RuneArrayOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapIntListOption(t func(RuneArrayOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapInt64ListOption(t func(RuneArrayOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapByteListOption(t func(RuneArrayOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapRuneListOption(t func(RuneArrayOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapFloat32ListOption(t func(RuneArrayOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapFloat64ListOption(t func(RuneArrayOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapAnyListOption(t func(RuneArrayOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapBoolArrayOption(t func(RuneArrayOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapStringArrayOption(t func(RuneArrayOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapIntArrayOption(t func(RuneArrayOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapInt64ArrayOption(t func(RuneArrayOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapByteArrayOption(t func(RuneArrayOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapRuneArrayOption(t func(RuneArrayOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapFloat32ArrayOption(t func(RuneArrayOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapFloat64ArrayOption(t func(RuneArrayOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapAnyArrayOption(t func(RuneArrayOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapBoolList(t func(RuneArrayOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapStringList(t func(RuneArrayOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapIntList(t func(RuneArrayOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapInt64List(t func(RuneArrayOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapByteList(t func(RuneArrayOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapRuneList(t func(RuneArrayOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapFloat32List(t func(RuneArrayOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapFloat64List(t func(RuneArrayOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapAnyList(t func(RuneArrayOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapBoolArray(t func(RuneArrayOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapStringArray(t func(RuneArrayOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapIntArray(t func(RuneArrayOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapInt64Array(t func(RuneArrayOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapByteArray(t func(RuneArrayOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapRuneArray(t func(RuneArrayOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapFloat32Array(t func(RuneArrayOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapFloat64Array(t func(RuneArrayOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f RuneArrayOptionFuture) FlatMapAnyArray(t func(RuneArrayOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapBool(t func(Float32ArrayOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapString(t func(Float32ArrayOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapInt(t func(Float32ArrayOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapInt64(t func(Float32ArrayOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapByte(t func(Float32ArrayOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapRune(t func(Float32ArrayOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapFloat32(t func(Float32ArrayOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapFloat64(t func(Float32ArrayOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapAny(t func(Float32ArrayOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapBoolOption(t func(Float32ArrayOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapStringOption(t func(Float32ArrayOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapIntOption(t func(Float32ArrayOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapInt64Option(t func(Float32ArrayOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapByteOption(t func(Float32ArrayOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapRuneOption(t func(Float32ArrayOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapFloat32Option(t func(Float32ArrayOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapFloat64Option(t func(Float32ArrayOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapAnyOption(t func(Float32ArrayOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapBoolListOption(t func(Float32ArrayOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapStringListOption(t func(Float32ArrayOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapIntListOption(t func(Float32ArrayOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapInt64ListOption(t func(Float32ArrayOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapByteListOption(t func(Float32ArrayOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapRuneListOption(t func(Float32ArrayOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapFloat32ListOption(t func(Float32ArrayOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapFloat64ListOption(t func(Float32ArrayOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapAnyListOption(t func(Float32ArrayOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapBoolArrayOption(t func(Float32ArrayOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapStringArrayOption(t func(Float32ArrayOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapIntArrayOption(t func(Float32ArrayOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapInt64ArrayOption(t func(Float32ArrayOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapByteArrayOption(t func(Float32ArrayOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapRuneArrayOption(t func(Float32ArrayOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapFloat32ArrayOption(t func(Float32ArrayOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapFloat64ArrayOption(t func(Float32ArrayOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapAnyArrayOption(t func(Float32ArrayOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapBoolList(t func(Float32ArrayOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapStringList(t func(Float32ArrayOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapIntList(t func(Float32ArrayOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapInt64List(t func(Float32ArrayOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapByteList(t func(Float32ArrayOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapRuneList(t func(Float32ArrayOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapFloat32List(t func(Float32ArrayOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapFloat64List(t func(Float32ArrayOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapAnyList(t func(Float32ArrayOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapBoolArray(t func(Float32ArrayOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapStringArray(t func(Float32ArrayOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapIntArray(t func(Float32ArrayOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapInt64Array(t func(Float32ArrayOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapByteArray(t func(Float32ArrayOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapRuneArray(t func(Float32ArrayOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapFloat32Array(t func(Float32ArrayOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapFloat64Array(t func(Float32ArrayOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Float32ArrayOptionFuture) FlatMapAnyArray(t func(Float32ArrayOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapBool(t func(Float64ArrayOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapString(t func(Float64ArrayOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapInt(t func(Float64ArrayOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapInt64(t func(Float64ArrayOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapByte(t func(Float64ArrayOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapRune(t func(Float64ArrayOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapFloat32(t func(Float64ArrayOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapFloat64(t func(Float64ArrayOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapAny(t func(Float64ArrayOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapBoolOption(t func(Float64ArrayOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapStringOption(t func(Float64ArrayOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapIntOption(t func(Float64ArrayOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapInt64Option(t func(Float64ArrayOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapByteOption(t func(Float64ArrayOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapRuneOption(t func(Float64ArrayOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapFloat32Option(t func(Float64ArrayOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapFloat64Option(t func(Float64ArrayOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapAnyOption(t func(Float64ArrayOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapBoolListOption(t func(Float64ArrayOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapStringListOption(t func(Float64ArrayOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapIntListOption(t func(Float64ArrayOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapInt64ListOption(t func(Float64ArrayOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapByteListOption(t func(Float64ArrayOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapRuneListOption(t func(Float64ArrayOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapFloat32ListOption(t func(Float64ArrayOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapFloat64ListOption(t func(Float64ArrayOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapAnyListOption(t func(Float64ArrayOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapBoolArrayOption(t func(Float64ArrayOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapStringArrayOption(t func(Float64ArrayOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapIntArrayOption(t func(Float64ArrayOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapInt64ArrayOption(t func(Float64ArrayOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapByteArrayOption(t func(Float64ArrayOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapRuneArrayOption(t func(Float64ArrayOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapFloat32ArrayOption(t func(Float64ArrayOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapFloat64ArrayOption(t func(Float64ArrayOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapAnyArrayOption(t func(Float64ArrayOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapBoolList(t func(Float64ArrayOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapStringList(t func(Float64ArrayOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapIntList(t func(Float64ArrayOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapInt64List(t func(Float64ArrayOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapByteList(t func(Float64ArrayOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapRuneList(t func(Float64ArrayOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapFloat32List(t func(Float64ArrayOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapFloat64List(t func(Float64ArrayOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapAnyList(t func(Float64ArrayOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapBoolArray(t func(Float64ArrayOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapStringArray(t func(Float64ArrayOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapIntArray(t func(Float64ArrayOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapInt64Array(t func(Float64ArrayOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapByteArray(t func(Float64ArrayOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapRuneArray(t func(Float64ArrayOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapFloat32Array(t func(Float64ArrayOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapFloat64Array(t func(Float64ArrayOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Float64ArrayOptionFuture) FlatMapAnyArray(t func(Float64ArrayOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapBool(t func(AnyArrayOption) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapString(t func(AnyArrayOption) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapInt(t func(AnyArrayOption) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapInt64(t func(AnyArrayOption) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapByte(t func(AnyArrayOption) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapRune(t func(AnyArrayOption) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapFloat32(t func(AnyArrayOption) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapFloat64(t func(AnyArrayOption) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapAny(t func(AnyArrayOption) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapBoolOption(t func(AnyArrayOption) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapStringOption(t func(AnyArrayOption) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapIntOption(t func(AnyArrayOption) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapInt64Option(t func(AnyArrayOption) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapByteOption(t func(AnyArrayOption) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapRuneOption(t func(AnyArrayOption) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapFloat32Option(t func(AnyArrayOption) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapFloat64Option(t func(AnyArrayOption) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapAnyOption(t func(AnyArrayOption) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapBoolListOption(t func(AnyArrayOption) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapStringListOption(t func(AnyArrayOption) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapIntListOption(t func(AnyArrayOption) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapInt64ListOption(t func(AnyArrayOption) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapByteListOption(t func(AnyArrayOption) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapRuneListOption(t func(AnyArrayOption) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapFloat32ListOption(t func(AnyArrayOption) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapFloat64ListOption(t func(AnyArrayOption) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapAnyListOption(t func(AnyArrayOption) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapBoolArrayOption(t func(AnyArrayOption) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapStringArrayOption(t func(AnyArrayOption) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapIntArrayOption(t func(AnyArrayOption) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapInt64ArrayOption(t func(AnyArrayOption) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapByteArrayOption(t func(AnyArrayOption) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapRuneArrayOption(t func(AnyArrayOption) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapFloat32ArrayOption(t func(AnyArrayOption) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapFloat64ArrayOption(t func(AnyArrayOption) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapAnyArrayOption(t func(AnyArrayOption) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapBoolList(t func(AnyArrayOption) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapStringList(t func(AnyArrayOption) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapIntList(t func(AnyArrayOption) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapInt64List(t func(AnyArrayOption) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapByteList(t func(AnyArrayOption) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapRuneList(t func(AnyArrayOption) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapFloat32List(t func(AnyArrayOption) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapFloat64List(t func(AnyArrayOption) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapAnyList(t func(AnyArrayOption) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapBoolArray(t func(AnyArrayOption) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapStringArray(t func(AnyArrayOption) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapIntArray(t func(AnyArrayOption) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapInt64Array(t func(AnyArrayOption) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapByteArray(t func(AnyArrayOption) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapRuneArray(t func(AnyArrayOption) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapFloat32Array(t func(AnyArrayOption) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapFloat64Array(t func(AnyArrayOption) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f AnyArrayOptionFuture) FlatMapAnyArray(t func(AnyArrayOption) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapBool(t func(BoolList) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapString(t func(BoolList) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapInt(t func(BoolList) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapInt64(t func(BoolList) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapByte(t func(BoolList) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapRune(t func(BoolList) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapFloat32(t func(BoolList) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapFloat64(t func(BoolList) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapAny(t func(BoolList) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapBoolOption(t func(BoolList) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapStringOption(t func(BoolList) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapIntOption(t func(BoolList) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapInt64Option(t func(BoolList) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapByteOption(t func(BoolList) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapRuneOption(t func(BoolList) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapFloat32Option(t func(BoolList) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapFloat64Option(t func(BoolList) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapAnyOption(t func(BoolList) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapBoolListOption(t func(BoolList) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapStringListOption(t func(BoolList) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapIntListOption(t func(BoolList) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapInt64ListOption(t func(BoolList) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapByteListOption(t func(BoolList) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapRuneListOption(t func(BoolList) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapFloat32ListOption(t func(BoolList) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapFloat64ListOption(t func(BoolList) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapAnyListOption(t func(BoolList) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapBoolArrayOption(t func(BoolList) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapStringArrayOption(t func(BoolList) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapIntArrayOption(t func(BoolList) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapInt64ArrayOption(t func(BoolList) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapByteArrayOption(t func(BoolList) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapRuneArrayOption(t func(BoolList) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapFloat32ArrayOption(t func(BoolList) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapFloat64ArrayOption(t func(BoolList) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapAnyArrayOption(t func(BoolList) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapBoolList(t func(BoolList) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapStringList(t func(BoolList) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapIntList(t func(BoolList) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapInt64List(t func(BoolList) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapByteList(t func(BoolList) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapRuneList(t func(BoolList) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapFloat32List(t func(BoolList) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapFloat64List(t func(BoolList) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapAnyList(t func(BoolList) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapBoolArray(t func(BoolList) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapStringArray(t func(BoolList) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapIntArray(t func(BoolList) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapInt64Array(t func(BoolList) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapByteArray(t func(BoolList) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapRuneArray(t func(BoolList) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapFloat32Array(t func(BoolList) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapFloat64Array(t func(BoolList) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f BoolListFuture) FlatMapAnyArray(t func(BoolList) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapBool(t func(StringList) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapString(t func(StringList) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapInt(t func(StringList) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapInt64(t func(StringList) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapByte(t func(StringList) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapRune(t func(StringList) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapFloat32(t func(StringList) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapFloat64(t func(StringList) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapAny(t func(StringList) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapBoolOption(t func(StringList) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapStringOption(t func(StringList) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapIntOption(t func(StringList) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapInt64Option(t func(StringList) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapByteOption(t func(StringList) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapRuneOption(t func(StringList) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapFloat32Option(t func(StringList) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapFloat64Option(t func(StringList) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapAnyOption(t func(StringList) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapBoolListOption(t func(StringList) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapStringListOption(t func(StringList) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapIntListOption(t func(StringList) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapInt64ListOption(t func(StringList) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapByteListOption(t func(StringList) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapRuneListOption(t func(StringList) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapFloat32ListOption(t func(StringList) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapFloat64ListOption(t func(StringList) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapAnyListOption(t func(StringList) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapBoolArrayOption(t func(StringList) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapStringArrayOption(t func(StringList) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapIntArrayOption(t func(StringList) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapInt64ArrayOption(t func(StringList) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapByteArrayOption(t func(StringList) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapRuneArrayOption(t func(StringList) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapFloat32ArrayOption(t func(StringList) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapFloat64ArrayOption(t func(StringList) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapAnyArrayOption(t func(StringList) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapBoolList(t func(StringList) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapStringList(t func(StringList) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapIntList(t func(StringList) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapInt64List(t func(StringList) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapByteList(t func(StringList) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapRuneList(t func(StringList) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapFloat32List(t func(StringList) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapFloat64List(t func(StringList) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapAnyList(t func(StringList) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapBoolArray(t func(StringList) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapStringArray(t func(StringList) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapIntArray(t func(StringList) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapInt64Array(t func(StringList) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapByteArray(t func(StringList) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapRuneArray(t func(StringList) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapFloat32Array(t func(StringList) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapFloat64Array(t func(StringList) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f StringListFuture) FlatMapAnyArray(t func(StringList) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapBool(t func(IntList) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapString(t func(IntList) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapInt(t func(IntList) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapInt64(t func(IntList) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapByte(t func(IntList) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapRune(t func(IntList) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapFloat32(t func(IntList) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapFloat64(t func(IntList) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapAny(t func(IntList) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapBoolOption(t func(IntList) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapStringOption(t func(IntList) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapIntOption(t func(IntList) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapInt64Option(t func(IntList) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapByteOption(t func(IntList) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapRuneOption(t func(IntList) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapFloat32Option(t func(IntList) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapFloat64Option(t func(IntList) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapAnyOption(t func(IntList) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapBoolListOption(t func(IntList) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapStringListOption(t func(IntList) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapIntListOption(t func(IntList) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapInt64ListOption(t func(IntList) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapByteListOption(t func(IntList) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapRuneListOption(t func(IntList) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapFloat32ListOption(t func(IntList) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapFloat64ListOption(t func(IntList) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapAnyListOption(t func(IntList) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapBoolArrayOption(t func(IntList) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapStringArrayOption(t func(IntList) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapIntArrayOption(t func(IntList) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapInt64ArrayOption(t func(IntList) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapByteArrayOption(t func(IntList) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapRuneArrayOption(t func(IntList) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapFloat32ArrayOption(t func(IntList) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapFloat64ArrayOption(t func(IntList) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapAnyArrayOption(t func(IntList) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapBoolList(t func(IntList) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapStringList(t func(IntList) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapIntList(t func(IntList) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapInt64List(t func(IntList) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapByteList(t func(IntList) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapRuneList(t func(IntList) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapFloat32List(t func(IntList) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapFloat64List(t func(IntList) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapAnyList(t func(IntList) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapBoolArray(t func(IntList) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapStringArray(t func(IntList) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapIntArray(t func(IntList) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapInt64Array(t func(IntList) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapByteArray(t func(IntList) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapRuneArray(t func(IntList) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapFloat32Array(t func(IntList) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapFloat64Array(t func(IntList) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f IntListFuture) FlatMapAnyArray(t func(IntList) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapBool(t func(Int64List) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapString(t func(Int64List) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapInt(t func(Int64List) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapInt64(t func(Int64List) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapByte(t func(Int64List) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapRune(t func(Int64List) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapFloat32(t func(Int64List) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapFloat64(t func(Int64List) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapAny(t func(Int64List) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapBoolOption(t func(Int64List) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapStringOption(t func(Int64List) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapIntOption(t func(Int64List) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapInt64Option(t func(Int64List) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapByteOption(t func(Int64List) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapRuneOption(t func(Int64List) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapFloat32Option(t func(Int64List) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapFloat64Option(t func(Int64List) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapAnyOption(t func(Int64List) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapBoolListOption(t func(Int64List) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapStringListOption(t func(Int64List) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapIntListOption(t func(Int64List) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapInt64ListOption(t func(Int64List) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapByteListOption(t func(Int64List) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapRuneListOption(t func(Int64List) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapFloat32ListOption(t func(Int64List) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapFloat64ListOption(t func(Int64List) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapAnyListOption(t func(Int64List) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapBoolArrayOption(t func(Int64List) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapStringArrayOption(t func(Int64List) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapIntArrayOption(t func(Int64List) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapInt64ArrayOption(t func(Int64List) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapByteArrayOption(t func(Int64List) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapRuneArrayOption(t func(Int64List) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapFloat32ArrayOption(t func(Int64List) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapFloat64ArrayOption(t func(Int64List) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapAnyArrayOption(t func(Int64List) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapBoolList(t func(Int64List) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapStringList(t func(Int64List) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapIntList(t func(Int64List) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapInt64List(t func(Int64List) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapByteList(t func(Int64List) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapRuneList(t func(Int64List) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapFloat32List(t func(Int64List) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapFloat64List(t func(Int64List) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapAnyList(t func(Int64List) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapBoolArray(t func(Int64List) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapStringArray(t func(Int64List) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapIntArray(t func(Int64List) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapInt64Array(t func(Int64List) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapByteArray(t func(Int64List) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapRuneArray(t func(Int64List) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapFloat32Array(t func(Int64List) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapFloat64Array(t func(Int64List) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Int64ListFuture) FlatMapAnyArray(t func(Int64List) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapBool(t func(ByteList) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapString(t func(ByteList) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapInt(t func(ByteList) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapInt64(t func(ByteList) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapByte(t func(ByteList) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapRune(t func(ByteList) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapFloat32(t func(ByteList) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapFloat64(t func(ByteList) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapAny(t func(ByteList) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapBoolOption(t func(ByteList) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapStringOption(t func(ByteList) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapIntOption(t func(ByteList) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapInt64Option(t func(ByteList) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapByteOption(t func(ByteList) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapRuneOption(t func(ByteList) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapFloat32Option(t func(ByteList) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapFloat64Option(t func(ByteList) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapAnyOption(t func(ByteList) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapBoolListOption(t func(ByteList) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapStringListOption(t func(ByteList) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapIntListOption(t func(ByteList) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapInt64ListOption(t func(ByteList) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapByteListOption(t func(ByteList) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapRuneListOption(t func(ByteList) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapFloat32ListOption(t func(ByteList) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapFloat64ListOption(t func(ByteList) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapAnyListOption(t func(ByteList) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapBoolArrayOption(t func(ByteList) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapStringArrayOption(t func(ByteList) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapIntArrayOption(t func(ByteList) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapInt64ArrayOption(t func(ByteList) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapByteArrayOption(t func(ByteList) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapRuneArrayOption(t func(ByteList) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapFloat32ArrayOption(t func(ByteList) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapFloat64ArrayOption(t func(ByteList) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapAnyArrayOption(t func(ByteList) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapBoolList(t func(ByteList) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapStringList(t func(ByteList) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapIntList(t func(ByteList) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapInt64List(t func(ByteList) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapByteList(t func(ByteList) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapRuneList(t func(ByteList) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapFloat32List(t func(ByteList) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapFloat64List(t func(ByteList) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapAnyList(t func(ByteList) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapBoolArray(t func(ByteList) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapStringArray(t func(ByteList) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapIntArray(t func(ByteList) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapInt64Array(t func(ByteList) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapByteArray(t func(ByteList) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapRuneArray(t func(ByteList) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapFloat32Array(t func(ByteList) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapFloat64Array(t func(ByteList) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f ByteListFuture) FlatMapAnyArray(t func(ByteList) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapBool(t func(RuneList) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapString(t func(RuneList) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapInt(t func(RuneList) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapInt64(t func(RuneList) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapByte(t func(RuneList) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapRune(t func(RuneList) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapFloat32(t func(RuneList) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapFloat64(t func(RuneList) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapAny(t func(RuneList) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapBoolOption(t func(RuneList) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapStringOption(t func(RuneList) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapIntOption(t func(RuneList) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapInt64Option(t func(RuneList) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapByteOption(t func(RuneList) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapRuneOption(t func(RuneList) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapFloat32Option(t func(RuneList) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapFloat64Option(t func(RuneList) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapAnyOption(t func(RuneList) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapBoolListOption(t func(RuneList) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapStringListOption(t func(RuneList) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapIntListOption(t func(RuneList) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapInt64ListOption(t func(RuneList) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapByteListOption(t func(RuneList) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapRuneListOption(t func(RuneList) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapFloat32ListOption(t func(RuneList) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapFloat64ListOption(t func(RuneList) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapAnyListOption(t func(RuneList) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapBoolArrayOption(t func(RuneList) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapStringArrayOption(t func(RuneList) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapIntArrayOption(t func(RuneList) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapInt64ArrayOption(t func(RuneList) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapByteArrayOption(t func(RuneList) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapRuneArrayOption(t func(RuneList) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapFloat32ArrayOption(t func(RuneList) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapFloat64ArrayOption(t func(RuneList) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapAnyArrayOption(t func(RuneList) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapBoolList(t func(RuneList) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapStringList(t func(RuneList) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapIntList(t func(RuneList) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapInt64List(t func(RuneList) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapByteList(t func(RuneList) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapRuneList(t func(RuneList) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapFloat32List(t func(RuneList) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapFloat64List(t func(RuneList) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapAnyList(t func(RuneList) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapBoolArray(t func(RuneList) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapStringArray(t func(RuneList) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapIntArray(t func(RuneList) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapInt64Array(t func(RuneList) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapByteArray(t func(RuneList) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapRuneArray(t func(RuneList) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapFloat32Array(t func(RuneList) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapFloat64Array(t func(RuneList) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f RuneListFuture) FlatMapAnyArray(t func(RuneList) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapBool(t func(Float32List) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapString(t func(Float32List) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapInt(t func(Float32List) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapInt64(t func(Float32List) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapByte(t func(Float32List) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapRune(t func(Float32List) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapFloat32(t func(Float32List) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapFloat64(t func(Float32List) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapAny(t func(Float32List) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapBoolOption(t func(Float32List) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapStringOption(t func(Float32List) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapIntOption(t func(Float32List) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapInt64Option(t func(Float32List) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapByteOption(t func(Float32List) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapRuneOption(t func(Float32List) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapFloat32Option(t func(Float32List) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapFloat64Option(t func(Float32List) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapAnyOption(t func(Float32List) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapBoolListOption(t func(Float32List) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapStringListOption(t func(Float32List) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapIntListOption(t func(Float32List) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapInt64ListOption(t func(Float32List) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapByteListOption(t func(Float32List) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapRuneListOption(t func(Float32List) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapFloat32ListOption(t func(Float32List) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapFloat64ListOption(t func(Float32List) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapAnyListOption(t func(Float32List) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapBoolArrayOption(t func(Float32List) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapStringArrayOption(t func(Float32List) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapIntArrayOption(t func(Float32List) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapInt64ArrayOption(t func(Float32List) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapByteArrayOption(t func(Float32List) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapRuneArrayOption(t func(Float32List) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapFloat32ArrayOption(t func(Float32List) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapFloat64ArrayOption(t func(Float32List) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapAnyArrayOption(t func(Float32List) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapBoolList(t func(Float32List) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapStringList(t func(Float32List) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapIntList(t func(Float32List) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapInt64List(t func(Float32List) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapByteList(t func(Float32List) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapRuneList(t func(Float32List) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapFloat32List(t func(Float32List) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapFloat64List(t func(Float32List) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapAnyList(t func(Float32List) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapBoolArray(t func(Float32List) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapStringArray(t func(Float32List) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapIntArray(t func(Float32List) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapInt64Array(t func(Float32List) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapByteArray(t func(Float32List) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapRuneArray(t func(Float32List) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapFloat32Array(t func(Float32List) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapFloat64Array(t func(Float32List) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Float32ListFuture) FlatMapAnyArray(t func(Float32List) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapBool(t func(Float64List) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapString(t func(Float64List) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapInt(t func(Float64List) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapInt64(t func(Float64List) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapByte(t func(Float64List) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapRune(t func(Float64List) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapFloat32(t func(Float64List) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapFloat64(t func(Float64List) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapAny(t func(Float64List) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapBoolOption(t func(Float64List) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapStringOption(t func(Float64List) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapIntOption(t func(Float64List) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapInt64Option(t func(Float64List) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapByteOption(t func(Float64List) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapRuneOption(t func(Float64List) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapFloat32Option(t func(Float64List) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapFloat64Option(t func(Float64List) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapAnyOption(t func(Float64List) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapBoolListOption(t func(Float64List) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapStringListOption(t func(Float64List) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapIntListOption(t func(Float64List) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapInt64ListOption(t func(Float64List) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapByteListOption(t func(Float64List) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapRuneListOption(t func(Float64List) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapFloat32ListOption(t func(Float64List) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapFloat64ListOption(t func(Float64List) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapAnyListOption(t func(Float64List) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapBoolArrayOption(t func(Float64List) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapStringArrayOption(t func(Float64List) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapIntArrayOption(t func(Float64List) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapInt64ArrayOption(t func(Float64List) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapByteArrayOption(t func(Float64List) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapRuneArrayOption(t func(Float64List) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapFloat32ArrayOption(t func(Float64List) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapFloat64ArrayOption(t func(Float64List) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapAnyArrayOption(t func(Float64List) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapBoolList(t func(Float64List) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapStringList(t func(Float64List) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapIntList(t func(Float64List) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapInt64List(t func(Float64List) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapByteList(t func(Float64List) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapRuneList(t func(Float64List) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapFloat32List(t func(Float64List) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapFloat64List(t func(Float64List) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapAnyList(t func(Float64List) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapBoolArray(t func(Float64List) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapStringArray(t func(Float64List) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapIntArray(t func(Float64List) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapInt64Array(t func(Float64List) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapByteArray(t func(Float64List) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapRuneArray(t func(Float64List) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapFloat32Array(t func(Float64List) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapFloat64Array(t func(Float64List) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Float64ListFuture) FlatMapAnyArray(t func(Float64List) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapBool(t func(AnyList) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapString(t func(AnyList) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapInt(t func(AnyList) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapInt64(t func(AnyList) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapByte(t func(AnyList) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapRune(t func(AnyList) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapFloat32(t func(AnyList) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapFloat64(t func(AnyList) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapAny(t func(AnyList) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapBoolOption(t func(AnyList) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapStringOption(t func(AnyList) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapIntOption(t func(AnyList) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapInt64Option(t func(AnyList) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapByteOption(t func(AnyList) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapRuneOption(t func(AnyList) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapFloat32Option(t func(AnyList) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapFloat64Option(t func(AnyList) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapAnyOption(t func(AnyList) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapBoolListOption(t func(AnyList) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapStringListOption(t func(AnyList) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapIntListOption(t func(AnyList) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapInt64ListOption(t func(AnyList) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapByteListOption(t func(AnyList) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapRuneListOption(t func(AnyList) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapFloat32ListOption(t func(AnyList) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapFloat64ListOption(t func(AnyList) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapAnyListOption(t func(AnyList) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapBoolArrayOption(t func(AnyList) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapStringArrayOption(t func(AnyList) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapIntArrayOption(t func(AnyList) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapInt64ArrayOption(t func(AnyList) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapByteArrayOption(t func(AnyList) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapRuneArrayOption(t func(AnyList) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapFloat32ArrayOption(t func(AnyList) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapFloat64ArrayOption(t func(AnyList) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapAnyArrayOption(t func(AnyList) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapBoolList(t func(AnyList) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapStringList(t func(AnyList) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapIntList(t func(AnyList) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapInt64List(t func(AnyList) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapByteList(t func(AnyList) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapRuneList(t func(AnyList) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapFloat32List(t func(AnyList) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapFloat64List(t func(AnyList) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapAnyList(t func(AnyList) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapBoolArray(t func(AnyList) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapStringArray(t func(AnyList) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapIntArray(t func(AnyList) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapInt64Array(t func(AnyList) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapByteArray(t func(AnyList) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapRuneArray(t func(AnyList) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapFloat32Array(t func(AnyList) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapFloat64Array(t func(AnyList) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f AnyListFuture) FlatMapAnyArray(t func(AnyList) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapBool(t func(BoolArray) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapString(t func(BoolArray) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapInt(t func(BoolArray) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapInt64(t func(BoolArray) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapByte(t func(BoolArray) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapRune(t func(BoolArray) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapFloat32(t func(BoolArray) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapFloat64(t func(BoolArray) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapAny(t func(BoolArray) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapBoolOption(t func(BoolArray) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapStringOption(t func(BoolArray) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapIntOption(t func(BoolArray) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapInt64Option(t func(BoolArray) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapByteOption(t func(BoolArray) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapRuneOption(t func(BoolArray) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapFloat32Option(t func(BoolArray) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapFloat64Option(t func(BoolArray) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapAnyOption(t func(BoolArray) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapBoolListOption(t func(BoolArray) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapStringListOption(t func(BoolArray) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapIntListOption(t func(BoolArray) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapInt64ListOption(t func(BoolArray) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapByteListOption(t func(BoolArray) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapRuneListOption(t func(BoolArray) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapFloat32ListOption(t func(BoolArray) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapFloat64ListOption(t func(BoolArray) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapAnyListOption(t func(BoolArray) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapBoolArrayOption(t func(BoolArray) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapStringArrayOption(t func(BoolArray) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapIntArrayOption(t func(BoolArray) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapInt64ArrayOption(t func(BoolArray) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapByteArrayOption(t func(BoolArray) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapRuneArrayOption(t func(BoolArray) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapFloat32ArrayOption(t func(BoolArray) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapFloat64ArrayOption(t func(BoolArray) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapAnyArrayOption(t func(BoolArray) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapBoolList(t func(BoolArray) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapStringList(t func(BoolArray) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapIntList(t func(BoolArray) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapInt64List(t func(BoolArray) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapByteList(t func(BoolArray) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapRuneList(t func(BoolArray) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapFloat32List(t func(BoolArray) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapFloat64List(t func(BoolArray) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapAnyList(t func(BoolArray) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapBoolArray(t func(BoolArray) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapStringArray(t func(BoolArray) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapIntArray(t func(BoolArray) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapInt64Array(t func(BoolArray) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapByteArray(t func(BoolArray) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapRuneArray(t func(BoolArray) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapFloat32Array(t func(BoolArray) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapFloat64Array(t func(BoolArray) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f BoolArrayFuture) FlatMapAnyArray(t func(BoolArray) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapBool(t func(StringArray) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapString(t func(StringArray) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapInt(t func(StringArray) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapInt64(t func(StringArray) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapByte(t func(StringArray) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapRune(t func(StringArray) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapFloat32(t func(StringArray) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapFloat64(t func(StringArray) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapAny(t func(StringArray) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapBoolOption(t func(StringArray) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapStringOption(t func(StringArray) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapIntOption(t func(StringArray) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapInt64Option(t func(StringArray) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapByteOption(t func(StringArray) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapRuneOption(t func(StringArray) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapFloat32Option(t func(StringArray) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapFloat64Option(t func(StringArray) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapAnyOption(t func(StringArray) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapBoolListOption(t func(StringArray) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapStringListOption(t func(StringArray) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapIntListOption(t func(StringArray) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapInt64ListOption(t func(StringArray) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapByteListOption(t func(StringArray) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapRuneListOption(t func(StringArray) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapFloat32ListOption(t func(StringArray) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapFloat64ListOption(t func(StringArray) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapAnyListOption(t func(StringArray) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapBoolArrayOption(t func(StringArray) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapStringArrayOption(t func(StringArray) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapIntArrayOption(t func(StringArray) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapInt64ArrayOption(t func(StringArray) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapByteArrayOption(t func(StringArray) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapRuneArrayOption(t func(StringArray) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapFloat32ArrayOption(t func(StringArray) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapFloat64ArrayOption(t func(StringArray) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapAnyArrayOption(t func(StringArray) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapBoolList(t func(StringArray) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapStringList(t func(StringArray) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapIntList(t func(StringArray) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapInt64List(t func(StringArray) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapByteList(t func(StringArray) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapRuneList(t func(StringArray) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapFloat32List(t func(StringArray) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapFloat64List(t func(StringArray) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapAnyList(t func(StringArray) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapBoolArray(t func(StringArray) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapStringArray(t func(StringArray) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapIntArray(t func(StringArray) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapInt64Array(t func(StringArray) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapByteArray(t func(StringArray) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapRuneArray(t func(StringArray) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapFloat32Array(t func(StringArray) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapFloat64Array(t func(StringArray) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f StringArrayFuture) FlatMapAnyArray(t func(StringArray) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapBool(t func(IntArray) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapString(t func(IntArray) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapInt(t func(IntArray) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapInt64(t func(IntArray) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapByte(t func(IntArray) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapRune(t func(IntArray) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapFloat32(t func(IntArray) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapFloat64(t func(IntArray) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapAny(t func(IntArray) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapBoolOption(t func(IntArray) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapStringOption(t func(IntArray) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapIntOption(t func(IntArray) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapInt64Option(t func(IntArray) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapByteOption(t func(IntArray) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapRuneOption(t func(IntArray) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapFloat32Option(t func(IntArray) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapFloat64Option(t func(IntArray) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapAnyOption(t func(IntArray) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapBoolListOption(t func(IntArray) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapStringListOption(t func(IntArray) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapIntListOption(t func(IntArray) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapInt64ListOption(t func(IntArray) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapByteListOption(t func(IntArray) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapRuneListOption(t func(IntArray) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapFloat32ListOption(t func(IntArray) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapFloat64ListOption(t func(IntArray) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapAnyListOption(t func(IntArray) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapBoolArrayOption(t func(IntArray) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapStringArrayOption(t func(IntArray) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapIntArrayOption(t func(IntArray) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapInt64ArrayOption(t func(IntArray) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapByteArrayOption(t func(IntArray) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapRuneArrayOption(t func(IntArray) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapFloat32ArrayOption(t func(IntArray) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapFloat64ArrayOption(t func(IntArray) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapAnyArrayOption(t func(IntArray) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapBoolList(t func(IntArray) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapStringList(t func(IntArray) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapIntList(t func(IntArray) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapInt64List(t func(IntArray) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapByteList(t func(IntArray) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapRuneList(t func(IntArray) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapFloat32List(t func(IntArray) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapFloat64List(t func(IntArray) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapAnyList(t func(IntArray) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapBoolArray(t func(IntArray) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapStringArray(t func(IntArray) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapIntArray(t func(IntArray) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapInt64Array(t func(IntArray) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapByteArray(t func(IntArray) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapRuneArray(t func(IntArray) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapFloat32Array(t func(IntArray) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapFloat64Array(t func(IntArray) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f IntArrayFuture) FlatMapAnyArray(t func(IntArray) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapBool(t func(Int64Array) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapString(t func(Int64Array) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapInt(t func(Int64Array) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapInt64(t func(Int64Array) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapByte(t func(Int64Array) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapRune(t func(Int64Array) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapFloat32(t func(Int64Array) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapFloat64(t func(Int64Array) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapAny(t func(Int64Array) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapBoolOption(t func(Int64Array) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapStringOption(t func(Int64Array) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapIntOption(t func(Int64Array) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapInt64Option(t func(Int64Array) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapByteOption(t func(Int64Array) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapRuneOption(t func(Int64Array) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapFloat32Option(t func(Int64Array) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapFloat64Option(t func(Int64Array) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapAnyOption(t func(Int64Array) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapBoolListOption(t func(Int64Array) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapStringListOption(t func(Int64Array) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapIntListOption(t func(Int64Array) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapInt64ListOption(t func(Int64Array) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapByteListOption(t func(Int64Array) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapRuneListOption(t func(Int64Array) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapFloat32ListOption(t func(Int64Array) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapFloat64ListOption(t func(Int64Array) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapAnyListOption(t func(Int64Array) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapBoolArrayOption(t func(Int64Array) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapStringArrayOption(t func(Int64Array) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapIntArrayOption(t func(Int64Array) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapInt64ArrayOption(t func(Int64Array) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapByteArrayOption(t func(Int64Array) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapRuneArrayOption(t func(Int64Array) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapFloat32ArrayOption(t func(Int64Array) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapFloat64ArrayOption(t func(Int64Array) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapAnyArrayOption(t func(Int64Array) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapBoolList(t func(Int64Array) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapStringList(t func(Int64Array) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapIntList(t func(Int64Array) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapInt64List(t func(Int64Array) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapByteList(t func(Int64Array) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapRuneList(t func(Int64Array) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapFloat32List(t func(Int64Array) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapFloat64List(t func(Int64Array) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapAnyList(t func(Int64Array) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapBoolArray(t func(Int64Array) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapStringArray(t func(Int64Array) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapIntArray(t func(Int64Array) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapInt64Array(t func(Int64Array) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapByteArray(t func(Int64Array) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapRuneArray(t func(Int64Array) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapFloat32Array(t func(Int64Array) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapFloat64Array(t func(Int64Array) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Int64ArrayFuture) FlatMapAnyArray(t func(Int64Array) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapBool(t func(ByteArray) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapString(t func(ByteArray) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapInt(t func(ByteArray) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapInt64(t func(ByteArray) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapByte(t func(ByteArray) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapRune(t func(ByteArray) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapFloat32(t func(ByteArray) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapFloat64(t func(ByteArray) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapAny(t func(ByteArray) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapBoolOption(t func(ByteArray) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapStringOption(t func(ByteArray) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapIntOption(t func(ByteArray) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapInt64Option(t func(ByteArray) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapByteOption(t func(ByteArray) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapRuneOption(t func(ByteArray) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapFloat32Option(t func(ByteArray) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapFloat64Option(t func(ByteArray) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapAnyOption(t func(ByteArray) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapBoolListOption(t func(ByteArray) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapStringListOption(t func(ByteArray) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapIntListOption(t func(ByteArray) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapInt64ListOption(t func(ByteArray) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapByteListOption(t func(ByteArray) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapRuneListOption(t func(ByteArray) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapFloat32ListOption(t func(ByteArray) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapFloat64ListOption(t func(ByteArray) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapAnyListOption(t func(ByteArray) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapBoolArrayOption(t func(ByteArray) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapStringArrayOption(t func(ByteArray) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapIntArrayOption(t func(ByteArray) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapInt64ArrayOption(t func(ByteArray) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapByteArrayOption(t func(ByteArray) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapRuneArrayOption(t func(ByteArray) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapFloat32ArrayOption(t func(ByteArray) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapFloat64ArrayOption(t func(ByteArray) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapAnyArrayOption(t func(ByteArray) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapBoolList(t func(ByteArray) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapStringList(t func(ByteArray) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapIntList(t func(ByteArray) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapInt64List(t func(ByteArray) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapByteList(t func(ByteArray) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapRuneList(t func(ByteArray) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapFloat32List(t func(ByteArray) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapFloat64List(t func(ByteArray) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapAnyList(t func(ByteArray) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapBoolArray(t func(ByteArray) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapStringArray(t func(ByteArray) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapIntArray(t func(ByteArray) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapInt64Array(t func(ByteArray) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapByteArray(t func(ByteArray) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapRuneArray(t func(ByteArray) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapFloat32Array(t func(ByteArray) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapFloat64Array(t func(ByteArray) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f ByteArrayFuture) FlatMapAnyArray(t func(ByteArray) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapBool(t func(RuneArray) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapString(t func(RuneArray) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapInt(t func(RuneArray) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapInt64(t func(RuneArray) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapByte(t func(RuneArray) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapRune(t func(RuneArray) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapFloat32(t func(RuneArray) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapFloat64(t func(RuneArray) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapAny(t func(RuneArray) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapBoolOption(t func(RuneArray) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapStringOption(t func(RuneArray) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapIntOption(t func(RuneArray) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapInt64Option(t func(RuneArray) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapByteOption(t func(RuneArray) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapRuneOption(t func(RuneArray) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapFloat32Option(t func(RuneArray) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapFloat64Option(t func(RuneArray) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapAnyOption(t func(RuneArray) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapBoolListOption(t func(RuneArray) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapStringListOption(t func(RuneArray) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapIntListOption(t func(RuneArray) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapInt64ListOption(t func(RuneArray) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapByteListOption(t func(RuneArray) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapRuneListOption(t func(RuneArray) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapFloat32ListOption(t func(RuneArray) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapFloat64ListOption(t func(RuneArray) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapAnyListOption(t func(RuneArray) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapBoolArrayOption(t func(RuneArray) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapStringArrayOption(t func(RuneArray) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapIntArrayOption(t func(RuneArray) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapInt64ArrayOption(t func(RuneArray) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapByteArrayOption(t func(RuneArray) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapRuneArrayOption(t func(RuneArray) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapFloat32ArrayOption(t func(RuneArray) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapFloat64ArrayOption(t func(RuneArray) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapAnyArrayOption(t func(RuneArray) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapBoolList(t func(RuneArray) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapStringList(t func(RuneArray) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapIntList(t func(RuneArray) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapInt64List(t func(RuneArray) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapByteList(t func(RuneArray) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapRuneList(t func(RuneArray) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapFloat32List(t func(RuneArray) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapFloat64List(t func(RuneArray) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapAnyList(t func(RuneArray) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapBoolArray(t func(RuneArray) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapStringArray(t func(RuneArray) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapIntArray(t func(RuneArray) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapInt64Array(t func(RuneArray) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapByteArray(t func(RuneArray) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapRuneArray(t func(RuneArray) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapFloat32Array(t func(RuneArray) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapFloat64Array(t func(RuneArray) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f RuneArrayFuture) FlatMapAnyArray(t func(RuneArray) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapBool(t func(Float32Array) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapString(t func(Float32Array) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapInt(t func(Float32Array) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapInt64(t func(Float32Array) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapByte(t func(Float32Array) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapRune(t func(Float32Array) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapFloat32(t func(Float32Array) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapFloat64(t func(Float32Array) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapAny(t func(Float32Array) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapBoolOption(t func(Float32Array) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapStringOption(t func(Float32Array) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapIntOption(t func(Float32Array) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapInt64Option(t func(Float32Array) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapByteOption(t func(Float32Array) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapRuneOption(t func(Float32Array) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapFloat32Option(t func(Float32Array) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapFloat64Option(t func(Float32Array) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapAnyOption(t func(Float32Array) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapBoolListOption(t func(Float32Array) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapStringListOption(t func(Float32Array) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapIntListOption(t func(Float32Array) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapInt64ListOption(t func(Float32Array) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapByteListOption(t func(Float32Array) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapRuneListOption(t func(Float32Array) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapFloat32ListOption(t func(Float32Array) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapFloat64ListOption(t func(Float32Array) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapAnyListOption(t func(Float32Array) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapBoolArrayOption(t func(Float32Array) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapStringArrayOption(t func(Float32Array) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapIntArrayOption(t func(Float32Array) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapInt64ArrayOption(t func(Float32Array) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapByteArrayOption(t func(Float32Array) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapRuneArrayOption(t func(Float32Array) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapFloat32ArrayOption(t func(Float32Array) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapFloat64ArrayOption(t func(Float32Array) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapAnyArrayOption(t func(Float32Array) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapBoolList(t func(Float32Array) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapStringList(t func(Float32Array) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapIntList(t func(Float32Array) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapInt64List(t func(Float32Array) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapByteList(t func(Float32Array) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapRuneList(t func(Float32Array) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapFloat32List(t func(Float32Array) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapFloat64List(t func(Float32Array) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapAnyList(t func(Float32Array) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapBoolArray(t func(Float32Array) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapStringArray(t func(Float32Array) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapIntArray(t func(Float32Array) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapInt64Array(t func(Float32Array) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapByteArray(t func(Float32Array) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapRuneArray(t func(Float32Array) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapFloat32Array(t func(Float32Array) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapFloat64Array(t func(Float32Array) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Float32ArrayFuture) FlatMapAnyArray(t func(Float32Array) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapBool(t func(Float64Array) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapString(t func(Float64Array) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapInt(t func(Float64Array) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapInt64(t func(Float64Array) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapByte(t func(Float64Array) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapRune(t func(Float64Array) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapFloat32(t func(Float64Array) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapFloat64(t func(Float64Array) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapAny(t func(Float64Array) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapBoolOption(t func(Float64Array) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapStringOption(t func(Float64Array) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapIntOption(t func(Float64Array) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapInt64Option(t func(Float64Array) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapByteOption(t func(Float64Array) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapRuneOption(t func(Float64Array) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapFloat32Option(t func(Float64Array) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapFloat64Option(t func(Float64Array) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapAnyOption(t func(Float64Array) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapBoolListOption(t func(Float64Array) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapStringListOption(t func(Float64Array) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapIntListOption(t func(Float64Array) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapInt64ListOption(t func(Float64Array) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapByteListOption(t func(Float64Array) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapRuneListOption(t func(Float64Array) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapFloat32ListOption(t func(Float64Array) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapFloat64ListOption(t func(Float64Array) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapAnyListOption(t func(Float64Array) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapBoolArrayOption(t func(Float64Array) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapStringArrayOption(t func(Float64Array) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapIntArrayOption(t func(Float64Array) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapInt64ArrayOption(t func(Float64Array) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapByteArrayOption(t func(Float64Array) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapRuneArrayOption(t func(Float64Array) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapFloat32ArrayOption(t func(Float64Array) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapFloat64ArrayOption(t func(Float64Array) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapAnyArrayOption(t func(Float64Array) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapBoolList(t func(Float64Array) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapStringList(t func(Float64Array) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapIntList(t func(Float64Array) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapInt64List(t func(Float64Array) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapByteList(t func(Float64Array) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapRuneList(t func(Float64Array) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapFloat32List(t func(Float64Array) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapFloat64List(t func(Float64Array) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapAnyList(t func(Float64Array) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapBoolArray(t func(Float64Array) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapStringArray(t func(Float64Array) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapIntArray(t func(Float64Array) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapInt64Array(t func(Float64Array) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapByteArray(t func(Float64Array) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapRuneArray(t func(Float64Array) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapFloat32Array(t func(Float64Array) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapFloat64Array(t func(Float64Array) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f Float64ArrayFuture) FlatMapAnyArray(t func(Float64Array) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapBool(t func(AnyArray) BoolFuture) BoolFuture { return MkBoolFuture(func() Bool { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapString(t func(AnyArray) StringFuture) StringFuture { return MkStringFuture(func() String { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapInt(t func(AnyArray) IntFuture) IntFuture { return MkIntFuture(func() Int { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapInt64(t func(AnyArray) Int64Future) Int64Future { return MkInt64Future(func() Int64 { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapByte(t func(AnyArray) ByteFuture) ByteFuture { return MkByteFuture(func() Byte { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapRune(t func(AnyArray) RuneFuture) RuneFuture { return MkRuneFuture(func() Rune { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapFloat32(t func(AnyArray) Float32Future) Float32Future { return MkFloat32Future(func() Float32 { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapFloat64(t func(AnyArray) Float64Future) Float64Future { return MkFloat64Future(func() Float64 { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapAny(t func(AnyArray) AnyFuture) AnyFuture { return MkAnyFuture(func() Any { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapBoolOption(t func(AnyArray) BoolOptionFuture) BoolOptionFuture { return MkBoolOptionFuture(func() BoolOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapStringOption(t func(AnyArray) StringOptionFuture) StringOptionFuture { return MkStringOptionFuture(func() StringOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapIntOption(t func(AnyArray) IntOptionFuture) IntOptionFuture { return MkIntOptionFuture(func() IntOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapInt64Option(t func(AnyArray) Int64OptionFuture) Int64OptionFuture { return MkInt64OptionFuture(func() Int64Option { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapByteOption(t func(AnyArray) ByteOptionFuture) ByteOptionFuture { return MkByteOptionFuture(func() ByteOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapRuneOption(t func(AnyArray) RuneOptionFuture) RuneOptionFuture { return MkRuneOptionFuture(func() RuneOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapFloat32Option(t func(AnyArray) Float32OptionFuture) Float32OptionFuture { return MkFloat32OptionFuture(func() Float32Option { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapFloat64Option(t func(AnyArray) Float64OptionFuture) Float64OptionFuture { return MkFloat64OptionFuture(func() Float64Option { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapAnyOption(t func(AnyArray) AnyOptionFuture) AnyOptionFuture { return MkAnyOptionFuture(func() AnyOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapBoolListOption(t func(AnyArray) BoolListOptionFuture) BoolListOptionFuture { return MkBoolListOptionFuture(func() BoolListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapStringListOption(t func(AnyArray) StringListOptionFuture) StringListOptionFuture { return MkStringListOptionFuture(func() StringListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapIntListOption(t func(AnyArray) IntListOptionFuture) IntListOptionFuture { return MkIntListOptionFuture(func() IntListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapInt64ListOption(t func(AnyArray) Int64ListOptionFuture) Int64ListOptionFuture { return MkInt64ListOptionFuture(func() Int64ListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapByteListOption(t func(AnyArray) ByteListOptionFuture) ByteListOptionFuture { return MkByteListOptionFuture(func() ByteListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapRuneListOption(t func(AnyArray) RuneListOptionFuture) RuneListOptionFuture { return MkRuneListOptionFuture(func() RuneListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapFloat32ListOption(t func(AnyArray) Float32ListOptionFuture) Float32ListOptionFuture { return MkFloat32ListOptionFuture(func() Float32ListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapFloat64ListOption(t func(AnyArray) Float64ListOptionFuture) Float64ListOptionFuture { return MkFloat64ListOptionFuture(func() Float64ListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapAnyListOption(t func(AnyArray) AnyListOptionFuture) AnyListOptionFuture { return MkAnyListOptionFuture(func() AnyListOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapBoolArrayOption(t func(AnyArray) BoolArrayOptionFuture) BoolArrayOptionFuture { return MkBoolArrayOptionFuture(func() BoolArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapStringArrayOption(t func(AnyArray) StringArrayOptionFuture) StringArrayOptionFuture { return MkStringArrayOptionFuture(func() StringArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapIntArrayOption(t func(AnyArray) IntArrayOptionFuture) IntArrayOptionFuture { return MkIntArrayOptionFuture(func() IntArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapInt64ArrayOption(t func(AnyArray) Int64ArrayOptionFuture) Int64ArrayOptionFuture { return MkInt64ArrayOptionFuture(func() Int64ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapByteArrayOption(t func(AnyArray) ByteArrayOptionFuture) ByteArrayOptionFuture { return MkByteArrayOptionFuture(func() ByteArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapRuneArrayOption(t func(AnyArray) RuneArrayOptionFuture) RuneArrayOptionFuture { return MkRuneArrayOptionFuture(func() RuneArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapFloat32ArrayOption(t func(AnyArray) Float32ArrayOptionFuture) Float32ArrayOptionFuture { return MkFloat32ArrayOptionFuture(func() Float32ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapFloat64ArrayOption(t func(AnyArray) Float64ArrayOptionFuture) Float64ArrayOptionFuture { return MkFloat64ArrayOptionFuture(func() Float64ArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapAnyArrayOption(t func(AnyArray) AnyArrayOptionFuture) AnyArrayOptionFuture { return MkAnyArrayOptionFuture(func() AnyArrayOption { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapBoolList(t func(AnyArray) BoolListFuture) BoolListFuture { return MkBoolListFuture(func() BoolList { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapStringList(t func(AnyArray) StringListFuture) StringListFuture { return MkStringListFuture(func() StringList { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapIntList(t func(AnyArray) IntListFuture) IntListFuture { return MkIntListFuture(func() IntList { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapInt64List(t func(AnyArray) Int64ListFuture) Int64ListFuture { return MkInt64ListFuture(func() Int64List { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapByteList(t func(AnyArray) ByteListFuture) ByteListFuture { return MkByteListFuture(func() ByteList { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapRuneList(t func(AnyArray) RuneListFuture) RuneListFuture { return MkRuneListFuture(func() RuneList { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapFloat32List(t func(AnyArray) Float32ListFuture) Float32ListFuture { return MkFloat32ListFuture(func() Float32List { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapFloat64List(t func(AnyArray) Float64ListFuture) Float64ListFuture { return MkFloat64ListFuture(func() Float64List { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapAnyList(t func(AnyArray) AnyListFuture) AnyListFuture { return MkAnyListFuture(func() AnyList { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapBoolArray(t func(AnyArray) BoolArrayFuture) BoolArrayFuture { return MkBoolArrayFuture(func() BoolArray { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapStringArray(t func(AnyArray) StringArrayFuture) StringArrayFuture { return MkStringArrayFuture(func() StringArray { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapIntArray(t func(AnyArray) IntArrayFuture) IntArrayFuture { return MkIntArrayFuture(func() IntArray { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapInt64Array(t func(AnyArray) Int64ArrayFuture) Int64ArrayFuture { return MkInt64ArrayFuture(func() Int64Array { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapByteArray(t func(AnyArray) ByteArrayFuture) ByteArrayFuture { return MkByteArrayFuture(func() ByteArray { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapRuneArray(t func(AnyArray) RuneArrayFuture) RuneArrayFuture { return MkRuneArrayFuture(func() RuneArray { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapFloat32Array(t func(AnyArray) Float32ArrayFuture) Float32ArrayFuture { return MkFloat32ArrayFuture(func() Float32Array { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapFloat64Array(t func(AnyArray) Float64ArrayFuture) Float64ArrayFuture { return MkFloat64ArrayFuture(func() Float64Array { return <- t( <- f.ch).ch }) } func (f AnyArrayFuture) FlatMapAnyArray(t func(AnyArray) AnyArrayFuture) AnyArrayFuture { return MkAnyArrayFuture(func() AnyArray { return <- t( <- f.ch).ch }) }
fp/concurrent/bootstrap_future_flatmap.go
0.580114
0.469459
bootstrap_future_flatmap.go
starcoder
package main import ( "math" . "github.com/jakecoffman/cp" "github.com/jakecoffman/cp/examples" ) const ( PLAYER_VELOCITY = 500.0 PLAYER_GROUND_ACCEL_TIME = 0.1 PLAYER_GROUND_ACCEL = PLAYER_VELOCITY / PLAYER_GROUND_ACCEL_TIME PLAYER_AIR_ACCEL_TIME = 0.25 PLAYER_AIR_ACCEL = PLAYER_VELOCITY / PLAYER_AIR_ACCEL_TIME JUMP_HEIGHT = 50.0 JUMP_BOOST_HEIGHT = 55.0 FALL_VELOCITY = 900.0 GRAVITY = 2000.0 ) var playerBody *Body var playerShape *Shape var remainingBoost float64 var grounded, lastJumpState bool func playerUpdateVelocity(body *Body, gravity Vector, damping, dt float64) { jumpState := examples.Keyboard.Y > 0 // Grab the grounding normal from last frame groundNormal := Vector{} playerBody.EachArbiter(func(arb *Arbiter) { n := arb.Normal().Neg() if n.Y > groundNormal.Y { groundNormal = n } }) grounded = groundNormal.Y > 0 if groundNormal.Y < 0 { remainingBoost = 0 } // Do a normal-ish update boost := jumpState && remainingBoost > 0 var g Vector if !boost { g = gravity } body.UpdateVelocity(g, damping, dt) // Target horizontal speed for air/ground control targetVx := PLAYER_VELOCITY * examples.Keyboard.X // Update the surface velocity and friction // Note that the "feet" move in the opposite direction of the player. surfaceV := Vector{-targetVx, 0} playerShape.SetSurfaceV(surfaceV) if grounded { playerShape.SetFriction(PLAYER_GROUND_ACCEL / GRAVITY) } else { playerShape.SetFriction(0) } // Apply air control if not grounded if !grounded { v := playerBody.Velocity() playerBody.SetVelocity(LerpConst(v.X, targetVx, PLAYER_AIR_ACCEL*dt), v.Y) } v := body.Velocity() body.SetVelocity(v.X, Clamp(v.Y, -FALL_VELOCITY, INFINITY)) } func main() { space := NewSpace() space.Iterations = 10 space.SetGravity(Vector{0, -GRAVITY}) walls := []Vector{ {-320, -240}, {-320, 240}, {320, -240}, {320, 240}, {-320, -240}, {320, -240}, {-320, 240}, {320, 240}, } for i := 0; i < len(walls)-1; i += 2 { shape := space.AddShape(NewSegment(space.StaticBody, walls[i], walls[i+1], 0)) shape.SetElasticity(1) shape.SetFriction(1) shape.SetFilter(examples.NotGrabbableFilter) } // player playerBody = space.AddBody(NewBody(1, INFINITY)) playerBody.SetPosition(Vector{0, -200}) playerBody.SetVelocityUpdateFunc(playerUpdateVelocity) playerShape = space.AddShape(NewBox2(playerBody, BB{-15, -27.5, 15, 27.5}, 10)) playerShape.SetElasticity(0) playerShape.SetFriction(0) playerShape.SetCollisionType(1) for i := 0; i < 6; i++ { for j := 0; j < 3; j++ { body := space.AddBody(NewBody(4, INFINITY)) body.SetPosition(Vector{float64(100 + j*60), float64(-200 + i*60)}) shape := space.AddShape(NewBox(body, 50, 50, 0)) shape.SetElasticity(0) shape.SetFriction(0.7) } } examples.Main(space, 1.0/180.0, update, examples.DefaultDraw) } func update(space *Space, dt float64) { jumpState := examples.Keyboard.Y > 0 // If the jump key was just pressed this frame, jump! if jumpState && !lastJumpState && grounded { jumpV := math.Sqrt(2.0 * JUMP_HEIGHT * GRAVITY) playerBody.SetVelocityVector(playerBody.Velocity().Add(Vector{0, jumpV})) remainingBoost = JUMP_BOOST_HEIGHT / jumpV } space.Step(dt) remainingBoost -= dt lastJumpState = jumpState }
examples/player/player.go
0.586523
0.445771
player.go
starcoder
package gripql import ( "errors" "fmt" "sort" "strings" "github.com/bmeg/grip/protoutil" structpb "github.com/golang/protobuf/ptypes/struct" ) // GetDataMap obtains data attached to vertex in the form of a map func (vertex *Vertex) GetDataMap() map[string]interface{} { return protoutil.AsMap(vertex.Data) } // SetDataMap obtains data attached to vertex in the form of a map func (vertex *Vertex) SetDataMap(i map[string]interface{}) { vertex.Data = protoutil.AsStruct(i) } // SetProperty sets named field in Vertex data func (vertex *Vertex) SetProperty(key string, value interface{}) { if vertex.Data == nil { vertex.Data = &structpb.Struct{Fields: map[string]*structpb.Value{}} } protoutil.StructSet(vertex.Data, key, value) } // GetProperty get named field from vertex data func (vertex *Vertex) GetProperty(key string) interface{} { if vertex.Data == nil { return nil } m := protoutil.AsMap(vertex.Data) return m[key] } // HasProperty returns true is field is defined func (vertex *Vertex) HasProperty(key string) bool { if vertex.Data == nil { return false } m := protoutil.AsMap(vertex.Data) _, ok := m[key] return ok } // Validate returns an error if the vertex is invalid func (vertex *Vertex) Validate() error { if vertex.Gid == "" { return errors.New("'gid' cannot be blank") } if vertex.Label == "" { return errors.New("'label' cannot be blank") } for k := range vertex.GetDataMap() { err := ValidateFieldName(k) if err != nil { return err } } return nil } // GetDataMap obtains data attached to vertex in the form of a map func (edge *Edge) GetDataMap() map[string]interface{} { return protoutil.AsMap(edge.Data) } // SetDataMap obtains data attached to vertex in the form of a map func (edge *Edge) SetDataMap(i map[string]interface{}) { edge.Data = protoutil.AsStruct(i) } // SetProperty sets named field in Vertex data func (edge *Edge) SetProperty(key string, value interface{}) { if edge.Data == nil { edge.Data = &structpb.Struct{Fields: map[string]*structpb.Value{}} } protoutil.StructSet(edge.Data, key, value) } // GetProperty get named field from edge data func (edge *Edge) GetProperty(key string) interface{} { if edge.Data == nil { return nil } m := protoutil.AsMap(edge.Data) return m[key] } // HasProperty returns true is field is defined func (edge *Edge) HasProperty(key string) bool { if edge.Data == nil { return false } m := protoutil.AsMap(edge.Data) _, ok := m[key] return ok } // Validate returns an error if the edge is invalid func (edge *Edge) Validate() error { if edge.Gid == "" { return errors.New("'gid' cannot be blank") } if edge.Label == "" { return errors.New("'label' cannot be blank") } if edge.From == "" { return errors.New("'from' cannot be blank") } if edge.To == "" { return errors.New("'to' cannot be blank") } for k := range edge.GetDataMap() { err := ValidateFieldName(k) if err != nil { return err } } return nil } // AsMap converts a NamedAggregationResult to a map[string]interface{} func (aggRes *AggregationResult) AsMap() map[string]interface{} { buckets := make([]map[string]interface{}, len(aggRes.Buckets)) for i, b := range aggRes.Buckets { buckets[i] = b.AsMap() } return map[string]interface{}{ "buckets": buckets, } } // AsMap converts an AggregationResultBucket to a map[string]interface{} func (aggRes *AggregationResultBucket) AsMap() map[string]interface{} { return map[string]interface{}{ "key": aggRes.Key, "value": aggRes.Value, } } // SortedInsert inserts an AggregationResultBucket into the Buckets field // and returns the index of the insertion func (aggRes *AggregationResult) SortedInsert(el *AggregationResultBucket) (int, error) { if !aggRes.IsValueSorted() { return 0, errors.New("buckets are not value sorted") } if len(aggRes.Buckets) == 0 { aggRes.Buckets = []*AggregationResultBucket{el} return 0, nil } index := sort.Search(len(aggRes.Buckets), func(i int) bool { if aggRes.Buckets[i] == nil { return true } return el.Value > aggRes.Buckets[i].Value }) aggRes.Buckets = append(aggRes.Buckets, &AggregationResultBucket{}) copy(aggRes.Buckets[index+1:], aggRes.Buckets[index:]) aggRes.Buckets[index] = el return index, nil } // SortOnValue sorts Buckets by Value in descending order func (aggRes *AggregationResult) SortOnValue() { sort.Slice(aggRes.Buckets, func(i, j int) bool { if aggRes.Buckets[i] == nil && aggRes.Buckets[j] != nil { return true } if aggRes.Buckets[i] != nil && aggRes.Buckets[j] == nil { return false } if aggRes.Buckets[i] == nil && aggRes.Buckets[j] == nil { return false } return aggRes.Buckets[i].Value > aggRes.Buckets[j].Value }) } // IsValueSorted returns true if the Buckets are sorted by Value func (aggRes *AggregationResult) IsValueSorted() bool { for i := range aggRes.Buckets { j := i + 1 if i < len(aggRes.Buckets)-2 { if aggRes.Buckets[i] != nil && aggRes.Buckets[j] == nil { return true } if aggRes.Buckets[i] == nil && aggRes.Buckets[j] != nil { return false } if aggRes.Buckets[i] == nil && aggRes.Buckets[j] == nil { return true } if aggRes.Buckets[i].Value < aggRes.Buckets[j].Value { return false } } } return true } // ValidateGraphName returns an error if the graph name is invalid func ValidateGraphName(graph string) error { err := validate(graph) if err != nil { return fmt.Errorf(`invalid graph name %s; %v`, graph, err) } return nil } // ReservedFields are the fields that cannot be used as keys within the data of a vertex or edge var ReservedFields = []string{"_gid", "_label", "_to", "_from", "_data"} // ValidateFieldName returns an error if the data field name is invalid func ValidateFieldName(k string) error { for _, v := range ReservedFields { if k == v { return fmt.Errorf("data field '%s' uses a reserved name", k) } } err := validate(k) if err != nil { return fmt.Errorf(`invalid data field '%s'; %v`, k, err) } return nil } func validate(k string) error { if strings.ContainsAny(k, `!@#$%^&*()+={}[] :;"',.<>?/\|~`) { return errors.New(`cannot contain: !@#$%^&*()+={}[] :;"',.<>?/\|~`) } if strings.HasPrefix(k, "_") || strings.HasPrefix(k, "-") { return errors.New(`cannot start with _-`) } return nil }
gripql/util.go
0.747708
0.486027
util.go
starcoder
package stats import ( "math" ) // Values presents a set of data values as an array, for the purposes of aggregation type Values interface { // Len returns the number of values present Len() int // ValueAt returns the value at the nth element ValueAt(n int) float64 } // MutableValues is a set of data values that can be modified type MutableValues interface { Values // SetValueAt sets the value at the nth element SetValueAt(n int, v float64) } // Float64Values is a simple Values implementation around a slice type Float64Values []float64 // Len returns the number of elements in the array func (vals Float64Values) Len() int { return len(vals) } // ValueAt returns the value at the nth element func (vals Float64Values) ValueAt(n int) float64 { return vals[n] } // SetValueAt sets the value at the nth element func (vals Float64Values) SetValueAt(n int, v float64) { vals[n] = v } // Statistics are the computation of standard statistics (min, max, mean, count, stddev) // over a group of values. type Statistics struct { Min float64 Max float64 Mean float64 Count uint Sum float64 StdDev float64 } // Merge merges a group of statistics func Merge(statistics []Statistics) Statistics { var ( count uint min, max, mean, sum float64 ) for _, a := range statistics { if a.Count == 0 { continue } if count == 0 { min, max = a.Min, a.Max } else { min, max = math.Min(min, a.Min), math.Max(max, a.Max) } priorCount := count count += a.Count sum += a.Sum mean = ((a.Mean * float64(a.Count)) + (mean * float64(priorCount))) / float64(count) } if count == 0 { return Statistics{} } var sum1, sum2 float64 for _, a := range statistics { if a.Count == 0 { continue } variance := a.StdDev * a.StdDev avg := a.Mean sum1 += float64(a.Count) * variance sum2 += float64(a.Count) * math.Pow(avg-mean, 2) } variance := ((sum1 + sum2) / float64(count)) return Statistics{ Count: count, Min: min, Max: max, Mean: mean, Sum: sum, StdDev: math.Sqrt(variance), } } func calc(values Values) (uint, float64, float64, float64, float64, float64) { count := uint(0) sum := float64(0) min := math.MaxFloat64 max := -math.MaxFloat64 for i := 0; i < values.Len(); i++ { n := values.ValueAt(i) if math.IsNaN(n) { continue } count++ sum += n min = math.Min(n, min) max = math.Max(n, max) } if count == 0 { nan := math.NaN() return 0, nan, nan, nan, nan, nan } mean := float64(0) if count > 0 { mean = sum / float64(count) } stddev := float64(0) if count > 1 { m2 := float64(0) for i := 0; i < values.Len(); i++ { n := values.ValueAt(i) if math.IsNaN(n) { continue } diff := n - mean m2 += diff * diff } variance := m2 / float64(count-1) stddev = math.Sqrt(variance) } return count, min, max, mean, sum, stddev } // Calc calculates statistics for a set of values func Calc(values Values) Statistics { count, min, max, mean, sum, stddev := calc(values) return Statistics{ Count: count, Min: min, Max: max, Mean: mean, Sum: sum, StdDev: stddev, } } // SingleCountStatistics returns Statistics for a single value func SingleCountStatistics(value float64) Statistics { return Statistics{ Count: 1, Min: value, Max: value, Sum: value, Mean: value, StdDev: 0, } } // ZeroCountStatistics returns statistics when no values are present // (or when all values are NaNs) func ZeroCountStatistics() Statistics { nan := math.NaN() return Statistics{ Count: 0, Min: nan, Max: nan, Sum: nan, Mean: nan, StdDev: nan, } }
src/query/graphite/stats/statistics.go
0.847527
0.757346
statistics.go
starcoder
package cameras import ( "github.com/nuberu/engine/core" "github.com/nuberu/engine/math" ) type orthographicView struct { enabled bool fullWidth float32 fullHeight float32 offsetX float32 offsetY float32 width float32 height float32 } func newOrthographicView() *orthographicView { return &orthographicView{ enabled: true, fullWidth: 1, fullHeight: 1, offsetX: 0, offsetY: 0, width: 1, height: 1, } } func (ov *orthographicView) Clone() *orthographicView { return &orthographicView{ enabled: ov.enabled, fullWidth: ov.fullWidth, fullHeight: ov.fullHeight, offsetX: ov.offsetX, offsetY: ov.offsetY, width: ov.width, height: ov.height, } } type Orthographic struct { core.Camera zoom float32 view orthographicView left float32 right float32 top float32 bottom float32 near float32 far float32 } func NewOrthographic(left, top, right, bottom float32, near, far float32) *Orthographic { return &Orthographic{ Camera: *core.NewCamera(), zoom: 0.0, view: *newOrthographicView(), left: left, right: right, top: top, bottom: bottom, near: near, far: far, } } func (camera *Orthographic) Copy(source *Orthographic, recursive bool) { camera.Camera.Copy(&source.Camera, recursive) camera.left = source.left camera.right = source.right camera.top = source.top camera.bottom = source.bottom camera.near = source.near camera.far = source.far camera.zoom = source.zoom camera.view = *source.view.Clone() } func (camera *Orthographic) SetViewOffset(fullWidth, fullHeight, x, y, width, height float32) { camera.view.enabled = true camera.view.fullWidth = fullWidth camera.view.fullHeight = fullHeight camera.view.offsetX = x camera.view.offsetY = y camera.view.width = width camera.view.height = height camera.UpdateProjectionMatrix() } func (camera *Orthographic) ClearViewOffset() { camera.view.enabled = false camera.UpdateProjectionMatrix() } func (camera *Orthographic) UpdateProjectionMatrix() { dx := (camera.right - camera.left) / (2 * camera.zoom) dy := (camera.top - camera.bottom) / (2 * camera.zoom) cx := (camera.right + camera.left) / 2 cy := (camera.top + camera.bottom) / 2 left := cx - dx right := cx + dx top := cy + dy bottom := cy - dy if camera.view.enabled { var zoomW = camera.zoom / (camera.view.width / camera.view.fullWidth) var zoomH = camera.zoom / (camera.view.height / camera.view.fullHeight) var scaleW = (camera.right - camera.left) / camera.view.width var scaleH = (camera.top - camera.bottom) / camera.view.height left += scaleW * (camera.view.offsetX / zoomW) right = left + scaleW*(camera.view.width/zoomW) top -= scaleH * (camera.view.offsetY / zoomH) bottom = top - scaleH*(camera.view.height/zoomH) } camera.GetProjectionMatrix().MakeOrthographic(left, right, top, bottom, camera.near, camera.far) camera.GetProjectionMatrixInverse().SetInverseOf(camera.GetProjectionMatrix(), false) } func (camera *Orthographic) GetRay(coordinates *math.Vector2) *math.Ray { origin := math.NewVector3(coordinates.X, coordinates.Y, (camera.near+camera.far)/(camera.near-camera.far)) core.UnProject(origin, &camera.Camera) direction := math.NewVector3(0, 0, -1) direction.TransformDirection(camera.GetMatrixWorld()) return math.NewRay(origin, direction) }
cameras/orthographic.go
0.826747
0.47859
orthographic.go
starcoder
package temple // taken straight out of https://github.com/hashicorp/consul-template/blob/master/template/funcs.go // to support the "math" function // licensed under MPL-2.0 import ( "fmt" "reflect" ) // add returns the sum of a and b. func add(b, a interface{}) (interface{}, error) { av := reflect.ValueOf(a) bv := reflect.ValueOf(b) switch av.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return av.Int() + bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return av.Int() + int64(bv.Uint()), nil case reflect.Float32, reflect.Float64: return float64(av.Int()) + bv.Float(), nil default: return nil, fmt.Errorf("add: unknown type for %q (%T)", bv, b) } case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return int64(av.Uint()) + bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return av.Uint() + bv.Uint(), nil case reflect.Float32, reflect.Float64: return float64(av.Uint()) + bv.Float(), nil default: return nil, fmt.Errorf("add: unknown type for %q (%T)", bv, b) } case reflect.Float32, reflect.Float64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return av.Float() + float64(bv.Int()), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return av.Float() + float64(bv.Uint()), nil case reflect.Float32, reflect.Float64: return av.Float() + bv.Float(), nil default: return nil, fmt.Errorf("add: unknown type for %q (%T)", bv, b) } default: return nil, fmt.Errorf("add: unknown type for %q (%T)", av, a) } } // subtract returns the difference of b from a. func subtract(b, a interface{}) (interface{}, error) { av := reflect.ValueOf(a) bv := reflect.ValueOf(b) switch av.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return av.Int() - bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return av.Int() - int64(bv.Uint()), nil case reflect.Float32, reflect.Float64: return float64(av.Int()) - bv.Float(), nil default: return nil, fmt.Errorf("subtract: unknown type for %q (%T)", bv, b) } case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return int64(av.Uint()) - bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return av.Uint() - bv.Uint(), nil case reflect.Float32, reflect.Float64: return float64(av.Uint()) - bv.Float(), nil default: return nil, fmt.Errorf("subtract: unknown type for %q (%T)", bv, b) } case reflect.Float32, reflect.Float64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return av.Float() - float64(bv.Int()), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return av.Float() - float64(bv.Uint()), nil case reflect.Float32, reflect.Float64: return av.Float() - bv.Float(), nil default: return nil, fmt.Errorf("subtract: unknown type for %q (%T)", bv, b) } default: return nil, fmt.Errorf("subtract: unknown type for %q (%T)", av, a) } } // multiply returns the product of a and b. func multiply(b, a interface{}) (interface{}, error) { av := reflect.ValueOf(a) bv := reflect.ValueOf(b) switch av.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return av.Int() * bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return av.Int() * int64(bv.Uint()), nil case reflect.Float32, reflect.Float64: return float64(av.Int()) * bv.Float(), nil default: return nil, fmt.Errorf("multiply: unknown type for %q (%T)", bv, b) } case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return int64(av.Uint()) * bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return av.Uint() * bv.Uint(), nil case reflect.Float32, reflect.Float64: return float64(av.Uint()) * bv.Float(), nil default: return nil, fmt.Errorf("multiply: unknown type for %q (%T)", bv, b) } case reflect.Float32, reflect.Float64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return av.Float() * float64(bv.Int()), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return av.Float() * float64(bv.Uint()), nil case reflect.Float32, reflect.Float64: return av.Float() * bv.Float(), nil default: return nil, fmt.Errorf("multiply: unknown type for %q (%T)", bv, b) } default: return nil, fmt.Errorf("multiply: unknown type for %q (%T)", av, a) } } // divide returns the division of b from a. func divide(b, a interface{}) (interface{}, error) { av := reflect.ValueOf(a) bv := reflect.ValueOf(b) switch av.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return av.Int() / bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return av.Int() / int64(bv.Uint()), nil case reflect.Float32, reflect.Float64: return float64(av.Int()) / bv.Float(), nil default: return nil, fmt.Errorf("divide: unknown type for %q (%T)", bv, b) } case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return int64(av.Uint()) / bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return av.Uint() / bv.Uint(), nil case reflect.Float32, reflect.Float64: return float64(av.Uint()) / bv.Float(), nil default: return nil, fmt.Errorf("divide: unknown type for %q (%T)", bv, b) } case reflect.Float32, reflect.Float64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return av.Float() / float64(bv.Int()), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return av.Float() / float64(bv.Uint()), nil case reflect.Float32, reflect.Float64: return av.Float() / bv.Float(), nil default: return nil, fmt.Errorf("divide: unknown type for %q (%T)", bv, b) } default: return nil, fmt.Errorf("divide: unknown type for %q (%T)", av, a) } } // modulo returns the modulo of b from a. func modulo(b, a interface{}) (interface{}, error) { av := reflect.ValueOf(a) bv := reflect.ValueOf(b) switch av.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return av.Int() % bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return av.Int() % int64(bv.Uint()), nil default: return nil, fmt.Errorf("modulo: unknown type for %q (%T)", bv, b) } case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return int64(av.Uint()) % bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return av.Uint() % bv.Uint(), nil default: return nil, fmt.Errorf("modulo: unknown type for %q (%T)", bv, b) } default: return nil, fmt.Errorf("modulo: unknown type for %q (%T)", av, a) } } // minimum returns the minimum between a and b. func minimum(b, a interface{}) (interface{}, error) { av := reflect.ValueOf(a) bv := reflect.ValueOf(b) switch av.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: if av.Int() < bv.Int() { return av.Int(), nil } return bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: if av.Int() < int64(bv.Uint()) { return av.Int(), nil } return bv.Uint(), nil case reflect.Float32, reflect.Float64: if float64(av.Int()) < bv.Float() { return av.Int(), nil } return bv.Float(), nil default: return nil, fmt.Errorf("minimum: unknown type for %q (%T)", bv, b) } case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: if int64(av.Uint()) < bv.Int() { return av.Uint(), nil } return bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: if av.Uint() < bv.Uint() { return av.Uint(), nil } return bv.Uint(), nil case reflect.Float32, reflect.Float64: if float64(av.Uint()) < bv.Float() { return av.Uint(), nil } return bv.Float(), nil default: return nil, fmt.Errorf("minimum: unknown type for %q (%T)", bv, b) } case reflect.Float32, reflect.Float64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: if av.Float() < float64(bv.Int()) { return av.Float(), nil } return bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: if av.Float() < float64(bv.Uint()) { return av.Float(), nil } return bv.Uint(), nil case reflect.Float32, reflect.Float64: if av.Float() < bv.Float() { return av.Float(), nil } return bv.Float(), nil default: return nil, fmt.Errorf("minimum: unknown type for %q (%T)", bv, b) } default: return nil, fmt.Errorf("minimum: unknown type for %q (%T)", av, a) } } // maximum returns the maximum between a and b. func maximum(b, a interface{}) (interface{}, error) { av := reflect.ValueOf(a) bv := reflect.ValueOf(b) switch av.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: if av.Int() > bv.Int() { return av.Int(), nil } return bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: if av.Int() > int64(bv.Uint()) { return av.Int(), nil } return bv.Uint(), nil case reflect.Float32, reflect.Float64: if float64(av.Int()) > bv.Float() { return av.Int(), nil } return bv.Float(), nil default: return nil, fmt.Errorf("maximum: unknown type for %q (%T)", bv, b) } case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: if int64(av.Uint()) > bv.Int() { return av.Uint(), nil } return bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: if av.Uint() > bv.Uint() { return av.Uint(), nil } return bv.Uint(), nil case reflect.Float32, reflect.Float64: if float64(av.Uint()) > bv.Float() { return av.Uint(), nil } return bv.Float(), nil default: return nil, fmt.Errorf("maximum: unknown type for %q (%T)", bv, b) } case reflect.Float32, reflect.Float64: switch bv.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: if av.Float() > float64(bv.Int()) { return av.Float(), nil } return bv.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: if av.Float() > float64(bv.Uint()) { return av.Float(), nil } return bv.Uint(), nil case reflect.Float32, reflect.Float64: if av.Float() > bv.Float() { return av.Float(), nil } return bv.Float(), nil default: return nil, fmt.Errorf("maximum: unknown type for %q (%T)", bv, b) } default: return nil, fmt.Errorf("maximum: unknown type for %q (%T)", av, a) } }
temple/consul-math.go
0.864511
0.569673
consul-math.go
starcoder
package thl import ( "errors" "math" "sort" "time" ) /*********************** *** General Helpers *** ***********************/ // Internal structure used for sorting slices of dates type timeSort []time.Time func (ts timeSort) Len() int { return len(ts) } func (ts timeSort) Less(i, j int) bool { return ts[i].Before(ts[j]) } func (ts timeSort) Swap(i, j int) { ts[i], ts[j] = ts[j], ts[i] } // Constant is the type of constant used in the package type Constant int // ASC is used for sorting dates chronologically const ASC Constant = 1 // DESC is used to sort dates reverse chronologically const DESC Constant = -1 // Sort the given slice of dates depending on the comparator value func Sort(timeSlice []time.Time, comparator Constant) { tm := timeSort(timeSlice) if ASC == comparator { sort.Sort(tm) } else if DESC == comparator { sort.Sort(sort.Reverse(tm)) } } // SortAsc sorts a slice of dates chronologically func SortAsc(timeSlice []time.Time) { Sort(timeSlice, ASC) } // SortDesc sorts a slice of date reverse chronologically func SortDesc(timeSlice []time.Time) { Sort(timeSlice, DESC) } // Compare two dates and return: // -1 if the first date is before the second date // 0 if they are the same date // 1 is the second date is before the first date func Compare(first time.Time, second time.Time) int { if first.Before(second) { return -1 } else if first.After(second) { return 1 } else { return 0 } } // Finds index of the date from the slice that is closest to the date passed func ClosestIndexTo(dateToCompare time.Time, datesSlice []time.Time) (int, error) { if datesSlice == nil { return 0, errors.New("Passed slice of dates was nil") } if len(datesSlice) == 0 { return 0, errors.New("Passed slice of dates was of size 0") } var closestIndex int var currentMinMili int64 = math.MaxInt64 var currentMinNano int64 = math.MaxInt64 dateMiliUnix := dateToCompare.Unix() dateNanoUnix := dateToCompare.UnixNano() for index, date := range datesSlice { unixDiffMili := dateMiliUnix - date.Unix() unixDiffNano := dateNanoUnix - date.UnixNano() // get the positive values if unixDiffMili < 0 { unixDiffMili = -1 * unixDiffMili } if unixDiffNano < 0 { unixDiffNano = -1 * unixDiffNano } if unixDiffMili < currentMinMili { currentMinMili = unixDiffMili currentMinNano = unixDiffNano closestIndex = index } else if unixDiffMili == currentMinMili { if unixDiffNano < currentMinNano { currentMinMili = unixDiffMili currentMinNano = unixDiffNano closestIndex = index } } } return closestIndex, nil } // Finds the date from the slice that is closest to the date passed func ClosestTo(dateToCompare time.Time, datesSlice []time.Time) (time.Time, error) { index, err := ClosestIndexTo(dateToCompare, datesSlice) if err != nil { return time.Time{}, err } return datesSlice[index], nil } // Checks if the date is in the future func IsFuture(dateToTest time.Time) bool { return dateToTest.After(time.Now()) } // Checks if the date is in the past func IsPast(dateToTest time.Time) bool { return dateToTest.Before(time.Now()) } // Finds the latest date chronologically func Max(datesSlice []time.Time) (time.Time, error) { if datesSlice == nil { return time.Time{}, errors.New("Passed slice of dates was nil") } if len(datesSlice) == 0 { return time.Time{}, errors.New("Passed slice of dates was of size 0") } dateToReturn := datesSlice[0] for _, testDate := range datesSlice { if testDate.After(dateToReturn) { dateToReturn = testDate } } return dateToReturn, nil } // Finds the latest date reverse chronologically func Min(datesSlice []time.Time) (time.Time, error) { if datesSlice == nil { return time.Time{}, errors.New("Passed slice of dates was nil") } if len(datesSlice) == 0 { return time.Time{}, errors.New("Passed slice of dates was of size 0") } dateToReturn := datesSlice[0] for _, testDate := range datesSlice { if testDate.Before(dateToReturn) { dateToReturn = testDate } } return dateToReturn, nil } // Cheks if the ranges overlap func AreRangesOverlapping( initialRangeStartDate, initialRangeEndDate, endRangeStartDate, endRangeEndDate time.Time) bool { return initialRangeStartDate.Before(initialRangeEndDate) && endRangeStartDate.Before(initialRangeEndDate) && endRangeStartDate.Before(endRangeEndDate) } // Gets the number of days that the ranges overlap func GetOverlappingDaysInRanges( initialRangeStartDate, initialRangeEndDate, endRangeStartDate, endRangeEndDate time.Time) (int, error) { areOverlapping := AreRangesOverlapping(initialRangeStartDate, initialRangeEndDate, endRangeStartDate, endRangeEndDate) if !areOverlapping { return 0, errors.New("Ranges do not overlap") } return -1 * DifferenceInDays(endRangeStartDate, initialRangeEndDate), nil } // Cheks if the passed date is within the range func IsWithinRange(date, startDate, endDate time.Time) bool { return date.After(startDate) && date.Before(endDate) } /**************************** *** Millisecond Helpers *** ****************************/ func AddMilliseconds(date time.Time, amount int) time.Time { return date.Add(time.Millisecond * time.Duration(amount)) } func DifferenceInMilliseconds(dateLeft, dateRight time.Time) int64 { leftInMill := dateLeft.UnixNano() / int64(time.Millisecond) rightInMil := dateRight.UnixNano() / int64(time.Millisecond) return leftInMill - rightInMil } func GetMilliseconds(date time.Time) int { return date.Nanosecond() / int(time.Millisecond) } func SetMillisecond(date time.Time, amount int) (time.Time, error) { if amount < 0 || amount > 999 { return date, errors.New("Passed amount was less than 0 or more than 999. Date left unchanged.") } return time.Date(date.Year(), date.Month(), date.Day(), date.Hour(), date.Minute(), date.Second(), int(time.Millisecond)*amount, date.Location()), nil } /********************** *** Second Helpers *** **********************/ func AddSeconds(date time.Time, amount int) time.Time { return date.Add(time.Second * time.Duration(amount)) } func DifferenceInSeconds(dateLeft, dateRight time.Time) float64 { return dateLeft.Sub(dateRight).Seconds() } func EndOfSecond(date time.Time) time.Time { return time.Date( date.Year(), date.Month(), date.Day(), date.Hour(), date.Minute(), date.Second(), 999999999, date.Location()) } func IsSameSecond(dateLeft, dateRight time.Time) bool { return dateLeft.Year() == dateRight.Year() && dateLeft.Month() == dateRight.Month() && dateLeft.Day() == dateRight.Day() && dateLeft.Hour() == dateRight.Hour() && dateLeft.Minute() == dateRight.Minute() && dateLeft.Second() == dateRight.Second() } func IsThisSecond(date time.Time) bool { now := time.Now() return IsSameSecond(date, now) } func SetSeconds(date time.Time, seconds int) (time.Time, error) { if seconds < 0 || seconds > 59 { return date, errors.New("Passed amount was less than 0 or more than 59. Date left unchanged.") } return time.Date(date.Year(), date.Month(), date.Day(), date.Hour(), date.Minute(), seconds, date.Nanosecond(), date.Location()), nil } func StartOfSecond(date time.Time) time.Time { return time.Date(date.Year(), date.Month(), date.Day(), date.Hour(), date.Minute(), date.Second(), 0, date.Location()) } /********************** *** Minute Helpers *** **********************/ func AddMinutes(date time.Time, amount int) time.Time { return date.Add(time.Minute * time.Duration(amount)) } func DifferenceInMinutes(dateLeft, dateRight time.Time) float64 { return dateLeft.Sub(dateRight).Minutes() } func EndOfMinute(date time.Time) time.Time { return time.Date(date.Year(), date.Month(), date.Day(), date.Hour(), date.Minute(), 59, 999999999, date.Location()) } func IsSameMinute(dateLeft, dateRight time.Time) bool { return dateLeft.Year() == dateRight.Year() && dateLeft.Month() == dateRight.Month() && dateLeft.Day() == dateRight.Day() && dateLeft.Hour() == dateRight.Hour() && dateLeft.Minute() == dateRight.Minute() } func IsThisMinute(date time.Time) bool { now := time.Now() return IsSameMinute(date, now) } func SetMinutes(date time.Time, minutes int) (time.Time, error) { if minutes < 0 || minutes > 59 { return date, errors.New("Passed amount was less than 0 or more than 59. Date left unchanged.") } return time.Date(date.Year(), date.Month(), date.Day(), date.Hour(), minutes, date.Second(), date.Nanosecond(), date.Location()), nil } func StartOfMinute(date time.Time) time.Time { return time.Date(date.Year(), date.Month(), date.Day(), date.Hour(), date.Minute(), 0, 0, date.Location()) } /******************** *** Hour Helpers *** ********************/ func AddHours(date time.Time, amount int) time.Time { return date.Add(time.Hour * time.Duration(amount)) } func DifferenceInHours(dateLeft, dateRight time.Time) float64 { return dateLeft.Sub(dateRight).Hours() } func EndOfHour(date time.Time) time.Time { return time.Date(date.Year(), date.Month(), date.Day(), date.Hour(), 59, 59, 999999999, date.Location()) } func IsSameHour(dateLeft, dateRight time.Time) bool { return dateLeft.Year() == dateRight.Year() && dateLeft.Month() == dateRight.Month() && dateLeft.Day() == dateRight.Day() && dateLeft.Hour() == dateRight.Hour() } func IsThisHour(date time.Time) bool { return IsSameHour(time.Now(), date) } func SetHours(date time.Time, hours int) (time.Time, error) { if hours < 0 || hours > 23 { return date, errors.New("Passed amount was less than 0 or more than 23. Date left unchanged.") } return time.Date( date.Year(), date.Month(), date.Day(), hours, date.Minute(), date.Second(), date.Nanosecond(), date.Location()), nil } func StartOfHour(date time.Time) time.Time { return time.Date(date.Year(), date.Month(), date.Day(), date.Hour(), 0, 0, 0, date.Location()) } /******************* *** Day Helpers *** *******************/ func LastDayOfYear(t time.Time) time.Time { return time.Date(t.Year(), 12, 31, 0, 0, 0, 0, t.Location()) } func FirstDayOfNextYear(t time.Time) time.Time { return time.Date(t.Year()+1, 1, 1, 0, 0, 0, 0, t.Location()) } func FirstDayOfYear(t time.Time) time.Time { return time.Date(t.Year(), 1, 1, 0, 0, 0, 0, t.Location()) } func DifferenceInDays(endDate, startDate time.Time) (days int) { cur := startDate for cur.Year() < endDate.Year() { // add 1 to count the last day of the year too. days += LastDayOfYear(cur).YearDay() - cur.YearDay() + 1 cur = FirstDayOfNextYear(cur) } days += endDate.YearDay() - cur.YearDay() return days } func AddDays(date time.Time, amount int) time.Time { return date.Add(time.Hour * 24 * time.Duration(amount)) } func EndOfDay(date time.Time) time.Time { return time.Date(date.Year(), date.Month(), date.Day(), 23, 59, 59, 999999999, date.Location()) } func StartOfDay(date time.Time) time.Time { return time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, date.Location()) } func EachDay(startDate, endDate time.Time) ([]time.Time, error) { var datesRange []time.Time if endDate.Before(startDate) { return datesRange, errors.New("End date can not be before start date. Returned empty slice.") } counterDate := AddDays(startDate, 1) for counterDate.Before(endDate) { datesRange = append(datesRange, counterDate) counterDate = StartOfDay(AddDays(counterDate, 1)) } return datesRange, nil } func IsSameDay(firstDay, secondDay time.Time) bool { return firstDay.Year() == secondDay.Year() && firstDay.Month() == secondDay.Month() && firstDay.Day() == secondDay.Day() } func EndOfToday() time.Time { return EndOfDay(time.Now()) } func EndOfTomorrow() time.Time { return EndOfDay(AddDays(time.Now(), 1)) } func EndOfYesterday() time.Time { return EndOfDay(AddDays(time.Now(), -1)) } func StartOfToday() time.Time { return StartOfDay(time.Now()) } func StartOfTomorrow() time.Time { return StartOfDay(AddDays(time.Now(), 1)) } func StartOfYesterday() time.Time { return StartOfDay(AddDays(time.Now(), -1)) } func IsToday(date time.Time) bool { return IsSameDay(date, time.Now()) } func IsTomorrow(date time.Time) bool { return IsSameDay(date, AddDays(time.Now(), 1)) } func IsYesterday(date time.Time) bool { return IsSameDay(date, AddDays(time.Now(), -1)) } func SetDayOfYear(date time.Time, dayNumber int) (time.Time, error) { daysInYear := 365 if IsLeapYear(date.Year()) { daysInYear++ } if dayNumber < 0 || dayNumber > daysInYear { return date, errors.New("Given day number if out of range. Returned unchanged date.") } return AddDays(FirstDayOfYear(date), dayNumber), nil } func SetDayOfMonth(date time.Time, dayMonthNumber int) (time.Time, error) { daysInMonth := GetDaysInMonth(date) if dayMonthNumber > daysInMonth { return time.Time{}, errors.New("Passed days count is bigger than the days count in the month of the passed date") } return time.Date(date.Year(), date.Month(), dayMonthNumber, date.Hour(), date.Minute(), date.Second(), date.Nanosecond(), date.Location()), nil } /*********************** *** Weekday Helpers *** ***********************/ func IsWeekend(date time.Time) bool { return date.Weekday() == time.Saturday || date.Weekday() == time.Sunday } func IsMonToFri(date time.Time) bool { weekday := date.Weekday() return weekday == time.Monday || weekday == time.Tuesday || weekday == time.Wednesday || weekday == time.Thursday || weekday == time.Friday } /******************** *** Week Helpers *** ********************/ func EndOfWeek(date time.Time) time.Time { weekday := date.Weekday() // 0 == Sunday if weekday == 0 { return EndOfDay(date) } weekDiff := 7 - weekday return EndOfDay(AddDays(date, int(weekDiff))) } func StartOfWeek(date time.Time) time.Time { return StartOfDay(AddDays(EndOfWeek(date), -7)) } func IsSameWeek(dateOne, dateTwo time.Time) bool { weekOne := EndOfWeek(dateOne) weekTwo := EndOfWeek(dateTwo) return IsSameDay(weekOne, weekTwo) } func IsThisWeek(date time.Time) bool { return IsSameWeek(date, time.Now()) } func AddWeeks(date time.Time, amount int) time.Time { return AddDays(date, 7*amount) } func DifferenceInWeeks(endDate, startDate time.Time) int { return DifferenceInDays(endDate, startDate) / 7 } /********************* *** Month Helpers *** *********************/ func IsSameMonth(dateOne, dateTwo time.Time) bool { return dateOne.Year() == dateTwo.Year() && dateOne.Month() == dateTwo.Month() } func AddMonths(date time.Time, amount int) time.Time { years := amount / 12 leftOverMonths := amount % 12 dateToReturn := time.Date( date.Year()+years, date.Month()+time.Month(leftOverMonths), date.Day(), date.Hour(), date.Minute(), date.Second(), date.Nanosecond(), date.Location()) return dateToReturn } func GetDaysInMonth(date time.Time) int { if IsLeapYear(date.Year()) && time.February == date.Month() { return 29 } if time.February == date.Month() { return 28 } month := date.Month() if time.January == month || time.March == month || time.May == month || time.July == month || time.August == month || time.October == month || time.December == month { return 31 } return 30 } func EndOfMonth(date time.Time) time.Time { monthDays := GetDaysInMonth(date) dateToReturn, _ := SetDayOfMonth(date, monthDays) return time.Date(dateToReturn.Year(), dateToReturn.Month(), dateToReturn.Day(), 23, 59, 59, 999999999, dateToReturn.Location()) } func IsFirstDayOfMonth(date time.Time) bool { return date.Day() == 1 } func IsLastDayOfMonth(date time.Time) bool { daysIsMonth := GetDaysInMonth(date) return daysIsMonth == date.Day() } func IsThisMonth(date time.Time) bool { return IsSameMonth(date, time.Now()) } func StartOfMonth(date time.Time) time.Time { return time.Date(date.Year(), date.Month(), 1, 0, 0, 0, 0, date.Location()) } /*********************** *** Quarter Helpers *** ***********************/ func AddQuarters(date time.Time, amount int) time.Time { return AddMonths(date, amount*3) } func IsFirstQuarter(date time.Time) bool { return time.January == date.Month() || time.February == date.Month() || time.March == date.Month() } func IsSecondQuarter(date time.Time) bool { return time.April == date.Month() || time.May == date.Month() || time.June == date.Month() } func IsThirdQuarter(date time.Time) bool { return time.July == date.Month() || time.August == date.Month() || time.September == date.Month() } func IsFourthQuarter(date time.Time) bool { return time.October == date.Month() || time.November == date.Month() || time.December == date.Month() } func EndOfQuarter(date time.Time) time.Time { if IsFirstQuarter(date) { return time.Date(date.Year(), time.March, 31, 23, 59, 59, 999999999, date.Location()) } if IsSecondQuarter(date) { return time.Date(date.Year(), time.June, 31, 23, 59, 59, 999999999, date.Location()) } if IsFirstQuarter(date) { return time.Date(date.Year(), time.September, 31, 23, 59, 59, 999999999, date.Location()) } return time.Date(date.Year(), time.December, 31, 23, 59, 59, 999999999, date.Location()) } func StartOfQuarter(date time.Time) time.Time { if IsFirstQuarter(date) { return time.Date(date.Year(), time.January, 1, 0, 0, 0, 0, date.Location()) } if IsSecondQuarter(date) { return time.Date(date.Year(), time.April, 1, 0, 0, 0, 0, date.Location()) } if IsFirstQuarter(date) { return time.Date(date.Year(), time.July, 1, 0, 0, 0, 0, date.Location()) } return time.Date(date.Year(), time.October, 1, 0, 0, 0, 0, date.Location()) } func GetQuarter(date time.Time) int { if IsFirstQuarter(date) { return 1 } if IsSecondQuarter(date) { return 2 } if IsFirstQuarter(date) { return 3 } return 4 } func IsSameQuarter(dateOne, dateTwo time.Time) bool { if dateOne.Year() != dateTwo.Year() { return false } return EndOfQuarter(dateOne) == EndOfQuarter(dateTwo) } func IsThisQuarter(date time.Time) bool { return IsSameQuarter(date, time.Now()) } /******************** *** Year Helpers *** ********************/ func IsLeapYear(year int) bool { if year%4 != 0 { return false } else if year%400 == 0 { return true } else if year%100 == 0 { return false } else { return true } } func AddYears(date time.Time, amount int) time.Time { return time.Date(date.Year()+amount, date.Month(), date.Day(), date.Hour(), date.Minute(), date.Second(), date.Nanosecond(), date.Location()) } func SetYear(date time.Time, year int) time.Time { return time.Date(year, date.Month(), date.Day(), date.Hour(), date.Minute(), date.Second(), date.Nanosecond(), date.Location()) } func EndOfYear(date time.Time) time.Time { return time.Date(date.Year(), time.December, 31, 23, 59, 59, 999999999, date.Location()) } func StartOfYear(date time.Time) time.Time { return time.Date(date.Year(), time.January, 1, 0, 0, 0, 0, date.Location()) } func IsSameYear(dateOne, dateTwo time.Time) bool { return dateOne.Year() == dateTwo.Year() } func IsThisYear(date time.Time) bool { return IsSameYear(date, time.Now()) }
thl.go
0.766381
0.412619
thl.go
starcoder
package bitarray import ( "math/bits" ) // Reverse returns the bit array with its bits in reversed order. func (ba *BitArray) Reverse() *BitArray { switch { case ba.IsZero(): return zeroBitArray case ba.Len() == 1, ba.b == nil: return ba } buf := make([]byte, len(ba.b)) for i, o := range ba.b { buf[len(ba.b)-1-i] = bits.Reverse8(o) } return NewFromBytes(buf, ba.NumPadding(), ba.nBits) } // ShiftLeft returns the bit array of shifted left by k bits. // To shift to right, call ShiftLeft(-k). func (ba *BitArray) ShiftLeft(k int) *BitArray { switch { case ba.IsZero(): return zeroBitArray case ba.b == nil: return ba case ba.nBits <= k, ba.nBits <= -k: return &BitArray{nBits: ba.nBits} case 0 < k: return ba.shiftLeft(k) case k < 0: return ba.shiftRight(-k) } return ba } func (ba *BitArray) shiftLeft(k int) *BitArray { if k&7 == 0 { buf := allocByteSlice(len(ba.b)) copy(buf, ba.b[k>>3:]) return &BitArray{b: buf, nBits: ba.nBits} } return ba.Slice(k, ba.nBits).append1(&BitArray{nBits: k}) } func (ba *BitArray) shiftRight(k int) *BitArray { if k&7 == 0 { buf := allocByteSlice(len(ba.b)) copy(buf[k>>3:], ba.b) if npad := ba.NumPadding(); npad != 0 { mask := byte(0xff) << npad buf[len(buf)-1] &= mask } return &BitArray{b: buf, nBits: ba.nBits} } return (&BitArray{nBits: k}).append1(ba.Slice(0, ba.nBits-k)) } // RotateLeft returns the bit array of rotated left by k bits. // To rotate to right, call RotateLeft(-k). func (ba *BitArray) RotateLeft(k int) *BitArray { switch { case ba.IsZero(): return zeroBitArray case ba.b == nil: return ba case 0 < k: return ba.rotateLeft(k) case k < 0: return ba.rotateRight(-k) } return ba } func (ba *BitArray) rotateLeft(k int) *BitArray { k %= ba.nBits switch { case k == 0: return ba case k&7 == 0 && ba.nBits&7 == 0: buf := allocByteSlice(len(ba.b)) nbs := k >> 3 copy(buf, ba.b[nbs:]) copy(buf[len(buf)-nbs:], ba.b) return &BitArray{b: buf, nBits: ba.nBits} } return ba.Slice(k, ba.nBits).append1(ba.Slice(0, k)) } func (ba *BitArray) rotateRight(k int) *BitArray { k %= ba.nBits switch { case k == 0: return ba case k&7 == 0 && ba.nBits&7 == 0: buf := allocByteSlice(len(ba.b)) nbs := k >> 3 copy(buf[nbs:], ba.b) copy(buf, ba.b[len(ba.b)-nbs:]) return &BitArray{b: buf, nBits: ba.nBits} } return ba.Slice(ba.nBits-k, ba.nBits).append1(ba.Slice(0, ba.nBits-k)) }
bitarray_shift.go
0.822724
0.568476
bitarray_shift.go
starcoder
package main import ( "fmt" "./fakeassembly" ) func main() { input1 := fakeassembly.ReadInputToStruct("input.txt") // input := parse.ReadInputToStruct("example.txt") // alternately, test on example code sum1, _ := getSum(input1) fmt.Println("1. Sum:", sum1) // Reading in again because we've mutated the original input: input2 := fakeassembly.ReadInputToStruct("input.txt") sum2 := tryComboUntilValid(input2) fmt.Println("2. Sum:", sum2) } func tryComboUntilValid(input []fakeassembly.InstructionBlock) int { len := len(input) for i := 0; i < len; i++ { // 1. Create a copy of the slice modifiedInput := make([]fakeassembly.InstructionBlock, len) copy(modifiedInput, input) // 2. Modify the instruction on line i: switch input[i].C { case fakeassembly.JMP: modifiedInput[i].C = fakeassembly.NOP case fakeassembly.NOP: modifiedInput[i].C = fakeassembly.JMP } // 3. getSum and see if we have a clean exit: sum, infiniteLoop := getSum(modifiedInput) if !infiniteLoop { return sum } } return 0 } func getSum(input []fakeassembly.InstructionBlock) (int, bool) { sum := 0 i := 0 infiniteLoop := false len := len(input) for { if i == len { break } if i > len { panic("We went too far!") } ib := &input[i] if ib.Exec == true { infiniteLoop = true break } ib.Exec = true switch ib.C { case fakeassembly.ACC: sum += ib.Val i++ case fakeassembly.JMP: i += ib.Val case fakeassembly.NOP: i++ } } return sum, infiniteLoop } /* --- Day 8: Handheld Halting --- Your flight to the major airline hub reaches cruising altitude without incident. While you consider checking the in-flight menu for one of those drinks that come with a little umbrella, you are interrupted by the kid sitting next to you. Their handheld game console won't turn on! They ask if you can take a look. You narrow the problem down to a strange infinite loop in the boot code (your puzzle input) of the device. You should be able to fix it, but first you need to be able to run the code in isolation. The boot code is represented as a text file with one instruction per line of text. Each instruction consists of an operation (acc, jmp, or nop) and an argument (a signed number like +4 or -20). acc increases or decreases a single global value called the accumulator by the value given in the argument. For example, acc +7 would increase the accumulator by 7. The accumulator starts at 0. After an acc instruction, the instruction immediately below it is executed next. jmp jumps to a new instruction relative to itself. The next instruction to execute is found using the argument as an offset from the jmp instruction; for example, jmp +2 would skip the next instruction, jmp +1 would continue to the instruction immediately below it, and jmp -20 would cause the instruction 20 lines above to be executed next. nop stands for No OPeration - it does nothing. The instruction immediately below it is executed next. For example, consider the following program: nop +0 acc +1 jmp +4 acc +3 jmp -3 acc -99 acc +1 jmp -4 acc +6 These instructions are visited in this order: nop +0 | 1 acc +1 | 2, 8(!) jmp +4 | 3 acc +3 | 6 jmp -3 | 7 acc -99 | acc +1 | 4 jmp -4 | 5 acc +6 | First, the nop +0 does nothing. Then, the accumulator is increased from 0 to 1 (acc +1) and jmp +4 sets the next instruction to the other acc +1 near the bottom. After it increases the accumulator from 1 to 2, jmp -4 executes, setting the next instruction to the only acc +3. It sets the accumulator to 5, and jmp -3 causes the program to continue back at the first acc +1. This is an infinite loop: with this sequence of jumps, the program will run forever. The moment the program tries to run any instruction a second time, you know it will never terminate. Immediately before the program would run an instruction a second time, the value in the accumulator is 5. Run your copy of the boot code. Immediately before any instruction is executed a second time, what value is in the accumulator? Your puzzle answer was 1915. --- Part Two --- After some careful analysis, you believe that exactly one instruction is corrupted. Somewhere in the program, either a jmp is supposed to be a nop, or a nop is supposed to be a jmp. (No acc instructions were harmed in the corruption of this boot code.) The program is supposed to terminate by attempting to execute an instruction immediately after the last instruction in the file. By changing exactly one jmp or nop, you can repair the boot code and make it terminate correctly. For example, consider the same program from above: nop +0 acc +1 jmp +4 acc +3 jmp -3 acc -99 acc +1 jmp -4 acc +6 If you change the first instruction from nop +0 to jmp +0, it would create a single-instruction infinite loop, never leaving that instruction. If you change almost any of the jmp instructions, the program will still eventually find another jmp instruction and loop forever. However, if you change the second-to-last instruction (from jmp -4 to nop -4), the program terminates! The instructions are visited in this order: nop +0 | 1 acc +1 | 2 jmp +4 | 3 acc +3 | jmp -3 | acc -99 | acc +1 | 4 nop -4 | 5 acc +6 | 6 After the last instruction (acc +6), the program terminates by attempting to run the instruction below the last instruction in the file. With this change, after the program terminates, the accumulator contains the value 8 (acc +1, acc +1, acc +6). Fix the program so that it terminates normally by changing exactly one jmp (to nop) or nop (to jmp). What is the value of the accumulator after the program terminates? */
day8/main.go
0.613584
0.50769
main.go
starcoder
package refconv import ( "fmt" "math" "reflect" "strconv" "github.com/cstockton/go-conv/internal/refutil" ) var ( mathMaxInt int64 mathMinInt int64 mathMaxUint uint64 mathIntSize = strconv.IntSize ) func initIntSizes(size int) { switch size { case 64: mathMaxInt = math.MaxInt64 mathMinInt = math.MinInt64 mathMaxUint = math.MaxUint64 case 32: mathMaxInt = math.MaxInt32 mathMinInt = math.MinInt32 mathMaxUint = math.MaxUint32 } } func init() { // this is so it can be unit tested. initIntSizes(mathIntSize) } func (c Conv) convStrToInt64(v string) (int64, error) { if parsed, err := strconv.ParseInt(v, 10, 0); err == nil { return parsed, nil } if parsed, err := strconv.ParseFloat(v, 64); err == nil { return int64(parsed), nil } if parsed, err := c.convStrToBool(v); err == nil { if parsed { return 1, nil } return 0, nil } return 0, fmt.Errorf("cannot convert %#v (type string) to int64", v) } type intConverter interface { Int64() (int64, error) } // Int64 attempts to convert the given value to int64, returns the zero value // and an error on failure. func (c Conv) Int64(from interface{}) (int64, error) { if T, ok := from.(string); ok { return c.convStrToInt64(T) } else if T, ok := from.(int64); ok { return T, nil } if c, ok := from.(intConverter); ok { return c.Int64() } value := refutil.IndirectVal(reflect.ValueOf(from)) kind := value.Kind() switch { case reflect.String == kind: return c.convStrToInt64(value.String()) case refutil.IsKindInt(kind): return value.Int(), nil case refutil.IsKindUint(kind): val := value.Uint() if val > math.MaxInt64 { val = math.MaxInt64 } return int64(val), nil case refutil.IsKindFloat(kind): return int64(value.Float()), nil case refutil.IsKindComplex(kind): return int64(real(value.Complex())), nil case reflect.Bool == kind: if value.Bool() { return 1, nil } return 0, nil case refutil.IsKindLength(kind): return int64(value.Len()), nil } return 0, newConvErr(from, "int64") } // Int attempts to convert the given value to int, returns the zero value and an // error on failure. func (c Conv) Int(from interface{}) (int, error) { if T, ok := from.(int); ok { return T, nil } to64, err := c.Int64(from) if err != nil { return 0, newConvErr(from, "int") } if to64 > mathMaxInt { to64 = mathMaxInt // only possible on 32bit arch } else if to64 < mathMinInt { to64 = mathMinInt // only possible on 32bit arch } return int(to64), nil } // Int8 attempts to convert the given value to int8, returns the zero value and // an error on failure. func (c Conv) Int8(from interface{}) (int8, error) { if T, ok := from.(int8); ok { return T, nil } to64, err := c.Int64(from) if err != nil { return 0, newConvErr(from, "int8") } if to64 > math.MaxInt8 { to64 = math.MaxInt8 } else if to64 < math.MinInt8 { to64 = math.MinInt8 } return int8(to64), nil } // Int16 attempts to convert the given value to int16, returns the zero value // and an error on failure. func (c Conv) Int16(from interface{}) (int16, error) { if T, ok := from.(int16); ok { return T, nil } to64, err := c.Int64(from) if err != nil { return 0, newConvErr(from, "int16") } if to64 > math.MaxInt16 { to64 = math.MaxInt16 } else if to64 < math.MinInt16 { to64 = math.MinInt16 } return int16(to64), nil } // Int32 attempts to convert the given value to int32, returns the zero value // and an error on failure. func (c Conv) Int32(from interface{}) (int32, error) { if T, ok := from.(int32); ok { return T, nil } to64, err := c.Int64(from) if err != nil { return 0, newConvErr(from, "int32") } if to64 > math.MaxInt32 { to64 = math.MaxInt32 } else if to64 < math.MinInt32 { to64 = math.MinInt32 } return int32(to64), nil }
vendor/github.com/cstockton/go-conv/internal/refconv/int.go
0.67822
0.442757
int.go
starcoder
package clientbrownfield import ( "encoding/json" "fmt" "testing" "github.com/ingrammicro/cio/api/types" "github.com/ingrammicro/cio/utils" "github.com/stretchr/testify/assert" ) // ImportServersMocked test mocked function func ImportServersMocked(t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportServers test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportServers, cloudAccountID), mapIn). Return(dOut, 200, nil) cloudAccountOut, err := ds.ImportServers(cloudAccountID, mapIn) assert.Nil(err, "Error importing servers for cloud account") assert.Equal(cloudAccountIn, cloudAccountOut, "ImportServers returned different cloud account") return cloudAccountOut } // ImportServersFailErrMocked test mocked function func ImportServersFailErrMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportServers test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportServers, cloudAccountID), mapIn). Return(dOut, 200, fmt.Errorf("mocked error")) cloudAccountOut, err := ds.ImportServers(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting an error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Equal(err.Error(), "mocked error", "Error should be 'mocked error'") return cloudAccountOut } // ImportServersFailStatusMocked test mocked function func ImportServersFailStatusMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportServers test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportServers, cloudAccountID), mapIn). Return(dOut, 499, nil) cloudAccountOut, err := ds.ImportServers(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting an status code error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Contains(err.Error(), "499", "Error should contain http code 499") return cloudAccountOut } // ImportServersFailJSONMocked test mocked function func ImportServersFailJSONMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // wrong json dIn := []byte{10, 20, 30} // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportServers, cloudAccountID), mapIn). Return(dIn, 200, nil) cloudAccountOut, err := ds.ImportServers(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting a marshalling error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Contains(err.Error(), "invalid character", "Error message should include the string 'invalid character'") return cloudAccountOut } // ImportVPCsMocked test mocked function func ImportVPCsMocked(t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportVPCs test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportVpcs, cloudAccountID), mapIn).Return(dOut, 200, nil) cloudAccountOut, err := ds.ImportVPCs(cloudAccountID, mapIn) assert.Nil(err, "Error importing VPCs for cloud account") assert.Equal(cloudAccountIn, cloudAccountOut, "ImportVPCs returned different cloud account") return cloudAccountOut } // ImportVPCsFailErrMocked test mocked function func ImportVPCsFailErrMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportVPCs test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportVpcs, cloudAccountID), mapIn). Return(dOut, 200, fmt.Errorf("mocked error")) cloudAccountOut, err := ds.ImportVPCs(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting an error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Equal(err.Error(), "mocked error", "Error should be 'mocked error'") return cloudAccountOut } // ImportVPCsFailStatusMocked test mocked function func ImportVPCsFailStatusMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportVPCs test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportVpcs, cloudAccountID), mapIn).Return(dOut, 499, nil) cloudAccountOut, err := ds.ImportVPCs(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting an status code error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Contains(err.Error(), "499", "Error should contain http code 499") return cloudAccountOut } // ImportVPCsFailJSONMocked test mocked function func ImportVPCsFailJSONMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // wrong json dIn := []byte{10, 20, 30} // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportVpcs, cloudAccountID), mapIn).Return(dIn, 200, nil) cloudAccountOut, err := ds.ImportVPCs(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting a marshalling error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Contains(err.Error(), "invalid character", "Error message should include the string 'invalid character'") return cloudAccountOut } // ImportFloatingIPsMocked test mocked function func ImportFloatingIPsMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportFloatingIPs test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportFloatingIPs, cloudAccountID), mapIn). Return(dOut, 200, nil) cloudAccountOut, err := ds.ImportFloatingIPs(cloudAccountID, mapIn) assert.Nil(err, "Error importing floating IPs for cloud account") assert.Equal(cloudAccountIn, cloudAccountOut, "ImportFloatingIPs returned different cloud account") return cloudAccountOut } // ImportFloatingIPsFailErrMocked test mocked function func ImportFloatingIPsFailErrMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportFloatingIPs test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportFloatingIPs, cloudAccountID), mapIn). Return(dOut, 200, fmt.Errorf("mocked error")) cloudAccountOut, err := ds.ImportFloatingIPs(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting an error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Equal(err.Error(), "mocked error", "Error should be 'mocked error'") return cloudAccountOut } // ImportFloatingIPsFailStatusMocked test mocked function func ImportFloatingIPsFailStatusMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportFloatingIPs test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportFloatingIPs, cloudAccountID), mapIn). Return(dOut, 499, nil) cloudAccountOut, err := ds.ImportFloatingIPs(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting an status code error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Contains(err.Error(), "499", "Error should contain http code 499") return cloudAccountOut } // ImportFloatingIPsFailJSONMocked test mocked function func ImportFloatingIPsFailJSONMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // wrong json dIn := []byte{10, 20, 30} // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportFloatingIPs, cloudAccountID), mapIn). Return(dIn, 200, nil) cloudAccountOut, err := ds.ImportFloatingIPs(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting a marshalling error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Contains(err.Error(), "invalid character", "Error message should include the string 'invalid character'") return cloudAccountOut } // ImportVolumesMocked test mocked function func ImportVolumesMocked(t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportVolumes test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportVolumes, cloudAccountID), mapIn). Return(dOut, 200, nil) cloudAccountOut, err := ds.ImportVolumes(cloudAccountID, mapIn) assert.Nil(err, "Error importing volumes for cloud account") assert.Equal(cloudAccountIn, cloudAccountOut, "ImportVolumes returned different cloud account") return cloudAccountOut } // ImportVolumesFailErrMocked test mocked function func ImportVolumesFailErrMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportVolumes test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportVolumes, cloudAccountID), mapIn). Return(dOut, 200, fmt.Errorf("mocked error")) cloudAccountOut, err := ds.ImportVolumes(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting an error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Equal(err.Error(), "mocked error", "Error should be 'mocked error'") return cloudAccountOut } // ImportVolumesFailStatusMocked test mocked function func ImportVolumesFailStatusMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportVolumes test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportVolumes, cloudAccountID), mapIn). Return(dOut, 499, nil) cloudAccountOut, err := ds.ImportVolumes(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting an status code error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Contains(err.Error(), "499", "Error should contain http code 499") return cloudAccountOut } // ImportVolumesFailJSONMocked test mocked function func ImportVolumesFailJSONMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // wrong json dIn := []byte{10, 20, 30} // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportVolumes, cloudAccountID), mapIn). Return(dIn, 200, nil) cloudAccountOut, err := ds.ImportVolumes(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting a marshalling error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Contains(err.Error(), "invalid character", "Error message should include the string 'invalid character'") return cloudAccountOut } // ImportKubernetesClustersMocked test mocked function func ImportKubernetesClustersMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportKubernetesClusters test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportKubernetesClusters, cloudAccountID), mapIn). Return(dOut, 200, nil) cloudAccountOut, err := ds.ImportKubernetesClusters(cloudAccountID, mapIn) assert.Nil(err, "Error importing kubernetes clusters for cloud account") assert.Equal(cloudAccountIn, cloudAccountOut, "ImportKubernetesClusters returned different cloud account") return cloudAccountOut } // ImportKubernetesClustersFailErrMocked test mocked function func ImportKubernetesClustersFailErrMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportKubernetesClusters test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportKubernetesClusters, cloudAccountID), mapIn). Return(dOut, 200, fmt.Errorf("mocked error")) cloudAccountOut, err := ds.ImportKubernetesClusters(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting an error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Equal(err.Error(), "mocked error", "Error should be 'mocked error'") return cloudAccountOut } // ImportKubernetesClustersFailStatusMocked test mocked function func ImportKubernetesClustersFailStatusMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportKubernetesClusters test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportKubernetesClusters, cloudAccountID), mapIn). Return(dOut, 499, nil) cloudAccountOut, err := ds.ImportKubernetesClusters(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting an status code error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Contains(err.Error(), "499", "Error should contain http code 499") return cloudAccountOut } // ImportKubernetesClustersFailJSONMocked test mocked function func ImportKubernetesClustersFailJSONMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // wrong json dIn := []byte{10, 20, 30} // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportKubernetesClusters, cloudAccountID), mapIn). Return(dIn, 200, nil) cloudAccountOut, err := ds.ImportKubernetesClusters(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting a marshalling error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Contains(err.Error(), "invalid character", "Error message should include the string 'invalid character'") return cloudAccountOut } // ImportPoliciesMocked test mocked function func ImportPoliciesMocked(t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportPolicies test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportPolicies, cloudAccountID), mapIn). Return(dOut, 200, nil) cloudAccountOut, err := ds.ImportPolicies(cloudAccountID, mapIn) assert.Nil(err, "Error importing policies for cloud account") assert.Equal(cloudAccountIn, cloudAccountOut, "ImportPolicies returned different cloud account") return cloudAccountOut } // ImportPoliciesFailErrMocked test mocked function func ImportPoliciesFailErrMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportPolicies test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportPolicies, cloudAccountID), mapIn). Return(dOut, 200, fmt.Errorf("mocked error")) cloudAccountOut, err := ds.ImportPolicies(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting an error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Equal(err.Error(), "mocked error", "Error should be 'mocked error'") return cloudAccountOut } // ImportPoliciesFailStatusMocked test mocked function func ImportPoliciesFailStatusMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // to json dOut, err := json.Marshal(cloudAccountIn) assert.Nil(err, "ImportPolicies test data corrupted") // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportPolicies, cloudAccountID), mapIn). Return(dOut, 499, nil) cloudAccountOut, err := ds.ImportPolicies(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting an status code error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Contains(err.Error(), "499", "Error should contain http code 499") return cloudAccountOut } // ImportPoliciesFailJSONMocked test mocked function func ImportPoliciesFailJSONMocked( t *testing.T, cloudAccountIn *types.CloudAccount, cloudAccountID string, ) *types.CloudAccount { assert := assert.New(t) // wire up cs := &utils.MockConcertoService{} ds, err := NewImportService(cs) assert.Nil(err, "Couldn't load Import service") assert.NotNil(ds, "Import service not instanced") mapIn := new(map[string]interface{}) // wrong json dIn := []byte{10, 20, 30} // call service cs.On("Put", fmt.Sprintf(APIPathBlueprintCloudAccountImportPolicies, cloudAccountID), mapIn). Return(dIn, 200, nil) cloudAccountOut, err := ds.ImportPolicies(cloudAccountID, mapIn) assert.NotNil(err, "We are expecting a marshalling error") assert.Nil(cloudAccountOut, "Expecting nil output") assert.Contains(err.Error(), "invalid character", "Error message should include the string 'invalid character'") return cloudAccountOut }
api/clientbrownfield/import_api_mocked.go
0.696578
0.444625
import_api_mocked.go
starcoder
// This package contains a new set of interfacs for hash functions. // It also implements the Go streaming hash interface as HashStream. // It is an experiment. package nhash import ( "io" ) // Interface HashFunction requires 4 methods that return the // size of the hasg function in bytes and bits. Probably wiil // flush bits. Also the maximum number of bytes of seed needed. type HashFunction interface { // Size returns the number of bytes Sum will return. Size() int // BlockSize returns the hash's underlying block size. // The Write method must be able to accept any amount // of data, but it may operate more efficiently if all writes // are a multiple of the block size. BlockSize() int // maximum number of seeds in bytes (should this be in bits?) NumSeedBytes() int // retunrs the number of bits the hash function outputs //HashSizeInBits() int } // HashStream is a streaming interface for hash functions. type HashStream interface { HashFunction // Write (via the embedded io.Writer interface) adds more data to the running hash. // It never returns an error. io.Writer // Sum appends the current hash to b and returns the resulting slice. // It does not change the underlying hash state. Sum(b []byte) []byte // Reset resets the Hash to its initial state. Reset() } // Hash32 is a common interface implemented by the streaming 32-bit hash functions. type Hash32 interface { HashStream Sum32() uint32 } // Hash64 is a common interface implemented by the streaming 32-bit hash functions. type Hash64 interface { HashStream Write64(h uint64) error Sum64() uint64 } // *** Everything below here will be removed or chnaged as vargs was way too expensive. *** // HashF32 is the interface that all non-streaming 32 bit hash functions implement. type HashF32 interface { HashFunction Hash32(b []byte, seeds ...uint32) uint32 } // HashF64 is the interface that all non-streaming 64 bit hash functions implement. type HashF64 interface { HashFunction Hash64(b []byte, seeds ...uint64) uint64 Hash64S(b []byte, seed uint64) uint64 } // HashF128 is the interface that all non-streaming 128 bit hash functions implement. type HashF128 interface { HashFunction Hash128(b []byte, seeds ...uint64) (uint64, uint64) } // HashGeneric is generic interface that non-streaming, typicall crytpo hash functions implement. type HashGeneric interface { HashFunction // Hash takes "in" bytes of input, the hash is returned into byte slice "out" // change seeds to bytes ??? Hash(in []byte, out []byte, seeds ...uint64) []byte }
vendor/github.com/gxed/hashland/nhash/nhash.go
0.63624
0.511656
nhash.go
starcoder
package pool import ( "io" "sync" ) var BS *ByteSlicePool type sliceHeader struct { offset, len int } // ByteSlice 用于存储一维数组,可以区分 空数组和nil type ByteSlice struct { released bool data []byte elems []sliceHeader } func (b *ByteSlice)Grow(dataCap, elemCap int) { dataLen := len(b.data) dataExtend := dataCap - cap(b.data) if dataExtend > 0 { b.data = append(b.data, make([]byte, dataExtend)...) b.data = b.data[:dataLen] } elemLen := len(b.elems) elemExtend := elemCap - cap(b.elems) if elemExtend > 0 { b.elems = append(b.elems, make([]sliceHeader, elemExtend)...) b.elems = b.elems[:elemLen] } } func (b *ByteSlice)Len() int { return len(b.elems) } func (b *ByteSlice)Index(index int) []byte { start := b.elems[index].offset if b.data[start] == '-' { return nil } end := start + b.elems[index].len return b.data[start+1:end] } func (b *ByteSlice)IsNil(index int) bool { return b.Index(index) == nil } func (b *ByteSlice)CopyTo(index int, buf []byte) []byte { if b.IsNil(index) { return nil } start := b.elems[index].offset end := start + b.elems[index].len buf = append(buf, b.data[start+1:end]...) return buf } func (b *ByteSlice)Reset() { if len(b.data) > 0 { b.data = b.data[:0] } if len(b.elems) > 0 { b.elems = b.elems[:0] } } // AppendConcat 将所有参数拼接成1个数据块 func (b *ByteSlice)AppendConcat(bs ...[]byte) *ByteSlice{ used := len(b.data) b.data = append(b.data, '+') allNil := true length := 0 for _, bts := range bs { if bts == nil { continue } allNil = false length = length + len(bts) b.data = append(b.data, bts...) } if allNil { b.data[used] = '-' } b.elems = append(b.elems, sliceHeader{ used, length+1 }) return b } func (b *ByteSlice)AppendFromReaderN(rd io.Reader, expect int) (n int, err error) { used := len(b.data) b.data = append(b.data, make([]byte, expect+1)...) n, err = io.ReadFull(rd, b.data[used+1:]) if err != nil { b.data = b.data[:used] return n, err } b.data[used] = '+' b.elems = append(b.elems, sliceHeader{ used, expect+1 }) return n, err } func (b *ByteSlice)Append(bs ...[]byte) *ByteSlice { for _, bts := range bs { used := len(b.data) if bts == nil { b.data = append(b.data, '-') } else { b.data = append(b.data, '+') } b.data = append(b.data, bts...) b.elems = append(b.elems, sliceHeader{ used, len(bts)+1 }) } return b } func (b *ByteSlice)ToBytes(bs [][]byte) [][]byte { for i, h := range b.elems { if b.IsNil(i) { bs = append(bs, nil) } else { bs = append(bs, b.data[h.offset+1:h.offset+h.len]) } } return bs } func (b *ByteSlice)Release() { if b.released { panic("bug! release a released object") } b.released = true b.Reset() BS.pool.Put(b) } type ByteSlicePool struct { pool *sync.Pool } func (p *ByteSlicePool)Get() *ByteSlice { bs := p.pool.Get().(*ByteSlice) bs.released = false return bs }
pool/byteslice.go
0.517571
0.498535
byteslice.go
starcoder
package collection // Deque is a generic double-ended queue based on a double-linked list. The // zero value is can be used without any further initialization. The // implementation is heavily inspired by the standard container/list package. type Deque[T any] struct { root element[T] len int } // Len returns the number of elements. func (d *Deque[T]) Len() int { return d.len } // Clear removes all elements. func (d *Deque[T]) Clear() { d.root.next = &d.root d.root.prev = &d.root d.len = 0 } // Front returns the first element or false if the queue is empty. func (d *Deque[T]) Front() (value T, ok bool) { if d.len == 0 { return value, false } return d.root.next.value, true } // Back returns the last element or false if the queue is empty. func (d *Deque[T]) Back() (value T, ok bool) { if d.len == 0 { return value, false } return d.root.prev.value, true } // PushFront insert an element in the beginning of the queue. func (d *Deque[T]) PushFront(v T) { d.lazyInit() d.insertValue(v, &d.root) } // PushBack appends an element to end of the queue. func (d *Deque[T]) PushBack(v T) { d.lazyInit() d.insertValue(v, d.root.prev) } // PopFront removes and returns the first element in the queue or false if the // queue is empty. func (d *Deque[T]) PopFront() (value T, ok bool) { if d.len == 0 { return value, false } value = d.root.next.value d.remove(d.root.next) return value, true } // PopBack removes and returns the last element in the queue or false if the // queue is empty. func (d *Deque[T]) PopBack() (value T, ok bool) { if d.len == 0 { return value, false } value = d.root.prev.value d.remove(d.root.prev) return value, true } func (d *Deque[T]) lazyInit() { if d.root.next == nil { d.Clear() } } func (d *Deque[T]) insert(e, at *element[T]) { e.prev = at e.next = at.next e.prev.next = e e.next.prev = e d.len++ } func (d *Deque[T]) insertValue(v T, at *element[T]) { d.insert(&element[T]{value: v}, at) } func (d *Deque[T]) remove(e *element[T]) { e.prev.next = e.next e.next.prev = e.prev e.next = nil // avoid memory leaks e.prev = nil // avoid memory leaks d.len-- } type element[T any] struct { prev *element[T] next *element[T] value T }
deque.go
0.797557
0.478651
deque.go
starcoder
package math import ( "math" "math/rand" "time" ) // Standard math package for most common mathematical operations type i interface{} func init() { rand.Seed(time.Hour.Milliseconds()) } /* func sin(num float64) float64 */ func Sin(num float64) (val i, err error) { return math.Sin(num), err } /* func cos(num float64) float64 */ func Cos(num float64) (val i, err error) { return math.Cos(num), err } /* func asin(num float64) float64 */ func Asin(num float64) (val i, err error) { return math.Asin(num), err } /* func acos(num float64) float64 */ func Acos(num float64) (val i, err error) { return math.Acos(num), err } /* func tan(num float64) float64 */ func Tan(num float64) (val i, err error) { return math.Tan(num), err } /* func atan(num float64) float64 */ func Atan(num float64) (val i, err error) { return math.Atan(num), err } /* func floor(num float64) float64 */ func Floor(num float64) (val i, err error) { return math.Floor(num), err } /* func ceil(num float64) float64 */ func Ceil(num float64) (val i, err error) { return math.Ceil(num), err } /* func abs(num float64) float64 */ func Abs(num float64) (val i, err error) { return math.Abs(num), err } /* func ln(num float64) float64 */ func Ln(num float64) (val i, err error) { return math.Log(num), err } /* func log10(num float64) float64 */ func Log10(num float64) (val i, err error) { return math.Log10(num), err } /* func sqrt(num float64) float64 */ func Sqrt(num float64) (val i, err error) { return math.Sqrt(num), err } /* func max(a float64, b float64) float64 */ func Max(a float64, b float64) (val i, err error) { return math.Max(a, b), err } /* func min(a float64, b float64) float64 */ func Min(a float64, b float64) (val i, err error) { return math.Min(a, b), err } /* Converts degrees to radians func rad(deg float64) float64 */ func Rad(num float64) (val i, err error) { return (math.Pi * 2 * num) / 360, err } /* Converts radians to degrees func deg(rad float64) float64 */ func Deg(num float64) (val i, err error) { return (num * 360) / (2 * math.Pi), err } /* Gets random number bewteen 0 and 1 func random() float64 */ func Random() (val i, err error) { return rand.Float64(), err }
lib/math/math.go
0.66628
0.452657
math.go
starcoder
package vm import ( "fmt" "reflect" "strconv" ) var hexdigits = []byte("0123456789ABCDEF") func escapeUri(thing []byte) []byte { ret := make([]byte, 0, len(thing)) for _, v := range thing { if !shouldEscapeUri(v) { ret = append(ret, v) } else { ret = append(ret, '%') ret = append(ret, hexdigits[v&0xf0>>4]) ret = append(ret, hexdigits[v&0x0f]) } } return ret } func escapeUriString(thing string) string { return string(escapeUri([]byte(thing))) } func shouldEscapeUri(v byte) bool { switch v { case 0x2D, 0x2E, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5F, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69: return false default: return true } } func isInterfaceStringType(v interface{}) bool { t := reflect.TypeOf(v) switch t.Kind() { case reflect.String: return true case reflect.Array, reflect.Slice: return t.Elem().Kind() == reflect.Uint8 } return false } func isInterfaceNumeric(v interface{}) bool { switch reflect.TypeOf(v).Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64: return true } return false } func interfaceToNumeric(v interface{}) reflect.Value { if isInterfaceNumeric(v) { return reflect.ValueOf(v) } return reflect.ValueOf(0) } // Given possibly non-matched pair of things to perform arithmetic // operations on, align their types so that the given operation // can be performed correctly. // e.g. given int, float, we align them to float, float func alignTypesForArithmetic(left, right interface{}) (reflect.Value, reflect.Value) { // These avoid crashes for accessing nil interfaces if left == nil { left = 0 } if right == nil { right = 0 } leftV := interfaceToNumeric(left) rightV := interfaceToNumeric(right) if leftV.Kind() == rightV.Kind() { return leftV, rightV } var alignTo reflect.Type if leftV.Kind() > rightV.Kind() { alignTo = leftV.Type() } else { alignTo = rightV.Type() } return leftV.Convert(alignTo), rightV.Convert(alignTo) } func interfaceToString(arg interface{}) string { t := reflect.TypeOf(arg) var v string switch t.Kind() { case reflect.String: v = string(reflect.ValueOf(arg).String()) case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: v = strconv.FormatInt(reflect.ValueOf(arg).Int(), 10) case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: v = strconv.FormatUint(reflect.ValueOf(arg).Uint(), 10) case reflect.Float32, reflect.Float64: v = strconv.FormatFloat(reflect.ValueOf(arg).Float(), 'f', -1, 64) case reflect.Bool: if reflect.ValueOf(arg).Bool() { v = "true" } else { v = "false" } default: v = fmt.Sprintf("%s", arg) } return v } func interfaceToBool(arg interface{}) bool { if arg == nil { return false } t := reflect.TypeOf(arg) if t.Kind() == reflect.Bool { return arg.(bool) } z := reflect.Zero(t) return reflect.DeepEqual(z, t) }
vm/util.go
0.677261
0.421552
util.go
starcoder
package p432 import "math" /** Implement a data structure supporting the following operations: Inc(Key) - Inserts a new key with value 1. Or increments an existing key by 1. Key is guaranteed to be a non-empty string. Dec(Key) - If Key's value is 1, remove it from the data structure. Otherwise decrements an existing key by 1. If the key does not exist, this function does nothing. Key is guaranteed to be a non-empty string. GetMaxKey() - Returns one of the keys with maximal value. If no element exists, return an empty string "". GetMinKey() - Returns one of the keys with minimal value. If no element exists, return an empty string "". Challenge: Perform all these in O(1) time complexity. */ type DlinkNode struct { key string val int prev *DlinkNode next *DlinkNode } type AllOne struct { hm map[string]*DlinkNode head *DlinkNode tail *DlinkNode } func swapAdjacent(p, n *DlinkNode) { p.prev.next = n n.next.prev = p n.prev = p.prev p.next = n.next n.next = p p.prev = n } /** Initialize your data structure here. */ func Constructor() AllOne { h := &DlinkNode{val: math.MaxInt32} t := &DlinkNode{val: 0} h.next = t t.prev = h return AllOne{ hm: make(map[string]*DlinkNode), head: h, tail: t, } } func (this *AllOne) insertBeforeTail(node *DlinkNode) { node.next = this.tail node.prev = this.tail.prev node.prev.next = node node.next.prev = node } /** Inserts a new key <Key> with value 1. Or increments an existing key by 1. */ func (this *AllOne) Inc(key string) { v, ok := this.hm[key] if !ok { node := &DlinkNode{val: 1, key: key} this.insertBeforeTail(node) this.hm[key] = node } else { v.val++ for v.val > v.prev.val { p := v.prev swapAdjacent(p, v) } } } /** Decrements an existing key by 1. If Key's value is 1, remove it from the data structure. */ func (this *AllOne) Dec(key string) { v, ok := this.hm[key] if ok { if v.val == 1 { v.next.prev = v.prev v.prev.next = v.next v.prev = nil v.next = nil delete(this.hm, key) } else { v.val-- for v.val < v.next.val { n := v.next swapAdjacent(v, n) } } } } /** Returns one of the keys with maximal value. */ func (this *AllOne) GetMaxKey() string { return this.head.next.key } /** Returns one of the keys with Minimal value. */ func (this *AllOne) GetMinKey() string { return this.tail.prev.key } /** * Your AllOne object will be instantiated and called as such: * obj := Constructor(); * obj.Inc(key); * obj.Dec(key); * param_3 := obj.GetMaxKey(); * param_4 := obj.GetMinKey(); */
algorithms/p432/432.go
0.795698
0.615203
432.go
starcoder
package network /** * Binding class showing the interface that can be bound to channel. */ type Channelinterfacebinding struct { /** * Interfaces to be bound to the LA channel of a Citrix ADC or to the LA channel of a cluster configuration. For an LA channel of a Citrix ADC, specify an interface in C/U notation (for example, 1/3). For an LA channel of a cluster configuration, specify an interface in N/C/U notation (for example, 2/1/3). where C can take one of the following values: * 0 - Indicates a management interface. * 1 - Indicates a 1 Gbps port. * 10 - Indicates a 10 Gbps port. U is a unique integer for representing an interface in a particular port group. N is the ID of the node to which an interface belongs in a cluster configuration. Use spaces to separate multiple entries. */ Ifnum []string `json:"ifnum,omitempty"` /** * The mode(AUTO/MANNUAL) for the LA channel. */ Lamode string `json:"lamode,omitempty"` /** * State of the member interfaces. */ Slavestate int `json:"slavestate,omitempty"` /** * Media type of the member interfaces. */ Slavemedia int `json:"slavemedia,omitempty"` /** * Speed of the member interfaces. */ Slavespeed int `json:"slavespeed,omitempty"` /** * Duplex of the member interfaces. */ Slaveduplex int `json:"slaveduplex,omitempty"` /** * Flowcontrol of the member interfaces. */ Slaveflowctl int `json:"slaveflowctl,omitempty"` /** * UP time of the member interfaces. */ Slavetime int `json:"slavetime,omitempty"` /** * LR set member interface state(active/inactive). */ Lractiveintf bool `json:"lractiveintf,omitempty"` /** * New attribute added to identify the source of cmd, when SVM fires the nitro cmd, it will set the value of SVMCMD to be 1. */ Svmcmd int `json:"svmcmd,omitempty"` /** * ID of the LA channel or the cluster LA channel to which you want to bind interfaces. Specify an LA channel in LA/x notation, where x can range from 1 to 8 or a cluster LA channel in CLA/x notation or Link redundant channel in LR/x notation , where x can range from 1 to 4. */ Id string `json:"id,omitempty"` }
resource/config/network/channel_interface_binding.go
0.708818
0.476275
channel_interface_binding.go
starcoder
package gographviz import ( "fmt" "strings" ) // Graph is the analysed representation of the Graph parsed from the DOT format. type Graph struct { Attrs Attrs Name string Directed bool Strict bool Nodes *Nodes Edges *Edges SubGraphs *SubGraphs Relations *Relations } // NewGraph creates a new empty graph, ready to be populated. func NewGraph() *Graph { return &Graph{ Attrs: make(Attrs), Name: "", Directed: false, Strict: false, Nodes: NewNodes(), Edges: NewEdges(), SubGraphs: NewSubGraphs(), Relations: NewRelations(), } } // SetStrict sets whether a graph is strict. // If the graph is strict then multiple edges are not allowed between the same pairs of nodes, // see dot man page. func (g *Graph) SetStrict(strict bool) error { g.Strict = strict return nil } // SetDir sets whether the graph is directed (true) or undirected (false). func (g *Graph) SetDir(dir bool) error { g.Directed = dir return nil } // SetName sets the graph name. func (g *Graph) SetName(name string) error { g.Name = name return nil } // AddPortEdge adds an edge to the graph from node src to node dst. // srcPort and dstPort are the port the node ports, leave as empty strings if it is not required. // This does not imply the adding of missing nodes. func (g *Graph) AddPortEdge(src, srcPort, dst, dstPort string, directed bool, attrs map[string]string) error { as, err := NewAttrs(attrs) if err != nil { return err } g.Edges.Add(&Edge{src, srcPort, dst, dstPort, directed, as}) return nil } // AddEdge adds an edge to the graph from node src to node dst. // This does not imply the adding of missing nodes. // If directed is set to true then SetDir(true) must also be called or there will be a syntax error in the output. func (g *Graph) AddEdge(src, dst string, directed bool, attrs map[string]string) error { return g.AddPortEdge(src, "", dst, "", directed, attrs) } // AddNode adds a node to a graph/subgraph. // If not subgraph exists use the name of the main graph. // This does not imply the adding of a missing subgraph. func (g *Graph) AddNode(parentGraph string, name string, attrs map[string]string) error { as, err := NewAttrs(attrs) if err != nil { return err } g.Nodes.Add(&Node{name, as}) g.Relations.Add(parentGraph, name) return nil } func (g *Graph) getAttrs(graphName string) (Attrs, error) { if g.Name == graphName { return g.Attrs, nil } sub, ok := g.SubGraphs.SubGraphs[graphName] if !ok { return nil, fmt.Errorf("graph or subgraph %s does not exist", graphName) } return sub.Attrs, nil } // AddAttr adds an attribute to a graph/subgraph. func (g *Graph) AddAttr(parentGraph string, field string, value string) error { a, err := g.getAttrs(parentGraph) if err != nil { return err } return a.Add(field, value) } // AddSubGraph adds a subgraph to a graph/subgraph. func (g *Graph) AddSubGraph(parentGraph string, name string, attrs map[string]string) error { g.Relations.Add(parentGraph, name) g.SubGraphs.Add(name) for key, value := range attrs { if err := g.AddAttr(name, key, value); err != nil { return err } } return nil } // IsNode returns whether a given node name exists as a node in the graph. func (g *Graph) IsNode(name string) bool { _, ok := g.Nodes.Lookup[name] return ok } // IsSubGraph returns whether a given subgraph name exists as a subgraph in the graph. func (g *Graph) IsSubGraph(name string) bool { _, ok := g.SubGraphs.SubGraphs[name] return ok } func (g *Graph) isClusterSubGraph(name string) bool { isSubGraph := g.IsSubGraph(name) isCluster := strings.HasPrefix(name, "cluster") return isSubGraph && isCluster }
vendor/github.com/awalterschulze/gographviz/graph.go
0.68616
0.4184
graph.go
starcoder
package reflect import ( "fmt" "reflect" "strconv" "strings" ) // CopyHelper helps to reflect copy (inject) some values func CopyHelper(key string, from, to interface{}) error { // Checking reference type {to} typeOfTo := reflect.TypeOf(to) if typeOfTo.Kind() != reflect.Ptr { return fmt.Errorf( "Target must be pointer, but %T received", to, ) } // Checking simple copy ok, err := simpleCopy(from, to) if err != nil { return fmt.Errorf("Unable to read %s. %s", key, err.Error()) } if ok { return nil } // Checking string copy ok, err = smartStringCopy(from, to) if err != nil { return fmt.Errorf("Unable to read %s. %s", key, err.Error()) } if ok { return nil } // Interface receiver ok, err = interfaceTargetCopy(from, to) if err != nil { return fmt.Errorf("Unable to read %s. %s", key, err.Error()) } if ok { return nil } return fmt.Errorf("Unable to copy value of type %T to %T for key \"%s\"", from, to, key) } var any = new(interface{}) var anyType = reflect.TypeOf(any).Elem() func interfaceTargetCopy(from, to interface{}) (bool, error) { if reflect.TypeOf(to).Elem() == anyType { reflect.ValueOf(to).Elem().Set(reflect.ValueOf(from)) return true, nil } return false, nil } // simpleCopy copies values as-is if types are equal func simpleCopy(from, to interface{}) (bool, error) { if reflect.TypeOf(from).Kind() == reflect.Ptr { return simpleCopy(reflect.ValueOf(from).Elem().Interface(), to) } if reflect.TypeOf(to) == reflect.PtrTo(reflect.TypeOf(from)) { reflect.ValueOf(to).Elem().Set(reflect.ValueOf(from)) return true, nil } return false, nil } func smartStringCopy(from, to interface{}) (bool, error) { if reflect.TypeOf(from).Kind() == reflect.Ptr { return simpleCopy(reflect.ValueOf(from).Elem().Interface(), to) } if reflect.TypeOf(from).Kind() != reflect.String { return false, nil } sv, _ := from.(string) typeOfTo := reflect.TypeOf(to).Elem().Kind() valPoint := reflect.ValueOf(to).Elem() if typeOfTo == reflect.Bool { svl := strings.ToLower(sv) if svl == "true" || svl == "yes" || sv == "1" { valPoint.SetBool(true) return true, nil } if svl == "false" || svl == "no" || sv == "0" { valPoint.SetBool(false) return true, nil } return false, fmt.Errorf( "Unable to map string into boolean. Value \"%s\" is invalid", sv, ) } if typeOfTo == reflect.Int { i, err := strconv.Atoi(sv) if err != nil { return false, fmt.Errorf( "Unable to map string to int. %s", err.Error(), ) } valPoint.SetInt(int64(i)) return true, nil } if typeOfTo == reflect.Int64 { i, err := strconv.ParseInt(sv, 10, 64) if err != nil { return false, fmt.Errorf( "Unable to map string to int64. %s", err.Error(), ) } valPoint.SetInt(i) return true, nil } if typeOfTo == reflect.Float32 { f, err := strconv.ParseFloat(sv, 32) if err != nil { return false, fmt.Errorf( "Unable to map string to float32. %s", err.Error(), ) } valPoint.SetFloat(f) return true, nil } if typeOfTo == reflect.Float64 { f, err := strconv.ParseFloat(sv, 64) if err != nil { return false, fmt.Errorf( "Unable to map string to float64. %s", err.Error(), ) } valPoint.SetFloat(f) return true, nil } return false, nil }
reflect/copy.go
0.589362
0.406685
copy.go
starcoder
package gogol // State is an instance of the Game of Life type State struct { width int height int world [][]bool previousWorld [][]bool neighbourRadius int } // NewState creates a new Game of Life State func NewState(width, height, neighbourRadius int) *State { state := new(State) state.width = width state.height = height state.neighbourRadius = neighbourRadius state.world = makeWorld(width, height) return state } // GetDimensions returns the dimensions of the world func (state *State) GetDimensions() (int, int) { return state.width, state.height } // SetCell sets the state of the specified cell func (state *State) SetCell(x, y int, value bool) { nx, ny := state.normalizeCoordinates(x, y) state.world[ny][nx] = value } // GetCell returns the state of the specified cell func (state *State) GetCell(x, y int) bool { nx, ny := state.normalizeCoordinates(x, y) return state.world[ny][nx] } // NextGeneration calculates the next generation of the game func (state *State) NextGeneration() { state.previousWorld = state.world state.world = makeWorld(state.width, state.height) for y := 0; y < state.height; y++ { for x := 0; x < state.width; x++ { aliveNeighbours := state.countAliveNeighbours(x, y) cellState := state.getPreviousGenerationCell(x, y) switch true { case (!cellState && aliveNeighbours == 3): state.SetCell(x, y, true) case cellState && aliveNeighbours < 2: state.SetCell(x, y, false) case cellState && (aliveNeighbours == 2 || aliveNeighbours == 3): state.SetCell(x, y, true) case cellState && aliveNeighbours > 3: state.SetCell(x, y, false) } } } } func (state *State) normalizeCoordinates(x, y int) (int, int) { nx := x for nx < 0 { nx += state.width } for nx >= state.width { nx -= state.width } ny := y for ny < 0 { ny += state.height } for ny >= state.height { ny -= state.height } return nx, ny } func (state *State) getPreviousGenerationCell(x, y int) bool { nx, ny := state.normalizeCoordinates(x, y) return state.previousWorld[ny][nx] } func (state *State) countAliveNeighbours(x, y int) int { aliveNeighbours := 0 for i := -state.neighbourRadius; i <= state.neighbourRadius; i++ { for j := -state.neighbourRadius; j <= state.neighbourRadius; j++ { if state.getPreviousGenerationCell(x+i, y+j) { aliveNeighbours++ } } } return aliveNeighbours } func makeWorld(width, height int) [][]bool { world := make([][]bool, height) for i := 0; i < height; i++ { world[i] = make([]bool, width) } return world }
state.go
0.849191
0.631296
state.go
starcoder
package prototest import ( "bytes" "io" "reflect" "time" "github.com/rbisecke/kafka-go/protocol" ) func deepEqual(x1, x2 interface{}) bool { if x1 == nil { return x2 == nil } if r1, ok := x1.(protocol.RecordReader); ok { if r2, ok := x2.(protocol.RecordReader); ok { return deepEqualRecords(r1, r2) } return false } if b1, ok := x1.(protocol.Bytes); ok { if b2, ok := x2.(protocol.Bytes); ok { return deepEqualBytes(b1, b2) } return false } if t1, ok := x1.(time.Time); ok { if t2, ok := x2.(time.Time); ok { return t1.Equal(t2) } return false } return deepEqualValue(reflect.ValueOf(x1), reflect.ValueOf(x2)) } func deepEqualValue(v1, v2 reflect.Value) bool { t1 := v1.Type() t2 := v2.Type() if t1 != t2 { return false } switch v1.Kind() { case reflect.Bool: return v1.Bool() == v2.Bool() case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return v1.Int() == v2.Int() case reflect.String: return v1.String() == v2.String() case reflect.Struct: return deepEqualStruct(v1, v2) case reflect.Ptr: return deepEqualPtr(v1, v2) case reflect.Slice: return deepEqualSlice(v1, v2) default: panic("comparing values of unsupported type: " + v1.Type().String()) } } func deepEqualPtr(v1, v2 reflect.Value) bool { if v1.IsNil() { return v2.IsNil() } return deepEqual(v1.Elem().Interface(), v2.Elem().Interface()) } func deepEqualStruct(v1, v2 reflect.Value) bool { t := v1.Type() n := t.NumField() for i := 0; i < n; i++ { f := t.Field(i) if f.PkgPath != "" { // ignore unexported fields continue } f1 := v1.Field(i) f2 := v2.Field(i) if !deepEqual(f1.Interface(), f2.Interface()) { return false } } return true } func deepEqualSlice(v1, v2 reflect.Value) bool { t := v1.Type() e := t.Elem() if e.Kind() == reflect.Uint8 { // []byte return bytes.Equal(v1.Bytes(), v2.Bytes()) } n1 := v1.Len() n2 := v2.Len() if n1 != n2 { return false } for i := 0; i < n1; i++ { f1 := v1.Index(i) f2 := v2.Index(i) if !deepEqual(f1.Interface(), f2.Interface()) { return false } } return true } func deepEqualBytes(s1, s2 protocol.Bytes) bool { if s1 == nil { return s2 == nil } if s2 == nil { return false } n1 := s1.Len() n2 := s2.Len() if n1 != n2 { return false } b1 := make([]byte, n1) b2 := make([]byte, n2) if _, err := s1.(io.ReaderAt).ReadAt(b1, 0); err != nil { panic(err) } if _, err := s2.(io.ReaderAt).ReadAt(b2, 0); err != nil { panic(err) } return bytes.Equal(b1, b2) } func deepEqualRecords(r1, r2 protocol.RecordReader) bool { for { rec1, err1 := r1.ReadRecord() rec2, err2 := r2.ReadRecord() if err1 != nil || err2 != nil { return err1 == err2 } if !deepEqualRecord(rec1, rec2) { return false } } } func deepEqualRecord(r1, r2 *protocol.Record) bool { if r1.Offset != r2.Offset { return false } if !r1.Time.Equal(r2.Time) { return false } if !deepEqualBytes(r1.Key, r2.Key) { return false } if !deepEqualBytes(r1.Value, r2.Value) { return false } return deepEqual(r1.Headers, r2.Headers) } func reset(v interface{}) { if r, _ := v.(interface{ Reset() }); r != nil { r.Reset() } }
protocol/prototest/prototest.go
0.549641
0.469338
prototest.go
starcoder
package match import ( "fmt" "reflect" "strings" "github.com/wallix/awless/cloud" ) type and struct { matchers []cloud.Matcher } func (m and) Match(r cloud.Resource) bool { for _, match := range m.matchers { if !match.Match(r) { return false } } return len(m.matchers) > 0 } func And(matchers ...cloud.Matcher) cloud.Matcher { return and{matchers: matchers} } type or struct { matchers []cloud.Matcher } func (m or) Match(r cloud.Resource) bool { for _, match := range m.matchers { if match.Match(r) { return true } } return false } func Or(matchers ...cloud.Matcher) cloud.Matcher { return or{matchers: matchers} } type propertyMatcher struct { name string value interface{} matchOnString bool ignoreCase bool contains bool } func (m propertyMatcher) Match(r cloud.Resource) bool { v, found := r.Property(m.name) if !found { return false } expectVal := m.value if m.matchOnString { v = fmt.Sprint(v) expectVal = fmt.Sprint(m.value) } if m.ignoreCase { if vv, vIsStr := v.(string); vIsStr { v = strings.ToLower(vv) } if expect, expectIsStr := expectVal.(string); expectIsStr { expectVal = strings.ToLower(expect) } } if m.contains { vv, vIsStr := v.(string) expect, expectIsStr := expectVal.(string) if vIsStr && expectIsStr { return strings.Contains(vv, expect) } } return reflect.DeepEqual(v, expectVal) } func Property(name string, val interface{}) propertyMatcher { return propertyMatcher{name: name, value: val} } func (p propertyMatcher) MatchString() propertyMatcher { p.matchOnString = true return p } func (p propertyMatcher) IgnoreCase() propertyMatcher { p.ignoreCase = true return p } func (p propertyMatcher) Contains() propertyMatcher { p.contains = true return p } type tagMatcher struct { key, value string } func (m tagMatcher) Match(r cloud.Resource) bool { tags, ok := r.Properties()["Tags"].([]string) if !ok { return false } for _, t := range tags { if fmt.Sprintf("%s=%s", m.key, m.value) == t { return true } } return false } func Tag(key, val string) tagMatcher { return tagMatcher{key: key, value: val} } type tagKeyMatcher struct { key string } func (m tagKeyMatcher) Match(r cloud.Resource) bool { tags, ok := r.Properties()["Tags"].([]string) if !ok { return false } for _, t := range tags { splits := strings.Split(t, "=") if len(splits) > 0 { if splits[0] == m.key { return true } } } return false } func TagKey(key string) tagKeyMatcher { return tagKeyMatcher{key: key} } type tagValueMatcher struct { value string } func (m tagValueMatcher) Match(r cloud.Resource) bool { tags, ok := r.Properties()["Tags"].([]string) if !ok { return false } for _, t := range tags { splits := strings.Split(t, "=") if len(splits) > 1 { if splits[1] == m.value { return true } } } return false } func TagValue(value string) tagValueMatcher { return tagValueMatcher{value: value} }
cloud/match/matchers.go
0.621196
0.427875
matchers.go
starcoder
package decorator import ( "fmt" "github.com/swamp/compiler/src/ast" "github.com/swamp/compiler/src/decorated/decshared" "github.com/swamp/compiler/src/decorated/dtype" decorated "github.com/swamp/compiler/src/decorated/expression" dectype "github.com/swamp/compiler/src/decorated/types" "github.com/swamp/compiler/src/token" ) func tryConvertToArithmeticOperator(operatorType token.Type) (decorated.ArithmeticOperatorType, bool) { switch operatorType { case token.OperatorPlus: return decorated.ArithmeticPlus, true case token.OperatorAppend: return decorated.ArithmeticAppend, true case token.OperatorCons: return decorated.ArithmeticCons, true case token.OperatorMinus: return decorated.ArithmeticMinus, true case token.OperatorMultiply: return decorated.ArithmeticMultiply, true case token.OperatorDivide: return decorated.ArithmeticDivide, true case token.OperatorRemainder: return decorated.ArithmeticRemainder, true } return 0, false } func tryConvertToBooleanOperator(operatorType token.Type) (decorated.BooleanOperatorType, bool) { switch operatorType { case token.OperatorEqual: return decorated.BooleanEqual, true case token.OperatorNotEqual: return decorated.BooleanNotEqual, true case token.OperatorLess: return decorated.BooleanLess, true case token.OperatorLessOrEqual: return decorated.BooleanLessOrEqual, true case token.OperatorGreater: return decorated.BooleanGreater, true case token.OperatorGreaterOrEqual: return decorated.BooleanGreaterOrEqual, true } return 0, false } func tryConvertToLogicalOperator(operatorType token.Type) (decorated.LogicalOperatorType, bool) { switch operatorType { case token.OperatorOr: return decorated.LogicalOr, true case token.OperatorAnd: return decorated.LogicalAnd, true } return 0, false } func tryConvertToBitwiseOperator(operatorType token.Type) (decorated.BitwiseOperatorType, bool) { switch operatorType { case token.OperatorBitwiseAnd: return decorated.BitwiseAnd, true case token.OperatorBitwiseOr: return decorated.BitwiseOr, true case token.OperatorUpdate: return decorated.BitwiseOr, true case token.OperatorBitwiseXor: return decorated.BitwiseXor, true case token.OperatorBitwiseNot: return decorated.BitwiseNot, true case token.OperatorBitwiseShiftLeft: return decorated.BitwiseShiftLeft, true case token.OperatorBitwiseShiftRight: return decorated.BitwiseShiftRight, true } return 0, false } func tryConvertCastOperator(infix *ast.BinaryOperator, left decorated.Expression, right *decorated.AliasReference) (*decorated.CastOperator, decshared.DecoratedError) { a := decorated.NewCastOperator(left, right, infix) if err := dectype.CompatibleTypes(left.Type(), right.Type()); err != nil { return nil, decorated.NewUnmatchingBitwiseOperatorTypes(infix, left, nil) } return a, nil } /* func parsePipeLeftExpression(p ParseStream, operatorToken token.OperatorToken, startIndentation int, precedence Precedence, left ast.FunctionExpression) (ast.FunctionExpression, parerr.ParseError) { _, spaceErr := p.eatOneSpace("space after pipe left") if spaceErr != nil { return nil, spaceErr } right, rightErr := p.parseExpressionNormal(startIndentation) if rightErr != nil { return nil, rightErr } leftCall, _ := left.(ast.FunctionCaller) if leftCall == nil { leftVar, _ := left.(*ast.VariableIdentifier) if leftVar == nil { return nil, parerr.NewLeftPartOfPipeMustBeFunctionCallError(operatorToken) } leftCall = ast.NewFunctionCall(leftVar, nil) } rightCall, _ := right.(ast.FunctionCaller) if rightCall == nil { return nil, parerr.NewRightPartOfPipeMustBeFunctionCallError(operatorToken) } args := leftCall.Arguments() args = append(args, rightCall) leftCall.OverwriteArguments(args) return leftCall, nil } */ func defToFunctionReference(def *decorated.NamedDecoratedExpression, ident ast.ScopedOrNormalVariableIdentifier) *decorated.FunctionReference { lookupExpression := def.Expression() functionValue, _ := lookupExpression.(*decorated.FunctionValue) fromModule := def.ModuleDefinition().OwnedByModule() moduleRef := decorated.NewModuleReference(ast.NewModuleReference(fromModule.FullyQualifiedModuleName().Path().Parts()), fromModule) nameWithModuleRef := decorated.NewNamedDefinitionReference(moduleRef, ident) return decorated.NewFunctionReference(nameWithModuleRef, functionValue) } func decorateHalfOfAFunctionCall(d DecorateStream, left ast.Expression, context *VariableContext) (*ast.FunctionCall, decorated.Expression, []decorated.Expression, decshared.DecoratedError) { var arguments []decorated.Expression var functionExpression decorated.Expression var leftAstCall *ast.FunctionCall switch t := left.(type) { case *ast.FunctionCall: funcExpr, funcExprErr := DecorateExpression(d, t.FunctionExpression(), context) if funcExprErr != nil { return nil, nil, nil, funcExprErr } functionExpression = funcExpr for _, astArgument := range t.Arguments() { expr, exprErr := DecorateExpression(d, astArgument, context) if exprErr != nil { return nil, nil, nil, exprErr } arguments = append(arguments, expr) } leftAstCall = t case *ast.VariableIdentifier: def := context.FindNamedDecoratedExpression(t) if def == nil { return nil, nil, nil, decorated.NewInternalError(fmt.Errorf("couldn't find %v", t)) } functionReference := defToFunctionReference(def, t) functionExpression = functionReference leftAstCall = ast.NewFunctionCall(functionReference, nil) case *ast.VariableIdentifierScoped: def := context.FindScopedNamedDecoratedExpression(t) if def == nil { return nil, nil, nil, decorated.NewInternalError(fmt.Errorf("couldn't find %v", t)) } functionReference := defToFunctionReference(def, t) functionExpression = functionReference leftAstCall = ast.NewFunctionCall(functionReference, nil) } return leftAstCall, functionExpression, arguments, nil } func decoratePipeLeft(d DecorateStream, infix *ast.BinaryOperator, context *VariableContext) (decorated.Expression, decshared.DecoratedError) { left := infix.Left() right := infix.Right() rightDecorated, rightErr := DecorateExpression(d, right, context) if rightErr != nil { return nil, rightErr } leftAstCall, functionExpression, arguments, halfErr := decorateHalfOfAFunctionCall(d, left, context) if halfErr != nil { return nil, halfErr } var allArguments []decorated.Expression allArguments = append(arguments, rightDecorated) fullLeftFunctionCall, functionCallErr := decorateFunctionCallInternal(d, leftAstCall, functionExpression, allArguments, context) if functionCallErr != nil { return nil, functionCallErr } calculatedFunctionCallType := functionExpression.Type().(*dectype.FunctionTypeReference).FunctionAtom() halfLeftSideFunctionCall := decorated.NewFunctionCall(leftAstCall, functionExpression, calculatedFunctionCallType, arguments) return decorated.NewPipeLeftOperator(halfLeftSideFunctionCall, rightDecorated, fullLeftFunctionCall), nil } func decoratePipeRight(d DecorateStream, infix *ast.BinaryOperator, context *VariableContext) (decorated.Expression, decshared.DecoratedError) { left := infix.Left() right := infix.Right() leftDecorated, leftErr := DecorateExpression(d, left, context) if leftErr != nil { return nil, leftErr } rightAstCall, functionExpression, arguments, halfErr := decorateHalfOfAFunctionCall(d, right, context) if halfErr != nil { return nil, halfErr } var allArguments []decorated.Expression allArguments = append(arguments, leftDecorated) fullRightFunctionCall, functionCallErr := decorateFunctionCallInternal(d, rightAstCall, functionExpression, allArguments, context) if functionCallErr != nil { return nil, functionCallErr } functionCall := fullRightFunctionCall.(*decorated.FunctionCall) halfRightFunctionCall := decorated.NewFunctionCall(rightAstCall, functionCall, functionCall.SmashedFunctionType(), arguments) return decorated.NewPipeRightOperator(leftDecorated, halfRightFunctionCall, fullRightFunctionCall), nil } func decorateBinaryOperator(d DecorateStream, infix *ast.BinaryOperator, context *VariableContext) (decorated.Expression, decshared.DecoratedError) { if infix.OperatorType() == token.OperatorPipeLeft { return decoratePipeLeft(d, infix, context) } else if infix.OperatorType() == token.OperatorPipeRight { return decoratePipeRight(d, infix, context) } else { return decorateBinaryOperatorSameType(d, infix, context) } } func decorateBinaryOperatorSameType(d DecorateStream, infix *ast.BinaryOperator, context *VariableContext) (decorated.Expression, decshared.DecoratedError) { leftExpression, leftExpressionErr := DecorateExpression(d, infix.Left(), context) if leftExpressionErr != nil { return nil, leftExpressionErr } rightExpression, rightExpressionErr := DecorateExpression(d, infix.Right(), context) if rightExpressionErr != nil { return nil, rightExpressionErr } if infix.OperatorType() == token.OperatorCons { listType, err := dectype.GetListType(rightExpression.Type()) if err != nil { return nil, decorated.NewUnExpectedListTypeForCons(infix, leftExpression, rightExpression) } listTypeType := listType.GenericTypes()[0] compatibleErr := dectype.CompatibleTypes(leftExpression.Type(), listTypeType) if compatibleErr != nil { return nil, decorated.NewUnMatchingBinaryOperatorTypes(infix, leftExpression.Type(), rightExpression.Type()) } return decorated.NewConsOperator(leftExpression, rightExpression, d.TypeReferenceMaker()) } compatibleErr := dectype.CompatibleTypes(leftExpression.Type(), rightExpression.Type()) if compatibleErr != nil { return nil, decorated.NewUnMatchingBinaryOperatorTypes(infix, leftExpression.Type(), rightExpression.Type()) } arithmeticOperatorType, worked := tryConvertToArithmeticOperator(infix.OperatorType()) if worked { compatibleErr := dectype.CompatibleTypes(leftExpression.Type(), rightExpression.Type()) if compatibleErr != nil { return nil, decorated.NewUnMatchingArithmeticOperatorTypes(infix, leftExpression, rightExpression) } opType := leftExpression.Type() opTypeUnreferenced := dectype.UnReference(opType) primitive, _ := opTypeUnreferenced.(*dectype.PrimitiveAtom) if primitive != nil { if primitive.AtomName() == "Fixed" { if arithmeticOperatorType == decorated.ArithmeticMultiply { arithmeticOperatorType = decorated.ArithmeticFixedMultiply } else if arithmeticOperatorType == decorated.ArithmeticDivide { arithmeticOperatorType = decorated.ArithmeticFixedDivide } } } return decorated.NewArithmeticOperator(infix, leftExpression, rightExpression, arithmeticOperatorType) } booleanOperatorType, isBoolean := tryConvertToBooleanOperator(infix.OperatorType()) if isBoolean { incompatibleErr := dectype.CompatibleTypes(leftExpression.Type(), rightExpression.Type()) if incompatibleErr != nil { return nil, decorated.NewUnMatchingBooleanOperatorTypes(infix, leftExpression, rightExpression) } boolType := d.TypeReferenceMaker().FindBuiltInType("Bool") if boolType == nil { return nil, decorated.NewTypeNotFound("Bool") } return decorated.NewBooleanOperator(infix, leftExpression, rightExpression, booleanOperatorType, boolType.(dtype.Type)) } logicalOperatorType, isLogical := tryConvertToLogicalOperator(infix.OperatorType()) if isLogical { incompatibleErr := dectype.CompatibleTypes(leftExpression.Type(), rightExpression.Type()) if incompatibleErr != nil { return nil, decorated.NewLogicalOperatorsMustBeBoolean(infix, leftExpression, rightExpression) } boolType := d.TypeReferenceMaker().FindBuiltInType("Bool") if boolType == nil { return nil, decorated.NewTypeNotFound("Bool") } return decorated.NewLogicalOperator(leftExpression, rightExpression, logicalOperatorType, boolType.(dtype.Type)) } bitwiseOperatorType, isBitwise := tryConvertToBitwiseOperator(infix.OperatorType()) if isBitwise { incompatibleErr := dectype.CompatibleTypes(leftExpression.Type(), rightExpression.Type()) if incompatibleErr != nil { return nil, decorated.NewUnmatchingBitwiseOperatorTypes(infix, leftExpression, rightExpression) } return decorated.NewBitwiseOperator(infix, leftExpression, rightExpression, bitwiseOperatorType) } if infix.OperatorType() == token.Colon { aliasReference, _ := rightExpression.(*decorated.AliasReference) return tryConvertCastOperator(infix, leftExpression, aliasReference) } return nil, decorated.NewUnknownBinaryOperator(infix, leftExpression, rightExpression) }
src/decorated/convert/decorate_binary_operator.go
0.617513
0.416797
decorate_binary_operator.go
starcoder
package check import ( "math" "sort" ) // AreEqualSlicesFloat64 compares two float64 slices. // The Epsilon parameter sets the accuracy of the comparison of two floats. // The function ignores sorting, so compares both values and sorting of the slices. // Thus, if the slices have the same values but different orders, they are not considered the same. // When both slices has zero length, true is returned. // If you want the function to sort the slices first, use AreEqualSortedSlicesFloat64. func AreEqualSlicesFloat64(Slice1, Slice2 []float64, Epsilon float64) bool { if len(Slice1) == 0 && len(Slice2) == 0 { return true } if len(Slice1) != len(Slice2) { return false } for i := range Slice1 { if math.Abs(Slice1[i]-Slice2[i]) > Epsilon { return false } } return true } // AreEqualSortedSlicesFloat64 compares two float64 slices. // The Epsilon parameter sets the accuracy of the comparison of two floats. // The function takes into account sorting, meaning that if they have the same values, they are considered the same // even if they are differently ordered. When both slices has zero length, true is returned. func AreEqualSortedSlicesFloat64(Slice1, Slice2 []float64, Epsilon float64) bool { if len(Slice1) == 0 && len(Slice2) == 0 { return true } if len(Slice1) != len(Slice2) { return false } if !sort.Float64sAreSorted(Slice1) { sort.Float64s(Slice1) } if !sort.Float64sAreSorted(Slice2) { sort.Float64s(Slice2) } for i := range Slice1 { if math.Abs(Slice1[i]-Slice2[i]) > Epsilon { return false } } return true } // AreEqualSlicesInt compares two int slices. The function ignores sorting, so compares both values and sorting of the slices. // If you want the function to sort the slices first, use AreEqualSortedSlicesInt instead. // When both slices has zero length, true is returned. func AreEqualSlicesInt(Slice1, Slice2 []int) bool { if len(Slice1) == 0 && len(Slice2) == 0 { return true } if len(Slice1) != len(Slice2) { return false } for i := range Slice1 { if Slice1[i] != Slice2[i] { return false } } return true } // AreEqualSortedSlicesInt compares two int slices. // The function takes into account sorting, meaning that if they have the same values, they are considered the same // even if they are differently ordered. When both slices has zero length, true is returned. func AreEqualSortedSlicesInt(Slice1, Slice2 []int) bool { if len(Slice1) == 0 && len(Slice2) == 0 { return true } if len(Slice1) != len(Slice2) { return false } if !sort.IntsAreSorted(Slice1) { sort.Ints(Slice1) } if !sort.IntsAreSorted(Slice2) { sort.Ints(Slice2) } for i := range Slice1 { if Slice1[i] != Slice2[i] { return false } } return true } // AreEqualSlicesString compares two string slices. The function ignores sorting, so compares both values and sorting of the slices. // If you want the function to sort the slices, use AreEqualSortedSlicesString instead. // When both slices has zero length, true is returned. func AreEqualSlicesString(Slice1, Slice2 []string) bool { if len(Slice1) == 0 && len(Slice2) == 0 { return true } if len(Slice1) != len(Slice2) { return false } for i := range Slice1 { if Slice1[i] != Slice2[i] { return false } } return true } // AreEqualSortedSlicesString compares two string slices. // The function takes into account sorting, meaning that if they have the same values, they are considered the same // even if they are differently ordered. When both slices has zero length, true is returned. func AreEqualSortedSlicesString(Slice1, Slice2 []string) bool { if len(Slice1) == 0 && len(Slice2) == 0 { return true } if len(Slice1) != len(Slice2) { return false } if !sort.StringsAreSorted(Slice1) { sort.Strings(Slice1) } if !sort.StringsAreSorted(Slice2) { sort.Strings(Slice2) } for i := range Slice1 { if Slice1[i] != Slice2[i] { return false } } return true }
equalslices.go
0.675765
0.633042
equalslices.go
starcoder
package common import ( "github.com/Symantec/Dominator/lib/log" "github.com/Symantec/proxima/config" "github.com/influxdata/influxdb/client/v2" "github.com/influxdata/influxdb/influxql" "time" ) // Influx represents a single influx backend. type Influx struct { data config.Influx dbQueryer dbQueryerType } func NewInflux(influx config.Influx) (*Influx, error) { return newInfluxForTesting(influx, influxCreateDbQueryer) } // Query runs a query against this backend. func (d *Influx) Query( query *influxql.Query, epoch string, logger log.Logger) ( *client.Response, error) { return d.dbQueryer.Query(query.String(), d.data.Database, epoch) } // Close frees any resources associated with this instance. func (d *Influx) Close() error { return d.dbQueryer.Close() } // InfluxList represents a group of influx backends. // nil represents the group of zero influx backends. type InfluxList struct { instances []*Influx } // NewInfluxList returns a new instancce. If the length of influxes is 0, // NewInfluxList returns nil. func NewInfluxList(influxes config.InfluxList) (*InfluxList, error) { return newInfluxListForTesting(influxes, influxCreateDbQueryer) } // Query runs a query against the backends in this group merging the resuls // into a single response. func (l *InfluxList) Query( query *influxql.Query, epoch string, now time.Time, logger log.Logger) ( *client.Response, error) { return l.query(query, epoch, now, logger) } // Close frees any resources associated with this instance. func (l *InfluxList) Close() error { return l._close() } // Scotty represents a single scotty server. type Scotty struct { // connects to a particular scotty. Only one of these fields will be // non nil dbQueryer dbQueryerType // Scotties which all together represent the data partials *ScottyPartials // Each scotty represents the same data. scotties *ScottyList } func NewScotty(scotty config.Scotty) (*Scotty, error) { return newScottyForTesting(scotty, influxCreateDbQueryer) } func (s *Scotty) Query( query *influxql.Query, epoch string, logger log.Logger) ( *client.Response, error) { return s.query(query, epoch, logger) } // Close frees any resources associated with this instance. func (s *Scotty) Close() error { return s._close() } // ScottyPartials represents a list of scotties where all the scotties // together represent the data. All scotties must respond to each query. type ScottyPartials struct { instances []*Scotty } func NewScottyPartials(scotties config.ScottyList) (*ScottyPartials, error) { return newScottyPartialsForTesting(scotties, influxCreateDbQueryer) } func (l *ScottyPartials) Query( query *influxql.Query, epoch string, logger log.Logger) ( *client.Response, error) { return l.query(query, epoch, logger) } func (l *ScottyPartials) Close() error { return l._close() } // ScottyList represents a group of scotty servers. Unlike ScottyPartials, // each Scotty has the same data only one scotty has to respond to each query. // nil represents the group of zero scotty servers. type ScottyList struct { instances []*Scotty } // NewScottyList returns a new instancce. If the length of scotties is 0, // NewScottyList returns nil. func NewScottyList(scotties config.ScottyList) (*ScottyList, error) { return newScottyListForTesting(scotties, influxCreateDbQueryer) } // Query runs a query against the servers in this group merging the resuls // into a single response. func (l *ScottyList) Query( query *influxql.Query, epoch string, logger log.Logger) ( *client.Response, error) { return l.query(query, epoch, logger) } // Close frees any resources associated with this instance. func (l *ScottyList) Close() error { return l._close() } // Database represents a single proxima configuration. type Database struct { name string influxes *InfluxList scotties *ScottyList } func NewDatabase(db config.Database) (*Database, error) { return newDatabaseForTesting(db, influxCreateDbQueryer) } func (d *Database) Name() string { return d.name } // Query runs a query against the influx backends and scotty servers in this // proxima configuration. func (d *Database) Query( query *influxql.Query, epoch string, now time.Time, logger log.Logger) (*client.Response, error) { return d.query(query, epoch, now, logger) } // Close frees any resources associated with this instance. func (d *Database) Close() error { return d._close() } // Proxima represents all the configurations of a proxima application. // A Proxima instance does the heavy lifting for the proxima application. type Proxima struct { dbs map[string]*Database } func NewProxima(proxima config.Proxima) (*Proxima, error) { return newProximaForTesting(proxima, influxCreateDbQueryer) } // ByName returns the configuration with given name or nil if no such // configuration exists. func (p *Proxima) ByName(name string) *Database { return p.dbs[name] } // Names returns the names of all the configurations ordered alphabetically. func (p *Proxima) Names() (result []string) { return p.names() } // Close frees any resources associated with this instance. func (p *Proxima) Close() error { return p._close() }
common/api.go
0.847211
0.406185
api.go
starcoder
package types import ( "bytes" "sort" "github.com/spacemeshos/go-spacemesh/codec" "github.com/spacemeshos/go-spacemesh/log" ) const ( // BlockIDSize in bytes. // FIXME(dshulyak) why do we cast to hash32 when returning bytes? // probably required for fetching by hash between peers. BlockIDSize = Hash32Length ) // BlockID is a 20-byte sha256 sum of the serialized block used to identify a Block. type BlockID Hash20 // EmptyBlockID is a canonical empty BlockID. var EmptyBlockID = BlockID{} // NewExistingBlock creates a block from existing data. func NewExistingBlock(id BlockID, inner InnerBlock) *Block { return &Block{blockID: id, InnerBlock: inner} } // Block contains the content of a layer on the mesh history. type Block struct { InnerBlock // the following fields are kept private and from being serialized blockID BlockID } // InnerBlock contains the transactions and rewards of a block. type InnerBlock struct { LayerIndex LayerID Rewards []AnyReward TxIDs []TransactionID } // AnyReward contains the rewards inforamtion. type AnyReward struct { Address Address SmesherID NodeID // Amount == LayerReward + fee Amount uint64 LayerReward uint64 } // Initialize calculates and sets the Block's cached blockID. func (b *Block) Initialize() { b.blockID = BlockID(CalcHash32(b.Bytes()).ToHash20()) } // Bytes returns the serialization of the InnerBlock. func (b *Block) Bytes() []byte { bytes, err := codec.Encode(b.InnerBlock) if err != nil { log.Panic("failed to serialize block: %v", err) } return bytes } // ID returns the BlockID. func (b *Block) ID() BlockID { return b.blockID } // MarshalLogObject implements logging encoder for Block. func (b *Block) MarshalLogObject(encoder log.ObjectEncoder) error { encoder.AddString("block_id", b.ID().String()) encoder.AddUint32("layer_id", b.LayerIndex.Value) encoder.AddInt("num_tx", len(b.TxIDs)) encoder.AddInt("num_rewards", len(b.Rewards)) return nil } // Bytes returns the BlockID as a byte slice. func (id BlockID) Bytes() []byte { return id.AsHash32().Bytes() } // AsHash32 returns a Hash32 whose first 20 bytes are the bytes of this BlockID, it is right-padded with zeros. func (id BlockID) AsHash32() Hash32 { return Hash20(id).ToHash32() } // Field returns a log field. Implements the LoggableField interface. func (id BlockID) Field() log.Field { return log.String("block_id", id.String()) } // String implements the Stringer interface. func (id BlockID) String() string { return id.AsHash32().ShortString() } // Compare returns true if other (the given BlockID) is less than this BlockID, by lexicographic comparison. func (id BlockID) Compare(other BlockID) bool { return bytes.Compare(id.Bytes(), other.Bytes()) < 0 } // BlockIDsToHashes turns a list of BlockID into their Hash32 representation. func BlockIDsToHashes(ids []BlockID) []Hash32 { hashes := make([]Hash32, 0, len(ids)) for _, id := range ids { hashes = append(hashes, id.AsHash32()) } return hashes } type blockIDs []BlockID func (ids blockIDs) MarshalLogArray(encoder log.ArrayEncoder) error { for i := range ids { encoder.AppendString(ids[i].String()) } return nil } // SortBlockIDs sorts a list of BlockID in lexicographic order, in-place. func SortBlockIDs(ids blockIDs) []BlockID { sort.Slice(ids, func(i, j int) bool { return ids[i].Compare(ids[j]) }) return ids } // BlockIdsField returns a list of loggable fields for a given list of BlockID. func BlockIdsField(ids blockIDs) log.Field { return log.Array("block_ids", ids) } // ToBlockIDs returns a slice of BlockID corresponding to the given list of Block. func ToBlockIDs(blocks []*Block) []BlockID { ids := make([]BlockID, 0, len(blocks)) for _, b := range blocks { ids = append(ids, b.ID()) } return ids } // SortBlocks sort blocks by their IDs. func SortBlocks(blks []*Block) []*Block { sort.Slice(blks, func(i, j int) bool { return blks[i].ID().Compare(blks[j].ID()) }) return blks } // DBBlock is a Block structure stored in DB to skip ID hashing. type DBBlock struct { ID BlockID InnerBlock InnerBlock } // ToBlock creates a Block from data that is stored locally. func (dbb *DBBlock) ToBlock() *Block { return &Block{ InnerBlock: dbb.InnerBlock, blockID: dbb.ID, } }
common/types/block.go
0.568176
0.437463
block.go
starcoder
package skynode import ( "fmt" ) // NodeInfo structure stores of JSON response from /conn/getAll API type NodeInfo struct { Key string `json:"key"` Conntype string `json:"type"` SendBytes int `json:"send_bytes"` RecvBytes int `json:"recv_bytes"` LastAckTime int `json:"last_ack_time"` StartTime int `json:"start_time"` } // NodeInfoSlice defines an in-memory (dynamic) array of NodeInfo structures type NodeInfoSlice []NodeInfo // NodeInfoMap defines a string key based map of NodeInfo structs type NodeInfoMap map[string]NodeInfo // NodeInfoSliceToMap convers a provided NodeInfoSlice to a NodeInfoMap func NodeInfoSliceToMap(nis NodeInfoSlice) NodeInfoMap { niMap := make(map[string]NodeInfo) for _, ni := range nis { niMap[ni.Key] = ni } return niMap } // NodesAreEqual determines if two instances of a NodeInfo structure (a and b) represent the same Node based on their Keys. // Not that this is not an equality check of the structure - but simply that the two structures represent the same Node. // Other elements of the strucutre may be different. func NodesAreEqual(a, b NodeInfo) bool { // Check both NodeInfo structures are for the same return a.Key == b.Key } // NodeInfoSliceEqual determines if two instances of a NodeInfoSlice (a and b) are equal - on the basis that // they contain the same list of NodeInfo structures. // TODO: May need to review this function and how it determines equality. Very simplistice ATM. func NodeInfoSliceEqual(a, b NodeInfoSlice) bool { // Check both contain the same number of connectedNode elements. if len(a) != len(b) { return false } // Iterate a and check the Node Key for each connected Node against b. for i, v := range a { if !NodesAreEqual(v, b[i]) { // If a different Node is found in the list, // consider the two inequal. return false } } return true } // String satisfies the fmt.Stringer interface for the NodeInfo type func (ni NodeInfo) String() string { return fmt.Sprintf("Key: %s, Type: %s, SendBytes: %v, RecvBytes: %v, LastAckTime: %v, StartTime: $v", ni.Key, ni.Conntype, ni.SendBytes, ni.RecvBytes, ni.LastAckTime, ni.StartTime) } // FmtString returns a rich formatted string representing the data of the NodeInfo struct func (ni NodeInfo) FmtString() string { msg := "Node Information:\n" + "Key : %s\n" + "Type : %s\n" + "SendBytes : %v\n" + "RecvBytes : %v\n" + "LastAckTime: %vs\n" + "StartTime : %vs" return fmt.Sprintf(msg, ni.Key, ni.Conntype, ni.SendBytes, ni.RecvBytes, ni.LastAckTime, ni.StartTime) } /* type RWMap struct { sync.RWMutex m map[string]int } // Get is a wrapper for getting the value from the underlying map func (r *RWMap) Get(key string) int { r.RLock() defer r.RUnlock() return r.m[key] } // Set is a wrapper for setting the value of a key in the underlying map func (r *RWMap) Set(key string, val int) { r.Lock() defer r.Unlock() r.m[key] = val } */
src/skynode/skynode.go
0.636466
0.495178
skynode.go
starcoder
package spouttest import ( "fmt" "net/http" "strconv" "strings" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) // AssertRecv checks that a specific string has been received from a // channel. The check times out after LongWait. func AssertRecv(t *testing.T, ch <-chan string, label, expected string) { expected = stripLeadingNL(expected) select { case received := <-ch: assert.Equal(t, expected, received) case <-time.After(LongWait): t.Fatalf("timed out waiting for %s", label) } } // AssertNoMore checks that there aren't more items received from a // string channel in ShortWait time. func AssertNoMore(t *testing.T, ch <-chan string) { select { case <-ch: t.Fatal("unexpectedly saw message") case <-time.After(ShortWait): } } func stripLeadingNL(s string) string { // This allows long `expected` strings to be formatted nicely in // the caller. if strings.HasPrefix(s, "\n") { return s[1:] } return s } // AssertMonitor ensures that a number of lines have been from a // component's statistician goroutine. The target lines may arrive in // any order and non-matching lines are ignored. Timestamps on the // received lines are checked for and then stripped. func AssertMonitor(t *testing.T, ch chan string, expected []string) { remaining := make(map[string]bool) for _, line := range expected { remaining[line] = true } var seenLines string timeout := time.After(LongWait) for { select { case lines := <-ch: for _, line := range strings.Split(lines, "\n") { if len(line) == 0 { continue } line = stripTimestamp(t, line) seenLines += fmt.Sprintf("%s\n", line) delete(remaining, line) } if len(remaining) < 1 { return } case <-timeout: t.Fatalf("timed out waiting for expected lines. expected:\n%s\nsaw:\n%s", strings.Join(expected, "\n"), seenLines, ) } } } // StripTimestamps takes a string containing one or more metrics // lines, validates that each line appears to end with a timestamp and // then strips the timestamp off. The returned string is the same as // the input but without the timestamps (for easier test comparisons). func StripTimestamps(t *testing.T, s string) string { var out []string for _, line := range strings.Split(s, "\n") { out = append(out, stripTimestamp(t, line)) } return strings.Join(out, "\n") } func stripTimestamp(t *testing.T, s string) string { if len(s) < 1 { return "" } i := strings.LastIndexByte(s, ' ') require.True(t, i >= 0) // Check that end looks like a timestamp _, err := strconv.Atoi(s[i+1:]) require.NoError(t, err) // Strip off the timestamp return s[:i] } // CheckReadyProbe repeatedly tries a readiness probe on the given // port. It will return true if a successful readiness probe is // observed within LongWait. func CheckReadyProbe(probePort int) bool { if probePort <= 0 { panic("probe port must be greater than 0") } maxTime := time.Now().Add(LongWait) url := fmt.Sprintf("http://localhost:%d/readyz", probePort) client := &http.Client{Timeout: time.Second} for time.Now().Before(maxTime) { resp, err := client.Get(url) if err == nil && resp.StatusCode == 200 { return true } time.Sleep(200 * time.Millisecond) } return false } // AssertReadyProbe fails a test if CheckReadyProbe returns false. func AssertReadyProbe(t require.TestingT, probePort int) { if CheckReadyProbe(probePort) { return } t.Errorf("timed out waiting for successful ready probe") t.FailNow() }
spouttest/asserts.go
0.710327
0.496338
asserts.go
starcoder
// Package fft provides forward and inverse fast Fourier transform functions. package fft import "currents/internal/dsp" // FFTReal returns the forward FFT of the real-valued slice. func FFTReal(x []float32) []complex64 { return FFT(dsp.ToComplex(x)) } // IFFTReal returns the inverse FFT of the real-valued slice. func IFFTReal(x []float32) []complex64 { return IFFT(dsp.ToComplex(x)) } // IFFT returns the inverse FFT of the complex-valued slice. func IFFT(x []complex64) []complex64 { lx := len(x) r := make([]complex64, lx) // Reverse inputs, which is calculated with modulo N, hence x[0] as an outlier r[0] = x[0] for i := 1; i < lx; i++ { r[i] = x[lx-i] } r = FFT(r) N := complex(float32(lx), 0) for n := range r { r[n] /= N } return r } // Convolve returns the convolution of x ∗ y. func Convolve(x, y []complex64) []complex64 { if len(x) != len(y) { panic("arrays not of equal size") } fft_x := FFT(x) fft_y := FFT(y) r := make([]complex64, len(x)) for i := 0; i < len(r); i++ { r[i] = fft_x[i] * fft_y[i] } return IFFT(r) } // FFT returns the forward FFT of the complex-valued slice. func FFT(x []complex64) []complex64 { lx := len(x) // todo: non-hack handling length <= 1 cases if lx <= 1 { r := make([]complex64, lx) copy(r, x) return r } if dsp.IsPowerOf2(lx) { return radix2FFT(x) } return bluesteinFFT(x) } var ( worker_pool_size = 0 ) // SetWorkerPoolSize sets the number of workers during FFT computation on multicore systems. // If n is 0 (the default), then GOMAXPROCS workers will be created. func SetWorkerPoolSize(n int) { if n < 0 { n = 0 } worker_pool_size = n } // FFT2Real returns the 2-dimensional, forward FFT of the real-valued matrix. func FFT2Real(x [][]float32) [][]complex64 { return FFT2(dsp.ToComplex2(x)) } // FFT2 returns the 2-dimensional, forward FFT of the complex-valued matrix. func FFT2(x [][]complex64) [][]complex64 { return computeFFT2(x, FFT) } // IFFT2Real returns the 2-dimensional, inverse FFT of the real-valued matrix. func IFFT2Real(x [][]float32) [][]complex64 { return IFFT2(dsp.ToComplex2(x)) } // IFFT2 returns the 2-dimensional, inverse FFT of the complex-valued matrix. func IFFT2(x [][]complex64) [][]complex64 { return computeFFT2(x, IFFT) } func computeFFT2(x [][]complex64, fftFunc func([]complex64) []complex64) [][]complex64 { rows := len(x) if rows == 0 { panic("empty input array") } cols := len(x[0]) r := make([][]complex64, rows) for i := 0; i < rows; i++ { if len(x[i]) != cols { panic("ragged input array") } r[i] = make([]complex64, cols) } for i := 0; i < cols; i++ { t := make([]complex64, rows) for j := 0; j < rows; j++ { t[j] = x[j][i] } for n, v := range fftFunc(t) { r[n][i] = v } } for n, v := range r { r[n] = fftFunc(v) } return r } // FFTN returns the forward FFT of the matrix m, computed in all N dimensions. func FFTN(m *dsp.Matrix) *dsp.Matrix { return computeFFTN(m, FFT) } // IFFTN returns the forward FFT of the matrix m, computed in all N dimensions. func IFFTN(m *dsp.Matrix) *dsp.Matrix { return computeFFTN(m, IFFT) } func computeFFTN(m *dsp.Matrix, fftFunc func([]complex64) []complex64) *dsp.Matrix { dims := m.Dimensions() t := m.Copy() r := dsp.MakeEmptyMatrix(dims) for n := range dims { dims[n] -= 1 } for n := range dims { d := make([]int, len(dims)) copy(d, dims) d[n] = -1 for { r.SetDim(fftFunc(t.Dim(d)), d) if !decrDim(d, dims) { break } } r, t = t, r } return t } // decrDim decrements an element of x by 1, skipping all -1s, and wrapping up to d. // If a value is 0, it will be reset to its correspending value in d, and will carry one from the next non -1 value to the right. // Returns true if decremented, else false. func decrDim(x, d []int) bool { for n, v := range x { if v == -1 { continue } else if v == 0 { i := n // find the next element to decrement for ; i < len(x); i++ { if x[i] == -1 { continue } else if x[i] == 0 { x[i] = d[i] } else { x[i] -= 1 return true } } // no decrement return false } else { x[n] -= 1 return true } } return false }
internal/fft/fft.go
0.75985
0.614249
fft.go
starcoder
package graphsample1 import "github.com/wangyoucao577/algorithms_practice/graph" /* This sample undirected graph comes from "Introduction to Algorithms - Third Edition" 22.2 BFS V = 8 (node count) E = 9 (edge count) define undirected graph G(V,E) as below (`s` is the source node): r(0) - s(1) t(2) - u(3) | | / | | v(4) w(5) - x(6) - y(7) */ const ( nodeCount = 8 directedGraph = false ) type nodeIDNameConverter struct { orderedNodesName []string nodeNameToIDMap map[string]graph.NodeID } // define fixed nodes order in the graph, then we use the `index` as nodeID for search, // will be easier to implement by code. // node name only for print. var nodeConverter = nodeIDNameConverter{ []string{"r", "s", "t", "u", "v", "w", "x", "y"}, map[string]graph.NodeID{}, // will be inited during import } // initialization during package import func init() { for i, v := range nodeConverter.orderedNodesName { nodeConverter.nodeNameToIDMap[v] = graph.NodeID(i) } } // IDToName convert NodeID to human readable name func IDToName(i graph.NodeID) string { if i == graph.InvalidNodeID { return "InvalidNodeID" } return nodeConverter.orderedNodesName[i] } // NameToID convert node human readable name to NodeID func NameToID(name string) graph.NodeID { return nodeConverter.nodeNameToIDMap[name] } // AdjacencyListGraphSample return the adjacency list based graph sample instance func AdjacencyListGraphSample() graph.Graph { sample := graph.NewAdjacencyListGraph(nodeCount, directedGraph) return initializeGraphEdges(sample) } // AdjacencyMatrixGraphSample return the adjacency matrix based graph sample instance func AdjacencyMatrixGraphSample() graph.Graph { sample := graph.NewAdjacencyMatrixGraph(nodeCount, directedGraph) return initializeGraphEdges(sample) } func initializeGraphEdges(g graph.Graph) graph.Graph { g.AddEdge(0, 1) g.AddEdge(0, 4) //g.AddEdge(1, 0) g.AddEdge(1, 5) g.AddEdge(2, 3) g.AddEdge(2, 5) g.AddEdge(2, 6) //g.AddEdge(3, 2) g.AddEdge(3, 7) //g.AddEdge(4, 0) //g.AddEdge(5, 1) //g.AddEdge(5, 2) g.AddEdge(5, 6) //g.AddEdge(6, 2) //g.AddEdge(6, 5) g.AddEdge(6, 7) //g.AddEdge(7, 3) //g.AddEdge(7, 6) return g }
graphsamples/graphsample1/sample1.go
0.730386
0.445349
sample1.go
starcoder
package fun // Ordered encompasses commonly used types that can be used in eq/gt/lt operations. type Ordered interface { ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64 | ~string } // ForEach applies the specified return-less function to every item in a slice. func ForEach[T any](items []T, fn func(T)) { for _, item := range items { fn(item) } } // Map applies the specified function to each member of a slice and returns a new slice. func Map[T any](items []T, fn func(T) T) []T { for idx, item := range items { items[idx] = fn(item) } return items } // Filter takes only those items in the slice that satisfy the supplied condition function. func Filter[T any](items []T, fn func(T) bool) []T { is := make([]T, 0) for _, item := range items { if fn(item) { is = append(is, item) } } return is } // Concat combines two slices into a single slice, preserving order. func Concat[T any](items1, items2 []T) []T { for _, item := range items2 { items1 = append(items1, item) } return items1 } // Every determines whether each item in a slice satisfies the supplied condition. func Every[T any](items []T, fn func(T) bool) bool { for _, item := range items { if !fn(item) { return false } } return true } // Any determines whether any item in a slice satisfies the supplied condition. func Any[T any](items []T, fn func(T) bool) bool { var satisfied bool for _, item := range items { if fn(item) { return true } } return satisfied } // Reduce applies the supplied function rightward through the slice and returns the result. func Reduce[T, U any](items []T, fn func(U, T) U) U { var value T for _, item := range items { value = fn(value, item) } return value } // Reverse returns the supplied slice in reverse order. func Reverse[T any](items []T) []T { is := make([]T, 0) for idx := len(items) - 1; idx >= 0; idx-- { is = append(is, items[idx]) } return is } // Pop returns a tuple of the item at the specified index and the remaining slice after that item is removed. func Pop[T any](items []T, idx int) (T, []T) { n := items[idx] return n, append(items[:idx], items[idx+1:]...)[:len(items)-1] } // Push adds an item to the end of the slice. func Push[T any](items []T, item T) []T { return append(items, item) } // Find takes a condition and returns either a pointer to the first value found using that satisfies the condition or nil if no such item is found. func Find[T comparable](items []T, fn func(T) bool) *T { for _, item := range items { if fn(item) { return &item } } return nil } // Includes determines whether the supplied item is included in the slice. func Includes[T comparable](items []T, wanted T) bool { var includes bool for _, item := range items { if item == wanted { return true } } return includes } // Index returns the index of the first instance of the supplied item found or -1 if none is found. func Index[T comparable](items []T, wanted T) int { for idx, item := range items { if item == wanted { return idx } } return -1 } // LastIndexOf returns the index of the last instance of the supplied item found or -1 if none is found. func LastIndexOf[T comparable](items []T, wanted T) int { last := -1 for idx, item := range items { if item == wanted { last = idx } } return last } // Replace replaces the first instance of the supplied value with the desired replacement value. func Replace[T comparable](items []T, discard, replace T) []T { for i := 0; i < len(items)-1; i++ { if items[i] == discard { items[i] = replace break } } return items } // Replace replaces all instances of the supplied value with the desired replacement value. func ReplaceAll[T comparable](items []T, discard, replace T) []T { for idx, item := range items { if item == discard { items[idx] = replace } } return items } // Delete removes the first instance of an item from a slice and returns the resulting slice. func Delete[T comparable](items []T, discard T) []T { for idx, item := range items { if item == discard { items = append(items[:idx], items[idx+1:]...) return items } } return items } // Delete removes all instances of an item from a slice and returns the resulting slice. func DeleteAll[T comparable](items []T, discard T) []T { is := make([]T, 0) for _, item := range items { if item != discard { is = append(is, item) } } return is } // Max returns the maximum value of the slice of Ordered items. func Max[T Ordered](items []T) T { max := items[0] for _, item := range items { if item > max { max = item } } return max } // Min returns the minimum value of the slice of Ordered items. func Min[T Ordered](items []T) T { min := items[0] for _, item := range items { if item < min { min = item } } return min }
fun.go
0.872592
0.455744
fun.go
starcoder
package timeseries import ( "github.com/K-Phoen/grabana/alert" "github.com/K-Phoen/grabana/timeseries/axis" "github.com/K-Phoen/sdk" ) // Option represents an option that can be used to configure a graph panel. type Option func(timeseries *TimeSeries) // TooltipMode configures which series will be displayed in the tooltip. type TooltipMode string const ( // SingleSeries will only display the hovered series. SingleSeries TooltipMode = "single" // AllSeries will display all series. AllSeries TooltipMode = "multi" // NoSeries will hide the tooltip completely. NoSeries TooltipMode = "none" ) // LineInterpolationMode defines how Grafana interpolates series lines when drawn as lines. type LineInterpolationMode string const ( // Points are joined by straight lines. Linear LineInterpolationMode = "linear" // Points are joined by curved lines resulting in smooth transitions between points. Smooth LineInterpolationMode = "smooth" // The line is displayed as steps between points. Points are rendered at the end of the step. StepBefore LineInterpolationMode = "stepBefore" // Line is displayed as steps between points. Points are rendered at the beginning of the step. StepAfter LineInterpolationMode = "stepAfter" ) // BarAlignment defines how Grafana aligns bars. type BarAlignment int const ( // The bar is drawn around the point. The point is placed in the center of the bar. AlignCenter BarAlignment = 0 // The bar is drawn before the point. The point is placed on the trailing corner of the bar. AlignBefore BarAlignment = -1 // The bar is drawn after the point. The point is placed on the leading corner of the bar. AlignAfter BarAlignment = 1 ) // GradientType defines the mode of the gradient fill. type GradientType string const ( // No gradient fill. NoGradient GradientType = "none" // Transparency of the gradient is calculated based on the values on the y-axis. // Opacity of the fill is increasing with the values on the Y-axis. Opacity GradientType = "opacity" // Gradient color is generated based on the hue of the line color. Hue GradientType = "hue" // In this mode the whole bar will use a color gradient defined by the color scheme. Scheme GradientType = "scheme" ) // LegendOption allows to configure a legend. type LegendOption uint16 const ( // Hide keeps the legend from being displayed. Hide LegendOption = iota // AsTable displays the legend as a table. AsTable // AsList displays the legend as a list. AsList // Bottom displays the legend below the graph. Bottom // ToTheRight displays the legend on the right side of the graph. ToTheRight // Min displays the smallest value of the series. Min // Max displays the largest value of the series. Max // Avg displays the average of the series. Avg // First displays the first value of the series. First // FirstNonNull displays the first non-null value of the series. FirstNonNull // Last displays the last value of the series. Last // LastNonNull displays the last non-null value of the series. LastNonNull // Total displays the sum of values in the series. Total // Count displays the number of value in the series. Count // Range displays the difference between the minimum and maximum values. Range ) // TimeSeries represents a time series panel. type TimeSeries struct { Builder *sdk.Panel } // New creates a new time series panel. func New(title string, options ...Option) *TimeSeries { panel := &TimeSeries{Builder: sdk.NewTimeseries(title)} panel.Builder.IsNew = false for _, opt := range append(defaults(), options...) { opt(panel) } return panel } func defaults() []Option { return []Option{ Span(6), LineWidth(1), FillOpacity(25), PointSize(5), Tooltip(SingleSeries), Legend(Bottom, AsList), Lines(Linear), GradientMode(Opacity), Axis( axis.Placement(axis.Auto), axis.Scale(axis.Linear), ), } } // DataSource sets the data source to be used by the graph. func DataSource(source string) Option { return func(timeseries *TimeSeries) { timeseries.Builder.Datasource = &source } } // Tooltip configures the tooltip content. func Tooltip(mode TooltipMode) Option { return func(timeseries *TimeSeries) { timeseries.Builder.TimeseriesPanel.Options.Tooltip.Mode = string(mode) } } // LineWidth defines the width of the line for a series (default 1, max 10, 0 is none). func LineWidth(value int) Option { return func(timeseries *TimeSeries) { timeseries.Builder.TimeseriesPanel.FieldConfig.Defaults.Custom.LineWidth = value } } // FillOpacity defines the opacity level of the series. The lower the value, the more transparent. func FillOpacity(value int) Option { return func(timeseries *TimeSeries) { timeseries.Builder.TimeseriesPanel.FieldConfig.Defaults.Custom.FillOpacity = value } } // PointSize adjusts the size of points. func PointSize(value int) Option { return func(timeseries *TimeSeries) { timeseries.Builder.TimeseriesPanel.FieldConfig.Defaults.Custom.PointSize = value } } // Lines displays the series as lines, with a given interpolation strategy. func Lines(mode LineInterpolationMode) Option { return func(timeseries *TimeSeries) { timeseries.Builder.TimeseriesPanel.FieldConfig.Defaults.Custom.LineInterpolation = string(mode) timeseries.Builder.TimeseriesPanel.FieldConfig.Defaults.Custom.DrawStyle = "line" timeseries.Builder.TimeseriesPanel.FieldConfig.Defaults.Custom.LineStyle = struct { Fill string `json:"fill"` }{ Fill: "solid", } } } // Bars displays the series as bars, with a given alignment strategy. func Bars(alignment BarAlignment) Option { return func(timeseries *TimeSeries) { timeseries.Builder.TimeseriesPanel.FieldConfig.Defaults.Custom.BarAlignment = int(alignment) timeseries.Builder.TimeseriesPanel.FieldConfig.Defaults.Custom.DrawStyle = "bars" } } // Points displays the series as points. func Points() Option { return func(timeseries *TimeSeries) { timeseries.Builder.TimeseriesPanel.FieldConfig.Defaults.Custom.DrawStyle = "points" } } // GradientMode sets the mode of the gradient fill. func GradientMode(mode GradientType) Option { return func(timeseries *TimeSeries) { timeseries.Builder.TimeseriesPanel.FieldConfig.Defaults.Custom.GradientMode = string(mode) } } // Axis configures the axis for this time series. func Axis(options ...axis.Option) Option { return func(timeseries *TimeSeries) { axis.New(&timeseries.Builder.TimeseriesPanel.FieldConfig, options...) } } // Legend defines what should be shown in the legend. func Legend(opts ...LegendOption) Option { return func(timeseries *TimeSeries) { legend := sdk.TimeseriesLegendOptions{ DisplayMode: "list", Placement: "bottom", Calcs: make([]string, 0), } for _, opt := range opts { switch opt { case Hide: legend.DisplayMode = "hidden" case AsList: legend.DisplayMode = "list" case AsTable: legend.DisplayMode = "table" case ToTheRight: legend.Placement = "right" case Bottom: legend.Placement = "bottom" case First: legend.Calcs = append(legend.Calcs, "first") case FirstNonNull: legend.Calcs = append(legend.Calcs, "firstNotNull") case Last: legend.Calcs = append(legend.Calcs, "last") case LastNonNull: legend.Calcs = append(legend.Calcs, "lastNotNull") case Min: legend.Calcs = append(legend.Calcs, "min") case Max: legend.Calcs = append(legend.Calcs, "max") case Avg: legend.Calcs = append(legend.Calcs, "mean") case Count: legend.Calcs = append(legend.Calcs, "count") case Total: legend.Calcs = append(legend.Calcs, "sum") case Range: legend.Calcs = append(legend.Calcs, "range") } } timeseries.Builder.TimeseriesPanel.Options.Legend = legend } } // Span sets the width of the panel, in grid units. Should be a positive // number between 1 and 12. Example: 6. func Span(span float32) Option { return func(timeseries *TimeSeries) { timeseries.Builder.Span = span } } // Height sets the height of the panel, in pixels. Example: "400px". func Height(height string) Option { return func(timeseries *TimeSeries) { timeseries.Builder.Height = &height } } // Description annotates the current visualization with a human-readable description. func Description(content string) Option { return func(timeseries *TimeSeries) { timeseries.Builder.Description = &content } } // Transparent makes the background transparent. func Transparent() Option { return func(timeseries *TimeSeries) { timeseries.Builder.Transparent = true } } // Alert creates an alert for this graph. func Alert(name string, opts ...alert.Option) Option { return func(timeseries *TimeSeries) { timeseries.Builder.Alert = alert.New(name, opts...).Builder } } // Repeat configures repeating a panel for a variable func Repeat(repeat string) Option { return func(timeseries *TimeSeries) { timeseries.Builder.Repeat = &repeat } }
vendor/github.com/K-Phoen/grabana/timeseries/timeseries.go
0.788543
0.566618
timeseries.go
starcoder
package texture import ( g2d "github.com/jphsd/graphics2d" "image/color" "image/draw" "math" ) // Halftone renders colored halftone dots into the destination image. Line separation, rotation // and percentage fill with a point offset (from {0, 0}) control the dot locations. func Halftone(dst draw.Image, c color.Color, perc, sep, rot float64, offs []float64) { r := dst.Bounds() if perc <= 0 { return } else if perc > 1 { perc = 1 } rad := perc2radius(perc) // Circle path template centered on 0, 0 circp := g2d.Circle([]float64{0, 0}, rad*sep) // Calculate grid of centers l := r.Max.X if l < r.Max.Y { l = r.Max.Y } lf := 1.5 * float64(l) // [-lf,lf]^2 n := int(math.Ceil(2*lf/sep)) + 1 points := make([][]float64, 1, n*n) points[0] = []float64{0, 0} // Axis for i := sep; i < lf; i += sep { points = append(points, []float64{0, i}, []float64{0, -i}, []float64{i, 0}, []float64{-i, 0}) } for y := sep; y < lf; y += sep { for x := sep; x < lf; x += sep { points = append(points, []float64{x, y}, []float64{x, -y}, []float64{-x, y}, []float64{-x, -y}) } } // Handle offs and rot for offs[0] < 0 { offs[0] += sep } for offs[0] > sep { offs[0] -= sep } for offs[1] < 0 { offs[1] += sep } for offs[1] > sep { offs[1] -= sep } for rot < 0 { rot += math.Pi } for rot > math.Pi { rot -= math.Pi } xfm := g2d.NewAff3() xfm.Translate(offs[0], offs[1]) xfm.Rotate(rot) points = xfm.Apply(points...) // Construct shape with dots in it at each point location shape := &g2d.Shape{} for _, pt := range points { xfm := g2d.NewAff3() xfm.Translate(pt[0], pt[1]) shape.AddPaths(circp.Transform(xfm)) } // Write to image g2d.RenderColoredShape(dst, shape, c) } // Precalculated radius to percentage for once dots start to overlap var lut = [][]float64{ {0.5, 0.785398163}, {0.51, 0.811757717}, {0.52, 0.834192027}, {0.53, 0.854184781}, {0.54, 0.872243896}, {0.55, 0.888652751}, {0.56, 0.903596183}, {0.57, 0.917205474}, {0.58, 0.929579102}, {0.59, 0.940793811}, {0.6, 0.950911131}, {0.61, 0.959981487}, {0.62, 0.968046934}, {0.63, 0.975143051}, {0.64, 0.981300303}, {0.65, 0.986545039}, {0.66, 0.990900248}, {0.67, 0.994386142}, {0.68, 0.997020609}, {0.69, 0.998819573}, {0.7, 0.999797286}, {0.71, 1}, } func perc2radius(perc float64) float64 { // For r <= 0.5 there's no overlap so simple calculation if perc < lut[0][1] { return math.Sqrt(perc / math.Pi) } var i int for i = 0; lut[i][1] < perc; i++ { } // Linear interp r0, r1 := lut[i-1][0], lut[i][0] p0, p1 := lut[i-1][1], lut[i][1] t := (perc - p0) / (p1 - p0) return r0*(1-t) + r1*t }
image/texture/halftone.go
0.708818
0.458773
halftone.go
starcoder
package plan import ( "fmt" "github.com/m3db/m3/src/query/parser" ) // LogicalPlan converts a DAG into a list of steps to be executed in order type LogicalPlan struct { Steps map[parser.NodeID]LogicalStep Pipeline []parser.NodeID // Ordered list of steps to be performed } // LogicalStep is a single step in a logical plan type LogicalStep struct { Parents []parser.NodeID Children []parser.NodeID Transform parser.Node } // NewLogicalPlan creates a plan from the DAG structure func NewLogicalPlan(transforms parser.Nodes, edges parser.Edges) (LogicalPlan, error) { lp := LogicalPlan{ Steps: make(map[parser.NodeID]LogicalStep), Pipeline: make([]parser.NodeID, 0, len(transforms)), } // Create all steps for _, transform := range transforms { lp.Steps[transform.ID] = LogicalStep{ Transform: transform, Parents: make([]parser.NodeID, 0, 1), Children: make([]parser.NodeID, 0, 1), } lp.Pipeline = append(lp.Pipeline, transform.ID) } // Link all parent/children for _, edge := range edges { parent, ok := lp.Steps[edge.ParentID] if !ok { return LogicalPlan{}, fmt.Errorf("invalid DAG found, parent %s not found for child %s", edge.ParentID, edge.ChildID) } child, ok := lp.Steps[edge.ChildID] if !ok { return LogicalPlan{}, fmt.Errorf("invalid DAG found, child %s not found for parent %s", edge.ChildID, edge.ParentID) } parent.Children = append(parent.Children, child.ID()) child.Parents = append(child.Parents, parent.ID()) // Write back since we are doing copy instead reference lp.Steps[edge.ParentID] = parent lp.Steps[edge.ChildID] = child } return lp, nil } func (l LogicalPlan) String() string { return fmt.Sprintf("Plan steps: %s, Pipeline: %s", l.Steps, l.Pipeline) } // Clone the plan func (l LogicalPlan) Clone() LogicalPlan { steps := make(map[parser.NodeID]LogicalStep, len(l.Steps)) for id, step := range l.Steps { steps[id] = step.Clone() } pipeline := make([]parser.NodeID, len(l.Pipeline)) copy(pipeline, l.Pipeline) return LogicalPlan{ Steps: steps, Pipeline: pipeline, } } func (l LogicalStep) String() string { return fmt.Sprintf("Parents: %s, Children: %s, Transform: %s", l.Parents, l.Children, l.Transform) } // ID is a convenience method to expose the inner transforms' ID func (l LogicalStep) ID() parser.NodeID { return l.Transform.ID } // Clone the step, the transform is immutable so its left as is func (l LogicalStep) Clone() LogicalStep { parents := make([]parser.NodeID, len(l.Parents)) copy(parents, l.Parents) children := make([]parser.NodeID, len(l.Children)) copy(children, l.Children) return LogicalStep{ Transform: l.Transform, Parents: parents, Children: children, } }
src/query/plan/logical.go
0.682468
0.565239
logical.go
starcoder
// Package atomic provides simple wrappers around numerics to enforce atomic // access. package atomic import ( "math" "sync/atomic" "time" ) // Int32 is an atomic wrapper around an int32. type Int32 struct{ v int32 } // NewInt32 creates an Int32. func NewInt32(i int32) *Int32 { return &Int32{i} } // Load atomically loads the wrapped value. func (i *Int32) Load() int32 { return atomic.LoadInt32(&i.v) } // Add atomically adds to the wrapped int32 and returns the new value. func (i *Int32) Add(n int32) int32 { return atomic.AddInt32(&i.v, n) } // Sub atomically subtracts from the wrapped int32 and returns the new value. func (i *Int32) Sub(n int32) int32 { return atomic.AddInt32(&i.v, -n) } // Inc atomically increments the wrapped int32 and returns the new value. func (i *Int32) Inc() int32 { return i.Add(1) } // Dec atomically decrements the wrapped int32 and returns the new value. func (i *Int32) Dec() int32 { return i.Sub(1) } // CAS is an atomic compare-and-swap. func (i *Int32) CAS(old, new int32) bool { return atomic.CompareAndSwapInt32(&i.v, old, new) } // Store atomically stores the passed value. func (i *Int32) Store(n int32) { atomic.StoreInt32(&i.v, n) } // Swap atomically swaps the wrapped int32 and returns the old value. func (i *Int32) Swap(n int32) int32 { return atomic.SwapInt32(&i.v, n) } // Int64 is an atomic wrapper around an int64. type Int64 struct{ v int64 } // NewInt64 creates an Int64. func NewInt64(i int64) *Int64 { return &Int64{i} } // Load atomically loads the wrapped value. func (i *Int64) Load() int64 { return atomic.LoadInt64(&i.v) } // Add atomically adds to the wrapped int64 and returns the new value. func (i *Int64) Add(n int64) int64 { return atomic.AddInt64(&i.v, n) } // Sub atomically subtracts from the wrapped int64 and returns the new value. func (i *Int64) Sub(n int64) int64 { return atomic.AddInt64(&i.v, -n) } // Inc atomically increments the wrapped int64 and returns the new value. func (i *Int64) Inc() int64 { return i.Add(1) } // Dec atomically decrements the wrapped int64 and returns the new value. func (i *Int64) Dec() int64 { return i.Sub(1) } // CAS is an atomic compare-and-swap. func (i *Int64) CAS(old, new int64) bool { return atomic.CompareAndSwapInt64(&i.v, old, new) } // Store atomically stores the passed value. func (i *Int64) Store(n int64) { atomic.StoreInt64(&i.v, n) } // Swap atomically swaps the wrapped int64 and returns the old value. func (i *Int64) Swap(n int64) int64 { return atomic.SwapInt64(&i.v, n) } // Uint32 is an atomic wrapper around an uint32. type Uint32 struct{ v uint32 } // NewUint32 creates a Uint32. func NewUint32(i uint32) *Uint32 { return &Uint32{i} } // Load atomically loads the wrapped value. func (i *Uint32) Load() uint32 { return atomic.LoadUint32(&i.v) } // Add atomically adds to the wrapped uint32 and returns the new value. func (i *Uint32) Add(n uint32) uint32 { return atomic.AddUint32(&i.v, n) } // Sub atomically subtracts from the wrapped uint32 and returns the new value. func (i *Uint32) Sub(n uint32) uint32 { return atomic.AddUint32(&i.v, ^(n - 1)) } // Inc atomically increments the wrapped uint32 and returns the new value. func (i *Uint32) Inc() uint32 { return i.Add(1) } // Dec atomically decrements the wrapped int32 and returns the new value. func (i *Uint32) Dec() uint32 { return i.Sub(1) } // CAS is an atomic compare-and-swap. func (i *Uint32) CAS(old, new uint32) bool { return atomic.CompareAndSwapUint32(&i.v, old, new) } // Store atomically stores the passed value. func (i *Uint32) Store(n uint32) { atomic.StoreUint32(&i.v, n) } // Swap atomically swaps the wrapped uint32 and returns the old value. func (i *Uint32) Swap(n uint32) uint32 { return atomic.SwapUint32(&i.v, n) } // Uint64 is an atomic wrapper around a uint64. type Uint64 struct{ v uint64 } // NewUint64 creates a Uint64. func NewUint64(i uint64) *Uint64 { return &Uint64{i} } // Load atomically loads the wrapped value. func (i *Uint64) Load() uint64 { return atomic.LoadUint64(&i.v) } // Add atomically adds to the wrapped uint64 and returns the new value. func (i *Uint64) Add(n uint64) uint64 { return atomic.AddUint64(&i.v, n) } // Sub atomically subtracts from the wrapped uint64 and returns the new value. func (i *Uint64) Sub(n uint64) uint64 { return atomic.AddUint64(&i.v, ^(n - 1)) } // Inc atomically increments the wrapped uint64 and returns the new value. func (i *Uint64) Inc() uint64 { return i.Add(1) } // Dec atomically decrements the wrapped uint64 and returns the new value. func (i *Uint64) Dec() uint64 { return i.Sub(1) } // CAS is an atomic compare-and-swap. func (i *Uint64) CAS(old, new uint64) bool { return atomic.CompareAndSwapUint64(&i.v, old, new) } // Store atomically stores the passed value. func (i *Uint64) Store(n uint64) { atomic.StoreUint64(&i.v, n) } // Swap atomically swaps the wrapped uint64 and returns the old value. func (i *Uint64) Swap(n uint64) uint64 { return atomic.SwapUint64(&i.v, n) } // Bool is an atomic Boolean. type Bool struct{ v uint32 } // NewBool creates a Bool. func NewBool(initial bool) *Bool { return &Bool{boolToInt(initial)} } // Load atomically loads the Boolean. func (b *Bool) Load() bool { return truthy(atomic.LoadUint32(&b.v)) } // CAS is an atomic compare-and-swap. func (b *Bool) CAS(old, new bool) bool { return atomic.CompareAndSwapUint32(&b.v, boolToInt(old), boolToInt(new)) } // Store atomically stores the passed value. func (b *Bool) Store(new bool) { atomic.StoreUint32(&b.v, boolToInt(new)) } // Swap sets the given value and returns the previous value. func (b *Bool) Swap(new bool) bool { return truthy(atomic.SwapUint32(&b.v, boolToInt(new))) } // Toggle atomically negates the Boolean and returns the previous value. func (b *Bool) Toggle() bool { for { old := b.Load() if b.CAS(old, !old) { return old } } } func truthy(n uint32) bool { return n == 1 } func boolToInt(b bool) uint32 { if b { return 1 } return 0 } // Float64 is an atomic wrapper around float64. type Float64 struct { v uint64 } // NewFloat64 creates a Float64. func NewFloat64(f float64) *Float64 { return &Float64{math.Float64bits(f)} } // Load atomically loads the wrapped value. func (f *Float64) Load() float64 { return math.Float64frombits(atomic.LoadUint64(&f.v)) } // Store atomically stores the passed value. func (f *Float64) Store(s float64) { atomic.StoreUint64(&f.v, math.Float64bits(s)) } // Add atomically adds to the wrapped float64 and returns the new value. func (f *Float64) Add(s float64) float64 { for { old := f.Load() new := old + s if f.CAS(old, new) { return new } } } // Sub atomically subtracts from the wrapped float64 and returns the new value. func (f *Float64) Sub(s float64) float64 { return f.Add(-s) } // CAS is an atomic compare-and-swap. func (f *Float64) CAS(old, new float64) bool { return atomic.CompareAndSwapUint64(&f.v, math.Float64bits(old), math.Float64bits(new)) } // Duration is an atomic wrapper around time.Duration // https://godoc.org/time#Duration type Duration struct { v Int64 } // NewDuration creates a Duration. func NewDuration(d time.Duration) *Duration { return &Duration{v: *NewInt64(int64(d))} } // Load atomically loads the wrapped value. func (d *Duration) Load() time.Duration { return time.Duration(d.v.Load()) } // Store atomically stores the passed value. func (d *Duration) Store(n time.Duration) { d.v.Store(int64(n)) } // Add atomically adds to the wrapped time.Duration and returns the new value. func (d *Duration) Add(n time.Duration) time.Duration { return time.Duration(d.v.Add(int64(n))) } // Sub atomically subtracts from the wrapped time.Duration and returns the new value. func (d *Duration) Sub(n time.Duration) time.Duration { return time.Duration(d.v.Sub(int64(n))) } // Swap atomically swaps the wrapped time.Duration and returns the old value. func (d *Duration) Swap(n time.Duration) time.Duration { return time.Duration(d.v.Swap(int64(n))) } // CAS is an atomic compare-and-swap. func (d *Duration) CAS(old, new time.Duration) bool { return d.v.CAS(int64(old), int64(new)) } // Value shadows the type of the same name from sync/atomic // https://godoc.org/sync/atomic#Value type Value struct{ atomic.Value }
vendor/go.uber.org/atomic/atomic.go
0.873674
0.500366
atomic.go
starcoder
package coldata import ( "time" "github.com/cockroachdb/apd/v2" "github.com/cockroachdb/cockroach/pkg/util/duration" ) // Bools is a slice of bool. type Bools []bool // Int16s is a slice of int16. type Int16s []int16 // Int32s is a slice of int32. type Int32s []int32 // Int64s is a slice of int64. type Int64s []int64 // Float64s is a slice of float64. type Float64s []float64 // Decimals is a slice of apd.Decimal. type Decimals []apd.Decimal // Times is a slice of time.Time. type Times []time.Time // Durations is a slice of duration.Duration. type Durations []duration.Duration // Get returns the element at index idx of the vector. The element cannot be // used anymore once the vector is modified. //gcassert:inline func (c Bools) Get(idx int) bool { return c[idx] } // Get returns the element at index idx of the vector. The element cannot be // used anymore once the vector is modified. //gcassert:inline func (c Int16s) Get(idx int) int16 { return c[idx] } // Get returns the element at index idx of the vector. The element cannot be // used anymore once the vector is modified. //gcassert:inline func (c Int32s) Get(idx int) int32 { return c[idx] } // Get returns the element at index idx of the vector. The element cannot be // used anymore once the vector is modified. //gcassert:inline func (c Int64s) Get(idx int) int64 { return c[idx] } // Get returns the element at index idx of the vector. The element cannot be // used anymore once the vector is modified. //gcassert:inline func (c Float64s) Get(idx int) float64 { return c[idx] } // Get returns the element at index idx of the vector. The element cannot be // used anymore once the vector is modified. //gcassert:inline func (c Decimals) Get(idx int) apd.Decimal { return c[idx] } // Get returns the element at index idx of the vector. The element cannot be // used anymore once the vector is modified. //gcassert:inline func (c Times) Get(idx int) time.Time { return c[idx] } // Get returns the element at index idx of the vector. The element cannot be // used anymore once the vector is modified. //gcassert:inline func (c Durations) Get(idx int) duration.Duration { return c[idx] } // Len returns the length of the vector. func (c Bools) Len() int { return len(c) } // Len returns the length of the vector. func (c Int16s) Len() int { return len(c) } // Len returns the length of the vector. func (c Int32s) Len() int { return len(c) } // Len returns the length of the vector. func (c Int64s) Len() int { return len(c) } // Len returns the length of the vector. func (c Float64s) Len() int { return len(c) } // Len returns the length of the vector. func (c Decimals) Len() int { return len(c) } // Len returns the length of the vector. func (c Times) Len() int { return len(c) } // Len returns the length of the vector. func (c Durations) Len() int { return len(c) }
pkg/col/coldata/native_types.go
0.788868
0.520435
native_types.go
starcoder
package packed // Efficient sequential read/write of packed integers. type BulkOperationPacked3 struct { *BulkOperationPacked } func newBulkOperationPacked3() BulkOperation { return &BulkOperationPacked3{newBulkOperationPacked(3)} } func (op *BulkOperationPacked3) decodeLongToInt(blocks []int64, values []int32, iterations int) { blocksOffset, valuesOffset := 0, 0 for i := 0; i < iterations; i++ { block0 := blocks[blocksOffset] blocksOffset++ values[valuesOffset] = int32(int64(uint64(block0) >> 61)) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>58) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>55) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>52) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>49) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>46) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>43) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>40) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>37) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>34) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>31) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>28) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>25) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>22) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>19) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>16) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>13) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>10) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>7) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>4) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block0)>>1) & 7) valuesOffset++ block1 := blocks[blocksOffset] blocksOffset++ values[valuesOffset] = int32(((block0 & 1) << 2) | (int64(uint64(block1) >> 62))) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>59) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>56) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>53) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>50) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>47) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>44) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>41) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>38) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>35) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>32) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>29) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>26) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>23) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>20) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>17) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>14) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>11) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>8) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>5) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block1)>>2) & 7) valuesOffset++ block2 := blocks[blocksOffset] blocksOffset++ values[valuesOffset] = int32(((block1 & 3) << 1) | (int64(uint64(block2) >> 63))) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>60) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>57) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>54) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>51) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>48) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>45) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>42) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>39) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>36) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>33) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>30) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>27) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>24) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>21) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>18) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>15) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>12) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>9) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>6) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint64(block2)>>3) & 7) valuesOffset++ values[valuesOffset] = int32(block2 & 7) valuesOffset++ } } func (op *BulkOperationPacked3) DecodeByteToInt(blocks []byte, values []int32, iterations int) { blocksOffset, valuesOffset := 0, 0 for i := 0; i < iterations; i++ { byte0 := blocks[blocksOffset] blocksOffset++ values[valuesOffset] = int32(int64(uint8(byte0) >> 5)) valuesOffset++ values[valuesOffset] = int32(int64(uint8(byte0)>>2) & 7) valuesOffset++ byte1 := blocks[blocksOffset] blocksOffset++ values[valuesOffset] = int32((int64(byte0&3) << 1) | int64(uint8(byte1)>>7)) valuesOffset++ values[valuesOffset] = int32(int64(uint8(byte1)>>4) & 7) valuesOffset++ values[valuesOffset] = int32(int64(uint8(byte1)>>1) & 7) valuesOffset++ byte2 := blocks[blocksOffset] blocksOffset++ values[valuesOffset] = int32((int64(byte1&1) << 2) | int64(uint8(byte2)>>6)) valuesOffset++ values[valuesOffset] = int32(int64(uint8(byte2)>>3) & 7) valuesOffset++ values[valuesOffset] = int32(int64(byte2) & 7) valuesOffset++ } } func (op *BulkOperationPacked3) DecodeLongToLong(blocks []int64, values []int64, iterations int) { blocksOffset, valuesOffset := 0, 0 for i := 0; i < iterations; i++ { block0 := blocks[blocksOffset] blocksOffset++ values[valuesOffset] = int64(uint64(block0) >> 61) valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>58) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>55) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>52) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>49) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>46) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>43) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>40) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>37) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>34) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>31) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>28) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>25) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>22) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>19) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>16) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>13) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>10) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>7) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>4) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block0)>>1) & 7 valuesOffset++ block1 := blocks[blocksOffset] blocksOffset++ values[valuesOffset] = ((block0 & 1) << 2) | (int64(uint64(block1) >> 62)) valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>59) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>56) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>53) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>50) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>47) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>44) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>41) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>38) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>35) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>32) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>29) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>26) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>23) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>20) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>17) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>14) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>11) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>8) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>5) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block1)>>2) & 7 valuesOffset++ block2 := blocks[blocksOffset] blocksOffset++ values[valuesOffset] = ((block1 & 3) << 1) | (int64(uint64(block2) >> 63)) valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>60) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>57) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>54) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>51) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>48) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>45) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>42) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>39) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>36) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>33) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>30) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>27) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>24) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>21) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>18) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>15) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>12) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>9) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>6) & 7 valuesOffset++ values[valuesOffset] = int64(uint64(block2)>>3) & 7 valuesOffset++ values[valuesOffset] = block2 & 7 valuesOffset++ } } func (op *BulkOperationPacked3) decodeByteToLong(blocks []byte, values []int64, iterations int) { blocksOffset, valuesOffset := 0, 0 for i := 0; i < iterations; i++ { byte0 := blocks[blocksOffset] blocksOffset++ values[valuesOffset] = int64(int64(uint8(byte0) >> 5)) valuesOffset++ values[valuesOffset] = int64(int64(uint8(byte0)>>2) & 7) valuesOffset++ byte1 := blocks[blocksOffset] blocksOffset++ values[valuesOffset] = int64((int64(byte0&3) << 1) | int64(uint8(byte1)>>7)) valuesOffset++ values[valuesOffset] = int64(int64(uint8(byte1)>>4) & 7) valuesOffset++ values[valuesOffset] = int64(int64(uint8(byte1)>>1) & 7) valuesOffset++ byte2 := blocks[blocksOffset] blocksOffset++ values[valuesOffset] = int64((int64(byte1&1) << 2) | int64(uint8(byte2)>>6)) valuesOffset++ values[valuesOffset] = int64(int64(uint8(byte2)>>3) & 7) valuesOffset++ values[valuesOffset] = int64(int64(byte2) & 7) valuesOffset++ } }
core/util/packed/bulkOperation3.go
0.568056
0.722282
bulkOperation3.go
starcoder
package math import ( "math" "github.com/tdhite/kwite/internal/tplfunc/funcs" ) func E() float64 { return math.E } func Pi() float64 { return math.Pi } func Phi() float64 { return math.Phi } func Sqrt2() float64 { return math.Sqrt2 } func SqrtE() float64 { return math.SqrtE } func SqrtPi() float64 { return math.SqrtPi } func SqrtPhi() float64 { return math.SqrtPhi } func Ln2() float64 { return math.Ln2 } func Log2E() float64 { return math.Log2E } func Ln10() float64 { return math.Ln10 } func Log10E() float64 { return math.Log10E } // Adds all methods from the math package func LoadFuncs() error { f := map[string]interface{}{ // constants "E": E, "Pi": Pi, "Phi": Phi, "Sqrt2": Sqrt2, "SqrtE": SqrtE, "SqrtPi": SqrtPi, "SqrtPhi": SqrtPhi, "Ln2": Ln2, "Log2E": Log2E, "Ln10": Ln10, "Log10E": Log10E, // imported funcs "Abs": math.Abs, "Acos": math.Acos, "Acosh": math.Acosh, "Asin": math.Asin, "Asinh": math.Asinh, "Atan": math.Atan, "Atan2": math.Atan2, "Atanh": math.Atanh, "Cbrt": math.Cbrt, "Ceil": math.Ceil, "Copysign": math.Copysign, "Cos": math.Cos, "Cosh": math.Cosh, "Dim": math.Dim, "Erf": math.Erf, "Erfc": math.Erfc, "Erfcinv": math.Erfcinv, "Erfinv": math.Erfinv, "Exp": math.Exp, "Exp2": math.Exp2, "Expm1": math.Expm1, "Float32bits": math.Float32bits, "Float32frombits": math.Float32frombits, "Float64bits": math.Float64bits, "Float64frombits": math.Float64frombits, "Floor": math.Floor, //"Frexp": math.Frexp, "Gamma": math.Gamma, "Hypot": math.Hypot, "Ilogb": math.Ilogb, "Inf": math.Inf, "IsInf": math.IsInf, "IsNaN": math.IsNaN, "J0": math.J0, "J1": math.J1, "Jn": math.Jn, "Ldexp": math.Ldexp, // "Lgamma": math.Lgamma, "Log": math.Log, "Log10": math.Log10, "Log1p": math.Log1p, "Log2": math.Log2, "Logb": math.Logb, "Max": math.Max, "Min": math.Min, "Mod": math.Mod, //"Modf": math.Modf, "NaN": math.NaN, "Nextafter": math.Nextafter, "Nextafter32": math.Nextafter32, "Pow": math.Pow, "Pow10": math.Pow10, "Remainder": math.Remainder, "Round": math.Round, "RoundToEven": math.RoundToEven, "Signbit": math.Signbit, "Sin": math.Sin, //"Sincos": math.Sincos, "Sinh": math.Sinh, "Sqrt": math.Sqrt, "Tan": math.Tan, "Tanh": math.Tanh, "Trunc": math.Trunc, "Y0": math.Y0, "Y1": math.Y1, "Yn": math.Yn, } return funcs.AddMethods(f) }
internal/tplfunc/math/math.go
0.726717
0.499878
math.go
starcoder
package bo import ( "math" "math/rand" ) // SampleTries is the number of tries a sample function should try before // truncating the samples to the boundaries. var SampleTries = 1000 // Param represents a parameter that can be optimized. type Param interface { // GetName returns the name of the parameter. GetName() string // GetMax returns the maximum value. GetMax() float64 // GetMin returns the minimum value. GetMin() float64 // Sample returns a random point within the bounds. It doesn't have to be // uniformly distributed. Sample() float64 } var _ Param = UniformParam{} // UniformParam is a uniformly distributed parameter between Max and Min. type UniformParam struct { Name string Max, Min float64 } // GetName implements Param. func (p UniformParam) GetName() string { return p.Name } // GetMax implements Param. func (p UniformParam) GetMax() float64 { return p.Max } // GetMin implements Param. func (p UniformParam) GetMin() float64 { return p.Min } // Sample implements Param. func (p UniformParam) Sample() float64 { return rand.Float64()*(p.Max-p.Min) + p.Min } var _ Param = NormalParam{} // NormalParam is a normally distributed parameter with Mean and StdDev. // The Max and Min parameters use discard sampling to find a point between them. // Set them to be math.Inf(1) and math.Inf(-1) to disable the bounds. type NormalParam struct { Name string Max, Min float64 Mean, StdDev float64 } // GetName implements Param. func (p NormalParam) GetName() string { return p.Name } // GetMax implements Param. func (p NormalParam) GetMax() float64 { return p.Max } // GetMin implements Param. func (p NormalParam) GetMin() float64 { return p.Min } // Sample implements Param. func (p NormalParam) Sample() float64 { return truncateSample(p, func() float64 { return rand.NormFloat64()*p.StdDev + p.Mean }) } var _ Param = ExponentialParam{} // ExponentialParam is an exponentially distributed parameter between 0 and in // the range (0, +math.MaxFloat64] whose rate parameter (lambda) is Rate and // whose mean is 1/lambda (1). // The Max and Min parameters use discard sampling to find a point between them. // Set them to be math.Inf(1) and math.Inf(-1) to disable the bounds. type ExponentialParam struct { Name string Max, Min float64 Rate float64 } // GetName implements Param. func (p ExponentialParam) GetName() string { return p.Name } // GetMax implements Param. func (p ExponentialParam) GetMax() float64 { return p.Max } // GetMin implements Param. func (p ExponentialParam) GetMin() float64 { return p.Min } // Sample implements Param. func (p ExponentialParam) Sample() float64 { return truncateSample(p, func() float64 { return rand.ExpFloat64() / p.Rate }) } func truncateSample(p Param, f func() float64) float64 { max := p.GetMax() min := p.GetMin() var sample float64 for i := 0; i < SampleTries; i++ { sample = f() if sample >= min && sample <= max { return sample } } return math.Min(math.Max(sample, min), max) } // RejectionParam samples from Param and then uses F to decide whether or not to // reject the sample. This is typically used with a UniformParam. F should // output a value between 0 and 1 indicating the proportion of samples this // point should be accepted. If F always outputs 0, Sample will get stuck in an // infinite loop. type RejectionParam struct { Param F func(x float64) float64 } // Sample implements Param. func (p RejectionParam) Sample() float64 { for { x := p.Param.Sample() y := p.F(x) if rand.Float64() < y { return x } } }
param.go
0.868548
0.6137
param.go
starcoder
package compoundInterest import ( "math" "time" ) const numberOfMonthsInYear float64 = 12 type compoundInterest struct { params Params countMonthDeposit int percentMonth float64 coefficient float64 month int } type Predictor interface { Calculate() []Prediction getDate(countMonth int) time.Time getAmount(month int) float64 getPercent(amount float64, percent float64) float64 getPrediction(countMonth int) Prediction updateParamsWithInflation(initialPayment float64) } func New(params Params) Predictor { var p Predictor percentMonth := (params.PercentRate / 100) / numberOfMonthsInYear p = &compoundInterest{ params: params, countMonthDeposit: int(params.InvestmentTermInYears * numberOfMonthsInYear), percentMonth: percentMonth, month: 1, coefficient: 1 + percentMonth, } return p } func (c *compoundInterest) Calculate() []Prediction { result := make([]Prediction, c.countMonthDeposit, c.countMonthDeposit) for countMonth := 1; countMonth <= c.countMonthDeposit; countMonth++ { result[countMonth-1] = c.getPrediction(countMonth) c.month++ if countMonth%int(numberOfMonthsInYear) == 0 { c.updateParamsWithInflation(result[countMonth-1].Amount) } } return result } func (c *compoundInterest) getDate(month int) time.Time { return c.params.DateStart.AddDate(0, month, 0) } func (c *compoundInterest) getAmount(month int) float64 { return c.params.InitialPayment* math.Pow(c.coefficient, float64(month)) + (c.params.MonthlyPayment*math.Pow(c.coefficient, float64(month))* c.coefficient-c.params.MonthlyPayment*c.coefficient)/ c.percentMonth } func (c *compoundInterest) getPercent(amount float64, percent float64) float64 { return (amount / 100) * percent } func (c *compoundInterest) getPrediction(countMonth int) Prediction { var prediction Prediction prediction.Date = c.getDate(countMonth) prediction.Amount = c.getAmount(c.month) prediction.MonthlyDividend = c.getPercent(prediction.Amount, c.params.AvgPercentDividend) / numberOfMonthsInYear prediction.MonthlyPayment = c.params.MonthlyPayment prediction.AvgPercentDividend = c.params.AvgPercentDividend return prediction } func (c *compoundInterest) updateParamsWithInflation(initialPayment float64) { c.params.InitialPayment = initialPayment c.month = 1 c.params.MonthlyPayment = c.getPercent(c.params.MonthlyPayment, c.params.AnnualPercentageIncreaseInMonthlyPayment) + c.params.MonthlyPayment c.params.AvgPercentDividend = c.getPercent(c.params.AvgPercentDividend, c.params.AnnualPercentageIncreaseDividend) + c.params.AvgPercentDividend }
compoundInterest.go
0.772187
0.544559
compoundInterest.go
starcoder
package ws281x import ( "bytes" ) // FBS can be used to implement a frame buffer for SPI based WS281x driver. FBS // encoding uses one byte of memory to encode two WS281x bits (12 bytes/pixel). type FBS struct { data []byte } // MakeFBS allocates memory for string of n pixels. func MakeFBS(n int) FBS { return FBS{make([]byte, n*12+1)} } // AsFBS returns FBS using b as data storage. For n pixels n*12+1 bytes are need. func AsFBS(b []byte) FBS { b[len(b)-1] = 0 // STM32 SPI leaves MOSI high if last byte has LSBit set. return FBS{b} } // PixelSize returns pixel size in bytes (always 12). func (_ FBS) PixelSize() int { return 12 } // Len returns FBS length as number of pixels. func (s FBS) Len() int { return len(s.data) / 12 } // At returns slice of p that contains p.Len()-n pixels starting from n. func (s FBS) At(n int) FBS { return FBS{s.data[n*12:]} } // Head returns slice of p that contains n pixels starting from 0. func (s FBS) Head(n int) FBS { return FBS{s.data[:n*12]} } const zeroSPI = 0x88 // EncodeRGB encodes c to one pixel at begining of s in WS2811 RGB order. func (s FBS) EncodeRGB(c Color) { r, g, b := c.Red(), c.Green(), c.Blue() for n := uint(0); n < 4; n++ { s.data[3-n] = byte(zeroSPI | r>>(2*n+1)&1<<6 | r>>(2*n)&1<<4) s.data[7-n] = byte(zeroSPI | g>>(2*n+1)&1<<6 | g>>(2*n)&1<<4) s.data[11-n] = byte(zeroSPI | b>>(2*n+1)&1<<6 | b>>(2*n)&1<<4) } } // EncodeGRB encodes c to one pixel at begining of s in WS2812 GRB order. func (s FBS) EncodeGRB(c Color) { r, g, b := c.Red(), c.Green(), c.Blue() for n := uint(0); n < 4; n++ { s.data[3-n] = byte(zeroSPI | g>>(2*n+1)&1<<6 | g>>(2*n)&1<<4) s.data[7-n] = byte(zeroSPI | r>>(2*n+1)&1<<6 | r>>(2*n)&1<<4) s.data[11-n] = byte(zeroSPI | b>>(2*n+1)&1<<6 | b>>(2*n)&1<<4) } } // Bytes returns p's internal storage. func (s FBS) Bytes() []byte { return s.data } // Write writes src to beginning of s. func (s FBS) Write(src FBS) { copy(s.Bytes(), src.Bytes()) } // Fill fills whole s using pattern p. func (s FBS) Fill(p FBS) { sb := s.Bytes() pb := p.Bytes() for i := 0; i < len(sb); i += copy(sb[i:], pb) { } } // Clear clears whole s to black color. func (s FBS) Clear() { bytes.Fill(s.data[:len(s.data)-1], zeroSPI) }
egpath/src/ws281x/fbs.go
0.725357
0.445107
fbs.go
starcoder
package node type Trie struct { data any path string children []*Trie lookup []byte isWildcard bool } func (trie *Trie) Add(path string, data any) error { if trie.path == "" || trie.path == path { return trie.set(path, data) } current := trie commonIdx := commonPrefix(path, current.path) isWildcard := path[len(path)-1] == '*' for ; commonIdx == len(current.path); commonIdx = commonPrefix(path, current.path) { if commonIdx == len(path) { return current.set("", data) } if isWildcard && commonIdx == len(path)-1 { current.isWildcard = true return current.set("", data) } path = path[commonIdx:] lookupIdx := current.findChildIndex(path[0]) if lookupIdx == -1 { return current.createNew(path, data) } current = current.children[lookupIdx] } current.createSplit(commonIdx, path, data) return nil } func (trie *Trie) Get(path string) (current *Trie, err error) { var wildcard *Trie current = trie currentPrefix := current.path for { if current.isWildcard { wildcard = current } if path == currentPrefix { return current, nil } if len(current.children) == 0 { if wildcard != nil && commonPrefix(path, currentPrefix) == len(currentPrefix) { return wildcard, nil } return current, ErrNodeNotFound } if len(path) <= len(currentPrefix) { return current, ErrNodeNotFound } idx := current.findChildIndex(path[len(currentPrefix)]) if idx == -1 { if wildcard != nil { return wildcard, nil } return current, ErrNodeNotFound } if path[:len(currentPrefix)] == currentPrefix { path = path[len(currentPrefix):] current = current.children[idx] currentPrefix = current.path } } } func (trie *Trie) findChildIndex(b byte) int { for idx, lookup := range trie.lookup { if b == lookup { return idx } } return -1 } func (trie *Trie) set(path string, data any) error { if path != "" { if path[len(path)-1] == '*' { trie.isWildcard = true path = path[:len(path)-1] } trie.path = path } if data != nil { if trie.data != nil { return ErrNodeAlreadyExists } trie.data = data } return nil } func (trie *Trie) createNew(path string, data any) error { child := &Trie{} _ = child.set(path, data) trie.children = append(trie.children, child) trie.lookup = append(trie.lookup, path[0]) return nil } func (trie *Trie) createSplit(commonIdx int, path string, data any) { self := &Trie{} *self = *trie isWildcard := false if path[len(path)-1] == '*' { path = path[:len(path)-1] isWildcard = true } self.path = self.path[commonIdx:] trie.path = trie.path[:commonIdx] trie.data = nil trie.isWildcard = false if commonIdx == len(path) { trie.children = []*Trie{self} trie.lookup = []byte{self.path[0]} trie.isWildcard = isWildcard _ = trie.set("", data) } else { child := &Trie{} child.isWildcard = isWildcard _ = child.set(path[commonIdx:], data) trie.children = []*Trie{self, child} trie.lookup = []byte{self.path[0], path[commonIdx]} } } func (trie *Trie) Data() any { return trie.data }
internal/node/trie.go
0.521471
0.438064
trie.go
starcoder
// Test concurrency primitives: power series. package ps // =========================================================================== // Specific power series /* --- https://en.wikipedia.org/wiki/Formal_power_series 1 / (1-x) <=> a(n) = 1 1 / (1+x) <=> a(n) = (-1)^n x / (1-x)^2 <=> a(n) = n --- e^x U := a0 a1 a2 ... e^x = c0 c1 c2 ... - ci = 1 / i! --- Sinus U := a0 a1 a2 ... Sin(U) = c0 c1 c2 ... - c2i = 0 - c2i+1 = (-1)^i / (2i+1)! --- Cosinus U := a0 a1 a2 ... Cos(U) = c0 c1 c2 ... - c2i = (-1)^i / (2i)! - c2i+1 = 0 --- Power-Exponentiation U := a0 a1 a2 ... U^n = c0 c1 c2 ... - c0 = a0^n - ci = 1/(i*a0) * sum k=1...i[ ( k*i - i + k ) * ak * ci-k ] --- Division U := a0 a1 a2 ... V := b0 b1 b2 ... U/V = c0 c1 c2 ... - c0 = 1 / a0 - ci = (1/b0) * ( ai - sum k=1...i[ bk - ci-k ] ) --- Exponential U := a0 a1 a2 ... Exp(U) = c0 c1 c2 ... - c0 = 1 - ci = 1 / i! --- Composition Subst == Composition --- https://en.wikipedia.org/wiki/Formal_power_series#The_Lagrange_inversion_formula */ // =========================================================================== // Ones are 1 1 1 1 1 ... = `1/(1-x)` with a simple pole at `x=1`. func Ones() PS { return AdInfinitum(NewCoefficient(1, 1)) } // Twos are 2 2 2 2 2 ... just for samples. func Twos() PS { return AdInfinitum(NewCoefficient(2, 1)) } // AdInfinitum repeats coefficient `c` ad infinitum // and returns `c^i`. func AdInfinitum(c Coefficient) PS { Z := New() go func(Z PS, c Coefficient) { for Z.Put(c) { } }(Z, c) return Z } // =========================================================================== // Factorials starting from zero: 1, 1, 2, 6, 24, 120, 720, 5040, 40.320 ... func Factorials() PS { Z := New() go func(Z PS) { curr := aOne() for i := 1; Z.Put(curr); i++ { curr = curr.Mul(curr, ratIby1(i)) } }(Z) return Z } // OneByFactorial starting from zero: 1/1, 1/1, 1/2, 1/6, 1/120, 1/720 ... func OneByFactorial() PS { Z := New() go func(Z PS) { curr := aOne() for i := 1; Z.Put(aC().Inv(curr)); i++ { curr = curr.Mul(curr, ratIby1(i)) } }(Z) return Z } // Fibonaccis starting from zero: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 114 ... func Fibonaccis() PS { Z := New() go func(Z PS) { prev, curr := aZero(), aOne() for Z.Put(curr) { prev, curr = curr, aC().Add(curr, prev) } }(Z) return Z } // OneByFibonacci starting from zero: 1/1, 1/2, 1/3, 1/5, 1/8, 1/13, 1/21 ... func OneByFibonacci() PS { Z := New() go func(Z PS) { prev, curr := aZero(), aOne() for Z.Put(aC().Inv(curr)) { prev, curr = curr, aC().Add(curr, prev) } }(Z) return Z } // Sincos returns the power series for sine and cosine (in radians). func Sincos() (Sin PS, Cos PS) { Sin = New() Cos = New() U := OneByFactorial() UU := U.Split() f := func(Z PS, U PS, odd bool) { var minus bool for { if u, ok := Z.NextGetFrom(U); ok { if odd { if minus { Z.Send(u.Neg(u)) } else { Z.Send(u) } minus = !minus } else { Z.Send(aZero()) } odd = !odd } else { return } } } go f(Sin, UU[0], false) go f(Cos, UU[1], true) return } // Sin returns the power series for sine (in radians). func Sin() PS { U, V := Sincos() V.Drop() return U } // Cos returns the power series for cosine (in radians). func Cos() PS { U, V := Sincos() U.Drop() return V } // ===========================================================================
series.go
0.792585
0.651909
series.go
starcoder
package data import ( "fmt" "github.com/foxcapades/lib-go-discord/v0/tools/fields/internal/types" ) const ( soEqual = "ShouldEqual" soResemble = "ShouldResemble" soAlmost = "ShouldAlmostEqual" ) func wrapString(i string) string { return fmt.Sprintf("string(%s)", i) } func wrapFloat32(i string) string { return fmt.Sprintf("func() float32 {v, e := strconv.ParseFloat(%s, 32); if e != nil {panic(e)}; return float32(v)}()", wrapString(i)) } func wrapFloat64(i string) string { return fmt.Sprintf("func() float64 {v, e := strconv.ParseFloat(%s, 64); if e != nil {panic(e)}; return v}()", wrapString(i)) } var Fields = []types.FieldDef{ { Name: "Int8", Type: "int8", Testing: types.Testing{ JSONTest: types.Test{ ActualTransform: wrapString, InputValue: "120", ExpectValue: `"120"`, Comparison: soEqual, }, ValueTest: types.Test{ InputValue: "120", ExpectValue: "120", Comparison: soEqual, }, }, }, { Name: "Int16", Type: "int16", Testing: types.Testing{ JSONTest: types.Test{ ActualTransform: wrapString, InputValue: "32_215", ExpectValue: `"32215"`, Comparison: soEqual, }, ValueTest: types.Test{ InputValue: "32_215", ExpectValue: "32_215", Comparison: soEqual, }, }, }, { Name: "Int32", Type: "int32", Testing: types.Testing{ JSONTest: types.Test{ ActualTransform: wrapString, InputValue: "3_331_115", ExpectValue: `"3331115"`, Comparison: soEqual, }, ValueTest: types.Test{ InputValue: "3_331_115", ExpectValue: "3_331_115", Comparison: soEqual, }, }, }, { Name: "Int64", Type: "int64", Testing: types.Testing{ JSONTest: types.Test{ ActualTransform: wrapString, InputValue: "123_456_789_123", ExpectValue: `"123456789123"`, Comparison: soEqual, }, ValueTest: types.Test{ InputValue: "123_456_789_123", ExpectValue: "123_456_789_123", Comparison: soEqual, }, }, }, { Name: "Uint8", Type: "uint8", Testing: types.Testing{ JSONTest: types.Test{ ActualTransform: wrapString, InputValue: "250", ExpectValue: `"250"`, Comparison: soEqual, }, ValueTest: types.Test{ InputValue: "250", ExpectValue: "250", Comparison: soEqual, }, }, }, { Name: "Uint16", Type: "uint16", Testing: types.Testing{ JSONTest: types.Test{ ActualTransform: wrapString, InputValue: "62_000", ExpectValue: `"62000"`, Comparison: soEqual, }, ValueTest: types.Test{ InputValue: "62_000", ExpectValue: "62_000", Comparison: soEqual, }, }, }, { Name: "Uint32", Type: "uint32", Testing: types.Testing{ JSONTest: types.Test{ ActualTransform: wrapString, InputValue: "10_880_000", ExpectValue: `"10880000"`, Comparison: soEqual, }, ValueTest: types.Test{ InputValue: "10_880_000", ExpectValue: "10_880_000", Comparison: soEqual, }, }, }, { Name: "Uint64", Type: "uint64", Testing: types.Testing{ JSONTest: types.Test{ ActualTransform: wrapString, InputValue: "999_999_999_999", ExpectValue: `"999999999999"`, Comparison: soEqual, }, ValueTest: types.Test{ InputValue: "999_999_999_999", ExpectValue: "999_999_999_999", Comparison: soEqual, }, }, }, { Name: "Float32", Type: "float32", Testing: types.Testing{ JSONTest: types.Test{ ActualTransform: wrapFloat32, InputValue: "1.234512", ExpectValue: "1.234512", Comparison: soAlmost, CompareParams: []string{"0.00001"}, }, ValueTest: types.Test{ InputValue: "1.234512", ExpectValue: "1.234512", Comparison: soAlmost, CompareParams: []string{"0.00001"}, }, }, }, { Name: "Float64", Type: "float64", Testing: types.Testing{ JSONTest: types.Test{ ActualTransform: wrapFloat64, InputValue: "12345.1234567891", ExpectValue: "12345.1234567891", Comparison: soAlmost, }, ValueTest: types.Test{ InputValue: "12345.123456789", ExpectValue: "12345.123456789", Comparison: soAlmost, }, }, }, { Name: "Bool", Type: "bool", Testing: types.Testing{ JSONTest: types.Test{ ActualTransform: wrapString, InputValue: "true", ExpectValue: `"true"`, Comparison: soEqual, }, ValueTest: types.Test{ InputValue: "true", ExpectValue: "true", Comparison: soEqual, }, }, }, { Name: "String", Type: "string", Testing: types.Testing{ JSONTest: types.Test{ ActualTransform: wrapString, InputValue: `"hello world"`, ExpectValue: `"\"hello world\""`, Comparison: soEqual, }, ValueTest: types.Test{ InputValue: `"hello world"`, ExpectValue: `"hello world"`, Comparison: soEqual, }, }, }, { Name: "Snowflake", Type: "discord.Snowflake", Constructor: "NewSnowflakeImpl(false)", // TODO: validation should be on all types AssignCast: "discord.Snowflake", Testing: types.Testing{ JSONTest: types.Test{ ActualTransform: wrapString, InputValue: "func() discord.Snowflake {out := build.NewSnowflake(false); out.SetRawValue(123_456_789_123); return out}()", ExpectValue: `"123456789123"`, Comparison: soEqual, }, ValueTest: types.Test{ ActualTransform: func(s string) string { return s + ".RawValue()" }, InputValue: "func() discord.Snowflake {out := build.NewSnowflake(false); out.SetRawValue(123_456_789_123); return out}()", ExpectValue: "123456789123", Comparison: soEqual, }, }, }, { Name: "Time", Type: "time.Time", Testing: types.Testing{ JSONTest: types.Test{ ActualTransform: wrapString, InputValue: "time.Unix(0, 0).UTC()", ExpectValue: `"\"1970-01-01T00:00:00Z\""`, Comparison: soEqual, }, ValueTest: types.Test{ InputValue: "time.Unix(0, 0).UTC()", ExpectValue: "time.Unix(0, 0).UTC()", Comparison: soResemble, }, }, }, { Name: "VerificationLevel", Type: "discord.VerificationLevel", Testing: types.Testing{ JSONTest: types.Test{ InputValue: "discord.VerificationLevelLow", ExpectValue: `[]byte{'1'}`, Comparison: soResemble, }, ValueTest: types.Test{ InputValue: "discord.VerificationLevelHigh", ExpectValue: "discord.VerificationLevelHigh", Comparison: soEqual, }, }, }, { Name: "MessageNotificationLevel", Type: "discord.MessageNotificationLevel", Testing: types.Testing{ JSONTest: types.Test{ InputValue: "discord.MsgNoteLvlAllMessages", ExpectValue: `[]byte{'0'}`, Comparison: soResemble, }, ValueTest: types.Test{ InputValue: "discord.MsgNoteLvlOnlyMentions", ExpectValue: "discord.MsgNoteLvlOnlyMentions", Comparison: soEqual, }, }, }, { Name: "ExplicitContentFilterLevel", Type: "discord.ExplicitContentFilterLevel", Testing: types.Testing{ JSONTest: types.Test{ InputValue: "discord.ExpConFilterLvlMembersWithoutRoles", ExpectValue: `[]byte{'1'}`, Comparison: soResemble, }, ValueTest: types.Test{ InputValue: "discord.ExpConFilterLvlDisabled", ExpectValue: "discord.ExpConFilterLvlDisabled", Comparison: soEqual, }, }, }, { Name: "ChannelTopic", Type: "discord.ChannelTopic", Testing: types.Testing{ JSONTest: types.Test{ InputValue: `"testing"`, ExpectValue: `[]byte("\"testing\"")`, Comparison: soResemble, }, ValueTest: types.Test{ InputValue: `"testing"`, ExpectValue: `discord.ChannelTopic("testing")`, Comparison: soEqual, }, }, }, { Name: "Any", Type: "interface{}", Testing: types.Testing{ JSONTest: types.Test{ InputValue: `nil`, ExpectValue: `[]byte("null")`, Comparison: soResemble, }, ValueTest: types.Test{ InputValue: `nil`, ExpectValue: `nil`, Comparison: soEqual, }, }, }, { // TODO: make this a real test Name: "ActivityEmoji", Type: "discord.ActivityEmoji", Testing: types.Testing{ JSONTest: types.Test{ InputValue: `nil`, ExpectValue: `[]byte("null")`, Comparison: soResemble, }, ValueTest: types.Test{ InputValue: `nil`, ExpectValue: `nil`, Comparison: soEqual, }, }, }, { // TODO: make this a real test Name: "ActivityParty", Type: "discord.ActivityParty", Testing: types.Testing{ JSONTest: types.Test{ InputValue: `nil`, ExpectValue: `[]byte("null")`, Comparison: soResemble, }, ValueTest: types.Test{ InputValue: `nil`, ExpectValue: `nil`, Comparison: soEqual, }, }, }, { // TODO: make this a real test Name: "ActivityAssets", Type: "discord.ActivityAssets", Testing: types.Testing{ JSONTest: types.Test{ InputValue: `nil`, ExpectValue: `[]byte("null")`, Comparison: soResemble, }, ValueTest: types.Test{ InputValue: `nil`, ExpectValue: `nil`, Comparison: soEqual, }, }, }, { // TODO: make this a real test Name: "ActivitySecrets", Type: "discord.ActivitySecrets", Testing: types.Testing{ JSONTest: types.Test{ InputValue: `nil`, ExpectValue: `[]byte("null")`, Comparison: soResemble, }, ValueTest: types.Test{ InputValue: `nil`, ExpectValue: `nil`, Comparison: soEqual, }, }, }, }
v0/tools/fields/internal/data/MultiTypes.go
0.510496
0.490175
MultiTypes.go
starcoder
package symbols import ( "fmt" "github.com/shanzi/gexpr/types" "github.com/shanzi/gexpr/values" ) type _operators struct{} var operators_singleton = &_operators{} func Operators() values.OperatorInterface { return operators_singleton } func (self *_operators) ADD(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return integer_symbol } if types.AssertMatch(types.FLOAT, a.Type(), b.Type()) { return float_symbol } if types.AssertMatch(types.STRING, a.Type(), b.Type()) { return string_symbol } panic(fmt.Sprintf("Can not add %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) SUB(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return integer_symbol } if types.AssertMatch(types.FLOAT, a.Type(), b.Type()) { return float_symbol } panic(fmt.Sprintf("Can not subtruct %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) MUL(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return integer_symbol } if types.AssertMatch(types.FLOAT, a.Type(), b.Type()) { return float_symbol } panic(fmt.Sprintf("Can not multiply %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) DIV(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return integer_symbol } if types.AssertMatch(types.FLOAT, a.Type(), b.Type()) { return float_symbol } panic(fmt.Sprintf("Can not divide %s with %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) MOD(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return integer_symbol } if types.AssertMatch(types.FLOAT, a.Type()) && types.AssertMatch(types.INTEGER, b.Type()) { return float_symbol } panic(fmt.Sprintf("Can not modulo %s with %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) AND(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return integer_symbol } panic(fmt.Sprintf("Can not apply binary operators on %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) OR(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return integer_symbol } panic(fmt.Sprintf("Can not apply binary operators on %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) XOR(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return integer_symbol } panic(fmt.Sprintf("Can not apply binary operators on %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) LEFT_SHIFT(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return integer_symbol } panic(fmt.Sprintf("Can not apply binary operators on %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) RIGHT_SHIFT(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return integer_symbol } panic(fmt.Sprintf("Can not apply binary operators on %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) AND_NOT(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return integer_symbol } panic(fmt.Sprintf("Can not apply binary operators on %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) EQUAL(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return boolean_symbol } if types.AssertMatch(types.FLOAT, a.Type(), b.Type()) { return boolean_symbol } if types.AssertMatch(types.BOOLEAN, a.Type(), b.Type()) { return boolean_symbol } if types.AssertMatch(types.STRING, a.Type(), b.Type()) { return boolean_symbol } panic(fmt.Sprintf("Can not apply EQUAL operator on %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) NOT_EQUAL(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return boolean_symbol } if types.AssertMatch(types.FLOAT, a.Type(), b.Type()) { return boolean_symbol } if types.AssertMatch(types.BOOLEAN, a.Type(), b.Type()) { return boolean_symbol } if types.AssertMatch(types.STRING, a.Type(), b.Type()) { return boolean_symbol } panic(fmt.Sprintf("Can not apply NOT_EQUAL operators on %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) GREATER(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return boolean_symbol } if types.AssertMatch(types.FLOAT, a.Type(), b.Type()) { return boolean_symbol } if types.AssertMatch(types.STRING, a.Type(), b.Type()) { return boolean_symbol } panic(fmt.Sprintf("Can not apply GREATER operators on %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) LESS(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return boolean_symbol } if types.AssertMatch(types.FLOAT, a.Type(), b.Type()) { return boolean_symbol } if types.AssertMatch(types.STRING, a.Type(), b.Type()) { return boolean_symbol } panic(fmt.Sprintf("Can not apply LESS operators on %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) GEQ(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return boolean_symbol } if types.AssertMatch(types.FLOAT, a.Type(), b.Type()) { return boolean_symbol } if types.AssertMatch(types.STRING, a.Type(), b.Type()) { return boolean_symbol } panic(fmt.Sprintf("Can not apply GEQ operators on %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) LEQ(a, b values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type(), b.Type()) { return boolean_symbol } if types.AssertMatch(types.FLOAT, a.Type(), b.Type()) { return boolean_symbol } if types.AssertMatch(types.STRING, a.Type(), b.Type()) { return boolean_symbol } panic(fmt.Sprintf("Can not apply LEQ operators on %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) BOOL_AND(a, b values.Value) values.Value { if types.AssertMatch(types.BOOLEAN, a.Type(), b.Type()) { return boolean_symbol } panic(fmt.Sprintf("Can not apply BOOL_AND operators on %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) BOOL_OR(a, b values.Value) values.Value { if types.AssertMatch(types.BOOLEAN, a.Type(), b.Type()) { return boolean_symbol } panic(fmt.Sprintf("Can not apply BOOL_OR operators on %s and %s", a.Type().Name(), b.Type().Name())) } func (self *_operators) INC(a values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type()) { return integer_symbol } if types.AssertMatch(types.FLOAT, a.Type()) { return float_symbol } panic(fmt.Sprintf("Can not apply INC operators on %s", a.Type().Name())) } func (self *_operators) DEC(a values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type()) { return integer_symbol } if types.AssertMatch(types.FLOAT, a.Type()) { return float_symbol } panic(fmt.Sprintf("Can not apply DEC operators on %s", a.Type().Name())) } func (self *_operators) INV(a values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type()) { return integer_symbol } panic(fmt.Sprintf("Can not apply INV operators on %s", a.Type().Name())) } func (self *_operators) BOOL_NOT(a values.Value) values.Value { if types.AssertMatch(types.BOOLEAN, a.Type()) { return boolean_symbol } panic(fmt.Sprintf("Can not apply BOOL_NOT operators on %s", a.Type().Name())) } func (self *_operators) NEGATIVE(a values.Value) values.Value { if types.AssertMatch(types.INTEGER, a.Type()) { return integer_symbol } if types.AssertMatch(types.FLOAT, a.Type()) { return float_symbol } panic(fmt.Sprintf("Can not apply BOOL_NOT operators on %s", a.Type().Name())) } func (self *_operators) POSITIVE(a values.Value) values.Value { if types.AssertMatch(types.BOOLEAN, a.Type()) { return integer_symbol } if types.AssertMatch(types.FLOAT, a.Type()) { return float_symbol } panic(fmt.Sprintf("Can not apply BOOL_NOT operators on %s", a.Type().Name())) }
symbols/operators.go
0.757525
0.472805
operators.go
starcoder
package main import ( "fmt" "sort" fuzz "github.com/google/gofuzz" ) // merge combines element in slice[p:q] & // slice[q+1:r] back in slice[p:r] but in // sorted order func merge(slice []int64, p, q, r int) { // n1 & n2, contain the number of elements // slice[p:q] & slice[q+1:r] respectively n1 := q - p + 1 n2 := r - q // left & right are temporary slices to hold // left => slice[p:q], right => slice[q+1:r] // The extra +1 makes room for math.MaxInt64 // Which is the max integer so all other are // always less than it. left, right := make([]int64, n1), make([]int64, n2) // copy slice[p:q] into left for i := 0; i < n1; i++ { left[i] = slice[p+i] } // copy slice[q+1:r] into right for i := 0; i < n2; i++ { right[i] = slice[q+i+1] } i, j := 0, 0 // index counters for left & right respectively // range from p to r // comparing left[i] to right[j], // when left[i] is less than or equal // to right[j], left[i] will be copied // into slice[p] else, right[j] will be copied // into slice[p]. n2-- // set n2 to the last index value of right n1-- // set n1 to the last index value of left for ; p <= r; p++ { if left[i] <= right[j] { slice[p] = left[i] if i != n1 { // only increment i if n1 hasn't been reached i++ } } else { slice[p] = right[j] if j != n2 { // only increment j if n2 hasn't been reached j++ } } } } // mergeSort sorts slice using the merge sort algo func mergeSort(slice []int64, p, r int) { // As long as p < r keep making recursive calls if p < r { // compute q such that // slice[p:q] contains len(slice)/2 elements q := (p + r) / 2 // call mergeSort on slice[p:q] mergeSort(slice, p, q) // call mergeSort on slice[q+1:r] mergeSort(slice, q+1, r) // merge slice[p:q] & slice[q+1:r] merge(slice, p, q, r) } } // int64Slice exists so we can use sort.IsSorted // to confirm we have sorted correctly type int64Slice []int64 func (s int64Slice) Less(i, j int) bool { return s[i] < s[j] } func (s int64Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s int64Slice) Len() int { return len(s) } func main() { var slice = [2000000]int64{} // 2m elements fuzz.New().Fuzz(&slice) mergeSort(slice[:], 0, len(slice)-1) // wrap as int64Slice type, so we can confirm it is sorted. fmt.Println("was sorted correctly:", sort.IsSorted(int64Slice(slice[:]))) }
merge-sort/main.go
0.651687
0.432782
main.go
starcoder
package onshape import ( "encoding/json" ) // BTPArgumentDeclaration232AllOf struct for BTPArgumentDeclaration232AllOf type BTPArgumentDeclaration232AllOf struct { BtType *string `json:"btType,omitempty"` Name *BTPIdentifier8 `json:"name,omitempty"` StandardType *string `json:"standardType,omitempty"` Type *BTPTypeName290 `json:"type,omitempty"` TypeName *string `json:"typeName,omitempty"` } // NewBTPArgumentDeclaration232AllOf instantiates a new BTPArgumentDeclaration232AllOf object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed func NewBTPArgumentDeclaration232AllOf() *BTPArgumentDeclaration232AllOf { this := BTPArgumentDeclaration232AllOf{} return &this } // NewBTPArgumentDeclaration232AllOfWithDefaults instantiates a new BTPArgumentDeclaration232AllOf object // This constructor will only assign default values to properties that have it defined, // but it doesn't guarantee that properties required by API are set func NewBTPArgumentDeclaration232AllOfWithDefaults() *BTPArgumentDeclaration232AllOf { this := BTPArgumentDeclaration232AllOf{} return &this } // GetBtType returns the BtType field value if set, zero value otherwise. func (o *BTPArgumentDeclaration232AllOf) GetBtType() string { if o == nil || o.BtType == nil { var ret string return ret } return *o.BtType } // GetBtTypeOk returns a tuple with the BtType field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BTPArgumentDeclaration232AllOf) GetBtTypeOk() (*string, bool) { if o == nil || o.BtType == nil { return nil, false } return o.BtType, true } // HasBtType returns a boolean if a field has been set. func (o *BTPArgumentDeclaration232AllOf) HasBtType() bool { if o != nil && o.BtType != nil { return true } return false } // SetBtType gets a reference to the given string and assigns it to the BtType field. func (o *BTPArgumentDeclaration232AllOf) SetBtType(v string) { o.BtType = &v } // GetName returns the Name field value if set, zero value otherwise. func (o *BTPArgumentDeclaration232AllOf) GetName() BTPIdentifier8 { if o == nil || o.Name == nil { var ret BTPIdentifier8 return ret } return *o.Name } // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BTPArgumentDeclaration232AllOf) GetNameOk() (*BTPIdentifier8, bool) { if o == nil || o.Name == nil { return nil, false } return o.Name, true } // HasName returns a boolean if a field has been set. func (o *BTPArgumentDeclaration232AllOf) HasName() bool { if o != nil && o.Name != nil { return true } return false } // SetName gets a reference to the given BTPIdentifier8 and assigns it to the Name field. func (o *BTPArgumentDeclaration232AllOf) SetName(v BTPIdentifier8) { o.Name = &v } // GetStandardType returns the StandardType field value if set, zero value otherwise. func (o *BTPArgumentDeclaration232AllOf) GetStandardType() string { if o == nil || o.StandardType == nil { var ret string return ret } return *o.StandardType } // GetStandardTypeOk returns a tuple with the StandardType field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BTPArgumentDeclaration232AllOf) GetStandardTypeOk() (*string, bool) { if o == nil || o.StandardType == nil { return nil, false } return o.StandardType, true } // HasStandardType returns a boolean if a field has been set. func (o *BTPArgumentDeclaration232AllOf) HasStandardType() bool { if o != nil && o.StandardType != nil { return true } return false } // SetStandardType gets a reference to the given string and assigns it to the StandardType field. func (o *BTPArgumentDeclaration232AllOf) SetStandardType(v string) { o.StandardType = &v } // GetType returns the Type field value if set, zero value otherwise. func (o *BTPArgumentDeclaration232AllOf) GetType() BTPTypeName290 { if o == nil || o.Type == nil { var ret BTPTypeName290 return ret } return *o.Type } // GetTypeOk returns a tuple with the Type field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BTPArgumentDeclaration232AllOf) GetTypeOk() (*BTPTypeName290, bool) { if o == nil || o.Type == nil { return nil, false } return o.Type, true } // HasType returns a boolean if a field has been set. func (o *BTPArgumentDeclaration232AllOf) HasType() bool { if o != nil && o.Type != nil { return true } return false } // SetType gets a reference to the given BTPTypeName290 and assigns it to the Type field. func (o *BTPArgumentDeclaration232AllOf) SetType(v BTPTypeName290) { o.Type = &v } // GetTypeName returns the TypeName field value if set, zero value otherwise. func (o *BTPArgumentDeclaration232AllOf) GetTypeName() string { if o == nil || o.TypeName == nil { var ret string return ret } return *o.TypeName } // GetTypeNameOk returns a tuple with the TypeName field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *BTPArgumentDeclaration232AllOf) GetTypeNameOk() (*string, bool) { if o == nil || o.TypeName == nil { return nil, false } return o.TypeName, true } // HasTypeName returns a boolean if a field has been set. func (o *BTPArgumentDeclaration232AllOf) HasTypeName() bool { if o != nil && o.TypeName != nil { return true } return false } // SetTypeName gets a reference to the given string and assigns it to the TypeName field. func (o *BTPArgumentDeclaration232AllOf) SetTypeName(v string) { o.TypeName = &v } func (o BTPArgumentDeclaration232AllOf) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.BtType != nil { toSerialize["btType"] = o.BtType } if o.Name != nil { toSerialize["name"] = o.Name } if o.StandardType != nil { toSerialize["standardType"] = o.StandardType } if o.Type != nil { toSerialize["type"] = o.Type } if o.TypeName != nil { toSerialize["typeName"] = o.TypeName } return json.Marshal(toSerialize) } type NullableBTPArgumentDeclaration232AllOf struct { value *BTPArgumentDeclaration232AllOf isSet bool } func (v NullableBTPArgumentDeclaration232AllOf) Get() *BTPArgumentDeclaration232AllOf { return v.value } func (v *NullableBTPArgumentDeclaration232AllOf) Set(val *BTPArgumentDeclaration232AllOf) { v.value = val v.isSet = true } func (v NullableBTPArgumentDeclaration232AllOf) IsSet() bool { return v.isSet } func (v *NullableBTPArgumentDeclaration232AllOf) Unset() { v.value = nil v.isSet = false } func NewNullableBTPArgumentDeclaration232AllOf(val *BTPArgumentDeclaration232AllOf) *NullableBTPArgumentDeclaration232AllOf { return &NullableBTPArgumentDeclaration232AllOf{value: val, isSet: true} } func (v NullableBTPArgumentDeclaration232AllOf) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableBTPArgumentDeclaration232AllOf) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }
onshape/model_btp_argument_declaration_232_all_of.go
0.769254
0.491578
model_btp_argument_declaration_232_all_of.go
starcoder
package column // Row represents a cursor at a particular row offest in the transaction. type Row struct { txn *Txn } // --------------------------- Numbers ---------------------------- // Int loads a int value at a particular column func (r Row) Int(columnName string) (v int, ok bool) { return intReaderFor(r.txn, columnName).Get() } // SetInt stores a int value at a particular column func (r Row) SetInt(columnName string, value int) { r.txn.Int(columnName).Set(value) } // AddInt adds delta to a int value at a particular column func (r Row) AddInt(columnName string, value int) { r.txn.Int(columnName).Add(value) } // Int16 loads a int16 value at a particular column func (r Row) Int16(columnName string) (v int16, ok bool) { return int16ReaderFor(r.txn, columnName).Get() } // SetInt16 stores a int16 value at a particular column func (r Row) SetInt16(columnName string, value int16) { r.txn.Int16(columnName).Set(value) } // AddInt16 adds delta to a int16 value at a particular column func (r Row) AddInt16(columnName string, value int16) { r.txn.Int16(columnName).Add(value) } // Int32 loads a int32 value at a particular column func (r Row) Int32(columnName string) (v int32, ok bool) { return int32ReaderFor(r.txn, columnName).Get() } // SetInt32 stores a int32 value at a particular column func (r Row) SetInt32(columnName string, value int32) { r.txn.Int32(columnName).Set(value) } // AddInt32 adds delta to a int32 value at a particular column func (r Row) AddInt32(columnName string, value int32) { r.txn.Int32(columnName).Add(value) } // Int64 loads a int64 value at a particular column func (r Row) Int64(columnName string) (v int64, ok bool) { return int64ReaderFor(r.txn, columnName).Get() } // SetInt64 stores a int64 value at a particular column func (r Row) SetInt64(columnName string, value int64) { r.txn.Int64(columnName).Set(value) } // AddInt64 adds delta to a int64 value at a particular column func (r Row) AddInt64(columnName string, value int64) { r.txn.Int64(columnName).Add(value) } // Uint loads a uint value at a particular column func (r Row) Uint(columnName string) (v uint, ok bool) { return uintReaderFor(r.txn, columnName).Get() } // SetUint stores a uint value at a particular column func (r Row) SetUint(columnName string, value uint) { r.txn.Uint(columnName).Set(value) } // AddUint adds delta to a uint value at a particular column func (r Row) AddUint(columnName string, value uint) { r.txn.Uint(columnName).Add(value) } // Uint16 loads a uint16 value at a particular column func (r Row) Uint16(columnName string) (v uint16, ok bool) { return uint16ReaderFor(r.txn, columnName).Get() } // SetUint16 stores a uint16 value at a particular column func (r Row) SetUint16(columnName string, value uint16) { r.txn.Uint16(columnName).Set(value) } // AddUint16 adds delta to a uint16 value at a particular column func (r Row) AddUint16(columnName string, value uint16) { r.txn.Uint16(columnName).Add(value) } // Uint32 loads a uint32 value at a particular column func (r Row) Uint32(columnName string) (v uint32, ok bool) { return uint32ReaderFor(r.txn, columnName).Get() } // SetUint32 stores a uint32 value at a particular column func (r Row) SetUint32(columnName string, value uint32) { r.txn.Uint32(columnName).Set(value) } // AddUint32 adds delta to a uint32 value at a particular column func (r Row) AddUint32(columnName string, value uint32) { r.txn.Uint32(columnName).Add(value) } // Uint64 loads a uint64 value at a particular column func (r Row) Uint64(columnName string) (v uint64, ok bool) { return uint64ReaderFor(r.txn, columnName).Get() } // SetUint64 stores a uint64 value at a particular column func (r Row) SetUint64(columnName string, value uint64) { r.txn.Uint64(columnName).Set(value) } // AddUint64 adds delta to a uint64 value at a particular column func (r Row) AddUint64(columnName string, value uint64) { r.txn.Uint64(columnName).Add(value) } // Float32 loads a float32 value at a particular column func (r Row) Float32(columnName string) (v float32, ok bool) { return float32ReaderFor(r.txn, columnName).Get() } // SetFloat32 stores a float32 value at a particular column func (r Row) SetFloat32(columnName string, value float32) { r.txn.Float32(columnName).Set(value) } // AddFloat32 adds delta to a float32 value at a particular column func (r Row) AddFloat32(columnName string, value float32) { r.txn.Float32(columnName).Add(value) } // Float64 loads a float64 value at a particular column func (r Row) Float64(columnName string) (v float64, ok bool) { return float64ReaderFor(r.txn, columnName).Get() } // SetFloat64 stores a float64 value at a particular column func (r Row) SetFloat64(columnName string, value float64) { r.txn.Float64(columnName).Set(value) } // AddFloat64 adds delta to a float64 value at a particular column func (r Row) AddFloat64(columnName string, value float64) { r.txn.Float64(columnName).Add(value) } // --------------------------- Strings ---------------------------- // Key loads a primary key value at a particular column func (r Row) Key() (v string, ok bool) { if pk := r.txn.owner.pk; pk != nil { v, ok = pk.LoadString(r.txn.cursor) } return } // SetKey stores a primary key value at a particular column func (r Row) SetKey(key string) { r.txn.Key().Set(key) } // String loads a string value at a particular column func (r Row) String(columnName string) (v string, ok bool) { return stringReaderFor(r.txn, columnName).Get() } // SetString stores a string value at a particular column func (r Row) SetString(columnName string, value string) { r.txn.String(columnName).Set(value) } // Enum loads a string value at a particular column func (r Row) Enum(columnName string) (v string, ok bool) { return enumReaderFor(r.txn, columnName).Get() } // SetEnum stores a string value at a particular column func (r Row) SetEnum(columnName string, value string) { r.txn.Enum(columnName).Set(value) } // --------------------------- Others ---------------------------- // Bool loads a bool value at a particular column func (r Row) Bool(columnName string) bool { return boolReaderFor(r.txn, columnName).Get() } // SetBool stores a bool value at a particular column func (r Row) SetBool(columnName string, value bool) { r.txn.Bool(columnName).Set(value) } // Any loads a bool value at a particular column func (r Row) Any(columnName string) (interface{}, bool) { return anyReaderFor(r.txn, columnName).Get() } // SetAny stores a bool value at a particular column func (r Row) SetAny(columnName string, value interface{}) { r.txn.Any(columnName).Set(value) }
txn_row.go
0.750187
0.662626
txn_row.go
starcoder
package volume import ( "math" "math/rand" ) // NewDimensions creates a new Dimension struct func NewDimensions(x, y, z int) Dimensions { return Dimensions{x, y, z} } // Dimensions represents the volumetric size of the data. type Dimensions struct { X, Y, Z int } // Size returns the number of elements. func (d *Dimensions) Size() int { return d.X * d.Y * d.Z } // Clone returns a new Dimentsions struct with the same dimensions. func (d *Dimensions) Clone() Dimensions { return Dimensions{d.X, d.Y, d.Z} } // Options stores volume options type Options struct { Zero bool HasInitialValue bool InitialValue float64 Weights []float64 } // OptionFunc modifies the Options when creating a new Volume. type OptionFunc func(*Options) // WithInitialValue sets the initial values of the Volume. func WithInitialValue(value float64) OptionFunc { return func(opts *Options) { opts.HasInitialValue = true opts.InitialValue = value } } // WithZeros sets the initial values of the Volume to zero. func WithZeros() OptionFunc { return func(opts *Options) { opts.HasInitialValue = true opts.Zero = true } } // WithWeights initializes the Volume with the given weights. func WithWeights(w []float64) OptionFunc { return func(opts *Options) { opts.Weights = w } } // NewVolume creates a new Volume of the given size and options. func NewVolume(dim Dimensions, optFuncs ...OptionFunc) *Volume { n := dim.Size() w := make([]float64, n, n) dw := make([]float64, n, n) // Update opts opts := &Options{} for _, optFn := range optFuncs { optFn(opts) } // Initialize weights if opts.HasInitialValue { if !opts.Zero { for i := 0; i < n; i++ { w[i] = opts.InitialValue } } else { // Arrays already contain zeros. } } else if opts.Weights != nil { if len(opts.Weights) != dim.Z { panic("Invalid input weights: depth inconsistencies") } else if dim.X != 1 { panic("Invalid volume dimensions: X must equal 1 when weights are given") } else if dim.Y != 1 { panic("Invalid volume dimensions: Y must equal 1 when weights are given") } // Copy weights copy(w, opts.Weights) } else { // weight normalization is done to equalize the output // variance of every neuron, otherwise neurons with a lot // of incoming connections have outputs of larger variance desiredStdDev := math.Sqrt(1.0 / float64(n)) for i := 0; i < n; i++ { // Gaussian distribution with a mean of 0 and the given stdev w[i] = rand.NormFloat64() * desiredStdDev } } return &Volume{ dim, w, dw, } } // Volume is the basic building block of all the data in a network. // It is essentially a 3D block of numbers with a width (sx), height (sy), // and a depth (depth). It is used to hold data for all the filters, volumes, // weights and gradients w.r.t. the data. type Volume struct { dim Dimensions w []float64 dw []float64 } // Dimensions returns the Dimensions of the Volume. func (v *Volume) Dimensions() Dimensions { return v.dim } // Size returns the number of elements. func (v *Volume) Size() int { return v.dim.Size() } // getIndex returns the array index for the given position. func (v *Volume) getIndex(x, y, d int) int { return ((v.dim.X*y)+x)*v.dim.Z + d } // Get returns a weight for the given position in the Volume. func (v *Volume) Get(x, y, d int) float64 { return v.w[v.getIndex(x, y, d)] } // Set updates the position in the Volume. func (v *Volume) Set(x, y, d int, val float64) { v.w[v.getIndex(x, y, d)] = val } // GetByIndex returns a weight for the given index in the Volume. func (v *Volume) GetByIndex(index int) float64 { return v.w[index] } // SetByIndex updates the position in the Volume by index. func (v *Volume) SetByIndex(index int, val float64) { v.w[index] = val } // Add adds the given value to the weight for the given position. func (v *Volume) Add(x, y, d int, val float64) { v.w[v.getIndex(x, y, d)] += val } // Mult multiplies the given value to the weight for the given position. func (v *Volume) Mult(x, y, d int, val float64) { v.w[v.getIndex(x, y, d)] *= val } // MultByIndex multiplies the given value to the weight for the given index position. func (v *Volume) MultByIndex(index int, val float64) { v.w[index] *= val } // GetGrad returns the gradient at the given position. func (v *Volume) GetGrad(x, y, d int) float64 { return v.dw[v.getIndex(x, y, d)] } // SetGrad updates the gradient at the given position. func (v *Volume) SetGrad(x, y, d int, val float64) { v.dw[v.getIndex(x, y, d)] = val } // GetGradByIndex returns a gradient for the given index in the Volume. func (v *Volume) GetGradByIndex(index int) float64 { return v.dw[index] } // SetGradByIndex updates the gradient position in the Volume by index. func (v *Volume) SetGradByIndex(index int, val float64) { v.dw[index] = val } // AddGrad adds the given value to the gradient for the given position. func (v *Volume) AddGrad(x, y, d int, val float64) { v.dw[v.getIndex(x, y, d)] += val } // AddGradByIndex adds the given value to the gradient for the given index. func (v *Volume) AddGradByIndex(index int, val float64) { v.dw[index] += val } // Clone creates a new Volume with cloned weights and zeroed gradients. func (v *Volume) Clone() *Volume { vol := NewVolume(v.dim, WithZeros()) copy(vol.w, v.w) return vol } // CloneAndZero creates a Volume of the same size but with zero weights and gradients. func (v *Volume) CloneAndZero() *Volume { return NewVolume(v.dim, WithZeros()) } // AddFrom adds the weights from another Volume. func (v *Volume) AddFrom(vol *Volume) { for i := 0; i < v.Size(); i++ { v.w[i] += vol.w[i] } } // AddFromScaled adds the weights from another Volume and scaled with the given value. func (v *Volume) AddFromScaled(vol *Volume, scale float64) { for i := 0; i < v.Size(); i++ { v.w[i] += vol.w[i] * scale } } // ZeroGrad sets the gradients to 0. func (v *Volume) ZeroGrad() { for i := 0; i < v.Size(); i++ { v.dw[i] = 0.0 } } // SetConst sets the weights to the given value. func (v *Volume) SetConst(val float64) { for i := 0; i < v.Size(); i++ { v.w[i] = val } } // Weights returns all the weights for the volume. func (v *Volume) Weights() []float64 { return v.w } // Gradients returns all the gradients for the volume. func (v *Volume) Gradients() []float64 { return v.dw }
volume/vol.go
0.912034
0.684944
vol.go
starcoder