| 1 |
package sarif |
| 2 |
|
| 3 |
// GraphTraversal ... |
| 4 |
type GraphTraversal struct { |
| 5 |
Description *Message `json:"description,omitempty"` |
| 6 |
EdgeTraversals []*EdgeTraversal `json:"edgeTraversals,omitempty"` |
| 7 |
ImmutableState map[string]*MultiformatMessageString `json:"immutableState,omitempty"` |
| 8 |
InitialState map[string]*MultiformatMessageString `json:"initialState,omitempty"` |
| 9 |
ResultGraphIndex *int `json:"resultGraphIndex,omitempty"` |
| 10 |
RunGraphIndex *int `json:"runGraphIndex,omitempty"` |
| 11 |
PropertyBag |
| 12 |
|
| 13 |
} |
| 14 |
|
| 15 |
// NewGraphTraversal creates a new GraphTraversal and returns a pointer to it |
| 16 |
func NewGraphTraversal() *GraphTraversal { |
| 17 |
return &GraphTraversal{} |
| 18 |
} |
| 19 |
|
| 20 |
// WithDescription sets the Description |
| 21 |
func (graphTraversal *GraphTraversal) WithDescription(message *Message) *GraphTraversal { |
| 22 |
graphTraversal.Description = message |
| 23 |
return graphTraversal |
| 24 |
} |
| 25 |
|
| 26 |
// WithDescriptionText sets the DescriptionText |
| 27 |
func (graphTraversal *GraphTraversal) WithDescriptionText(text string) *GraphTraversal { |
| 28 |
if graphTraversal.Description == nil { |
| 29 |
graphTraversal.Description = &Message{} |
| 30 |
} |
| 31 |
graphTraversal.Description.Text = &text |
| 32 |
return graphTraversal |
| 33 |
} |
| 34 |
|
| 35 |
// WithDescriptionMarkdown sets the DescriptionMarkdown |
| 36 |
func (graphTraversal *GraphTraversal) WithDescriptionMarkdown(markdown string) *GraphTraversal { |
| 37 |
if graphTraversal.Description == nil { |
| 38 |
graphTraversal.Description = &Message{} |
| 39 |
} |
| 40 |
graphTraversal.Description.Markdown = &markdown |
| 41 |
return graphTraversal |
| 42 |
} |
| 43 |
|
| 44 |
// WithEdgeTraversals sets the EdgeTraversals |
| 45 |
func (graphTraversal *GraphTraversal) WithEdgeTraversals(edgeTraversals []*EdgeTraversal) *GraphTraversal { |
| 46 |
graphTraversal.EdgeTraversals = edgeTraversals |
| 47 |
return graphTraversal |
| 48 |
} |
| 49 |
|
| 50 |
// AddEdge ... |
| 51 |
func (graphTraversal *GraphTraversal) AddEdge(edgeTraversal *EdgeTraversal) { |
| 52 |
graphTraversal.EdgeTraversals = append(graphTraversal.EdgeTraversals, edgeTraversal) |
| 53 |
} |
| 54 |
|
| 55 |
// WithResultGraphIndex sets the ResultGraphIndex |
| 56 |
func (graphTraversal *GraphTraversal) WithResultGraphIndex(index int) *GraphTraversal { |
| 57 |
graphTraversal.ResultGraphIndex = &index |
| 58 |
return graphTraversal |
| 59 |
} |
| 60 |
|
| 61 |
// WithRunGraphIndex sets the RunGraphIndex |
| 62 |
func (graphTraversal *GraphTraversal) WithRunGraphIndex(index int) *GraphTraversal { |
| 63 |
graphTraversal.RunGraphIndex = &index |
| 64 |
return graphTraversal |
| 65 |
} |
| 66 |
|
| 67 |
// WithImmutableState sets the ImmutableState |
| 68 |
func (graphTraversal *GraphTraversal) WithImmutableState(immutableState map[string]*MultiformatMessageString) *GraphTraversal { |
| 69 |
graphTraversal.ImmutableState = immutableState |
| 70 |
return graphTraversal |
| 71 |
} |
| 72 |
|
| 73 |
// WithInitialState sets the InitialState |
| 74 |
func (graphTraversal *GraphTraversal) WithInitialState(initialState map[string]*MultiformatMessageString) *GraphTraversal { |
| 75 |
graphTraversal.InitialState = initialState |
| 76 |
return graphTraversal |
| 77 |
} |