gitlab.com/evatix-go/core@v1.3.55/coreinstruction/Specification.go (about) 1 package coreinstruction 2 3 type Specification struct { 4 BaseIdDisplayType 5 BaseTags 6 BaseIsGlobal 7 flatSpec *FlatSpecification 8 } 9 10 func NewSpecificationSimple( 11 id, 12 display, 13 typeName string, 14 ) *Specification { 15 return &Specification{ 16 BaseIdDisplayType: BaseIdDisplayType{ 17 BaseIdentifier: BaseIdentifier{Id: id}, 18 BaseDisplay: BaseDisplay{display}, 19 BaseType: BaseType{typeName}, 20 }, 21 BaseTags: *NewTags(nil), 22 BaseIsGlobal: BaseIsGlobal{false}, 23 } 24 } 25 26 func NewSpecificationSimpleGlobal( 27 id, 28 display, 29 typeName string, 30 ) *Specification { 31 return &Specification{ 32 BaseIdDisplayType: BaseIdDisplayType{ 33 BaseIdentifier: BaseIdentifier{Id: id}, 34 BaseDisplay: BaseDisplay{display}, 35 BaseType: BaseType{typeName}, 36 }, 37 BaseTags: *NewTags(nil), 38 BaseIsGlobal: BaseIsGlobal{true}, 39 } 40 } 41 42 func NewSpecification( 43 id, 44 display, 45 typeName string, 46 tags []string, 47 isGlobal bool, 48 ) *Specification { 49 return &Specification{ 50 BaseIdDisplayType: BaseIdDisplayType{ 51 BaseIdentifier: BaseIdentifier{Id: id}, 52 BaseDisplay: BaseDisplay{display}, 53 BaseType: BaseType{typeName}, 54 }, 55 BaseTags: *NewTags(tags), 56 BaseIsGlobal: BaseIsGlobal{isGlobal}, 57 } 58 } 59 60 func (r *Specification) Clone() *Specification { 61 return &Specification{ 62 BaseIdDisplayType: BaseIdDisplayType{ 63 BaseIdentifier: BaseIdentifier{r.Id}, 64 BaseDisplay: BaseDisplay{r.Display}, 65 BaseType: BaseType{r.Type}, 66 }, 67 BaseTags: BaseTags{ 68 Tags: r.Tags, 69 }, 70 BaseIsGlobal: BaseIsGlobal{r.IsGlobal}, 71 } 72 } 73 74 func (r *Specification) FlatSpecification() *FlatSpecification { 75 if r.flatSpec != nil { 76 return r.flatSpec 77 } 78 79 r.flatSpec = NewFlatSpecificationUsingSpec( 80 r, 81 true) 82 83 return r.flatSpec 84 }