// generateUnion writes generated code for the union into w
330228
func generateUnion(ctx *context, w io.Writer, union *Union) {
	name := camelCaseName(union.Name)

	logf(" writing union %q (%s) with %d fields", union.Name, name, len(union.Fields))

	// generate struct comment
	generateComment(ctx, w, name, union.Name, "union")

	// generate struct definition
	fmt.Fprintln(w, "type", name, "struct {")

	// maximum size for union
	maxSize := getUnionSize(ctx, union)

	// generate data field
	fieldName := "Union_data"
	fmt.Fprintf(w, "\t%s [%d]byte\n", fieldName, maxSize)

	// generate end of the struct
	fmt.Fprintln(w, "}")

	// generate name getter
	generateTypeNameGetter(w, name, union.Name)

	// generate CRC getter
	generateCrcGetter(w, name, union.CRC)

	// generate getters for fields
	for _, field := range union.Fields {
		fieldName := camelCaseName(field.Name)
		fieldType := convertToGoType(ctx, field.Type)
		generateUnionGetterSetter(w, name, fieldName, fieldType)
	}

	// generate union methods
	//generateUnionMethods(w, name)

	fmt.Fprintln(w)
}
245711
func (u Union) MarshalJSON() ([]byte, error) {
	type wrapper struct {
		Union []Schedule `json:"union"`
	}
	return json.Marshal(wrapper{Union: u})
}
281979
func (r Rect) Union(other Rect) Rect {
	return Rect{r.X.Union(other.X), r.Y.Union(other.Y)}
}
780612
func UnionWithOpts(optArgs UnionOpts, args ...interface{}) Term {
	return constructRootTerm("Union", p.Term_UNION, args, optArgs.toMap())
}
397877
func createGenerateStruct(apiDef *raml.APIDefinition, tip, dir, pkgName string) (string, error) {
	rt := raml.Type{
		Type: tip,
	}
	if parents, isMultiple := rt.MultipleInheritance(); isMultiple {
		sd := newStructDef(apiDef, multipleInheritanceNewName(parents), pkgName, "", map[string]interface{}{})
		sd.addMultipleInheritance(apiDef, parents)
		return sd.Name, sd.generate(dir)
	}

	if rt.IsUnion() {
		t := raml.Type{
			Type: tip,
		}
		sd := newStructDef(apiDef, unionNewName(tip), pkgName, "", map[string]interface{}{})
		sd.T = t
		sd.buildUnion()
		sd.generate(dir)
	}
	return "", nil
}
246975
func (m *tokenManager) GenerateUnsignedServiceAccountToken(saID string, saName string) *jwt.Token {
	token := jwt.New(jwt.SigningMethodRS256)
	token.Header["kid"] = m.serviceAccountPrivateKey.KeyID
	claims := token.Claims.(jwt.MapClaims)
	claims["service_accountname"] = saName
	claims["sub"] = saID
	claims["jti"] = uuid.NewV4().String()
	claims["iat"] = time.Now().Unix()
	claims["iss"] = m.config.GetAuthServiceURL()
	claims["scopes"] = []string{"uma_protection"}
	return token
}
936742
func UnionAll(builder ...Builder) interface {
	Builder
	As(string) Builder
} {
	return &union{
		builder: builder,
		all:     true,
	}
}
609925
func (mr *MockOpenIDConnectTokenStrategyMockRecorder) GenerateIDToken(arg0, arg1 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateIDToken", reflect.TypeOf((*MockOpenIDConnectTokenStrategy)(nil).GenerateIDToken), arg0, arg1)
}
21929
func generateUUID(t bool) string {
	u := uuid.New()
	if !t {
		return strings.Replace(u, "-", "", -1)
	}
	return u
}
630342
func (uow *UnitOfWork) Generate(templateFile string, output string) {
	templateFileParts := strings.Split(templateFile, "/")
	templateName := templateFileParts[len(templateFileParts)-1]

	tmpl, err := template.New(templateName).ParseFiles(templateFile)
	if err != nil {
		printErrorf("ERROR: %s\n", err)
		return
	}

	executeTemplate := func(outputFile string, templateInfo interface{}) {
		writer := os.Stdout
		if len(outputFile) > 0 {
			writer, _ = os.Create(outputFile)
		}
		err = tmpl.Execute(writer, templateInfo)
		if err != nil {
			printErrorf("ERROR: %s\n", err)
		}
	}

	if strings.Contains(output, "%s") {
		for _, container := range uow.TargetedInfo() {
			executeTemplate(fmt.Sprintf(output, container.PrefixedName()), container)
		}
	} else {
		tmplInfo := struct {
			Containers []ContainerInfo
		}{
			Containers: uow.TargetedInfo(),
		}
		executeTemplate(output, tmplInfo)
	}
}
591476
func (r *EtcdRegistry) CreateUnit(u *job.Unit) error {
	if err := r.storeOrGetUnitFile(u.Unit); err != nil {
		return err
	}

	jm := jobModel{
		Name:     u.Name,
		UnitHash: u.Unit.Hash(),
	}
	val, err := marshal(jm)
	if err != nil {
		return err
	}

	opts := &etcd.SetOptions{
		// Since we support replacing units, just ignore previous
		// job keys if they exist, this allows us to update the
		// job object key with a new unit.
		PrevExist: etcd.PrevIgnore,
	}
	key := r.prefixed(jobPrefix, u.Name, "object")
	_, err = r.kAPI.Set(context.Background(), key, val, opts)
	if err != nil {
		return err
	}

	return r.SetUnitTargetState(u.Name, u.TargetState)
}
1231952
func unionN(l []*Automaton) *Automaton {
	ans := newEmptyAutomaton()
	// create initial state
	ans.createState()
	// copy over all automata
	for _, a := range l {
		ans.copy(a)
	}
	// add epsilon transition from new initial state
	stateOffset := 1
	for _, a := range l {
		if a.numStates() == 0 {
			continue
		}
		ans.addEpsilon(0, stateOffset)
		stateOffset += a.numStates()
	}
	ans.finishState()
	return removeDeadStates(ans)
}
1283360
func (m *MockOpenIDConnectTokenStrategy) GenerateIDToken(arg0 context.Context, arg1 fosite.Requester) (string, error) {
	ret := m.ctrl.Call(m, "GenerateIDToken", arg0, arg1)
	ret0, _ := ret[0].(string)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
937443
func (rules Rules) Union(rules2 Rules) Rules {
	nrules := rules.Clone()

	for pattern, targetIDSet := range rules2 {
		nrules[pattern] = nrules[pattern].Union(targetIDSet)
	}

	return nrules
}
1096068
func Union(data sort.Interface, pivot int) (size int) {
	// BUG(extemporalgenome): Union currently uses a multi-pass implementation

	sort.Sort(data)
	return Uniq(data)
}
753468
func CellUnionFromUnion(cellUnions ...CellUnion) CellUnion {
	var cu CellUnion
	for _, cellUnion := range cellUnions {
		cu = append(cu, cellUnion...)
	}
	cu.Normalize()
	return cu
}
775869
func (g *genSet) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error {
	sw := generator.NewSnippetWriter(w, c, "$", "$")
	sw.Do(setCode, g.args(t))
	sw.Do("func less$.type|public$(lhs, rhs $.type|raw$) bool {\n", g.args(t))
	g.lessBody(sw, t)
	sw.Do("}\n", g.args(t))
	return sw.Error()
}