go-hep.org/x/hep@v0.38.1/fwk/job/stmt.go (about) 1 // Copyright ©2017 The go-hep Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package job 6 7 import ( 8 "fmt" 9 ) 10 11 // Stmt represents a job options statement. 12 type Stmt struct { 13 Type StmtType // type of the statement 14 Data C // the configuration data associated with that statement 15 } 16 17 // StmtType represents the type of a job-options statement. 18 type StmtType int 19 20 // String returns the string representation of a StmtType 21 func (stmt StmtType) String() string { 22 switch stmt { 23 case StmtNewApp: 24 return "NewApp" 25 case StmtCreate: 26 return "Create" 27 case StmtSetProp: 28 return "SetProp" 29 } 30 panic(fmt.Errorf("fwk: invalid StmtType value (%d)", int(stmt))) 31 } 32 33 const ( 34 StmtNewApp StmtType = iota 35 StmtCreate 36 StmtSetProp 37 )