// IncrementStepSelector Increment the given step selector, taking into account compound steps
IncrementStepSelector Increment the given step selector, taking into account compound steps
// IncrementStepSelector Increment the given step selector taking into account compound steps
func (w *Workflow) IncrementStepSelector(selector []int) []int {
	if len(selector) == 0 {
		return []int{0}
	}
	numSegments := len(selector)
	newSelector := make([]int, numSegments)
	steps := w.Spec.Steps
	stepCounts := make([]int, numSegments)
	for i, segment := range selector {
		stepCounts[i] = len(steps)
		if steps[segment].Compound != nil {
			steps = steps[segment].Compound.Steps
		} else {
			steps = nil
		}
	}
	segment := numSegments - 1
	for segment >= 0 {
		newSelector[segment] = selector[segment] + 1
		if newSelector[segment] < stepCounts[segment] {
			break
		}
		newSelector = newSelector[:segment]
		segment--
	}
	if len(newSelector) > 0 {
		for {
			step := w.Select(newSelector)
			if step.Compound != nil {
				newSelector = append(newSelector, 0)
			} else {
				break
			}
		}
	}
	return newSelector
}
func ( w * Workflow ) IncrementStepSelector ( selector [ ] int ) [ ] int { if len ( selector ) == 0 { return [ ] int { 0 } } numSegments := len ( selector ) newSelector := make ( [ ] int , numSegments ) steps := w . Spec . Steps stepCounts := make ( [ ] int , numSegments ) for i , segment := range selector { stepCounts [ i ] = len ( steps ) if steps [ segment ] . Compound != nil { steps = steps [ segment ] . Compound . Steps } else { steps = nil } } segment := numSegments - 1 for segment >= 0 { newSelector [ segment ] = selector [ segment ] + 1 if newSelector [ segment ] < stepCounts [ segment ] { break } newSelector = newSelector [ : segment ] segment -- } if len ( newSelector ) > 0 { for { step := w . Select ( newSelector ) if step . Compound != nil { newSelector = append ( newSelector , 0 ) } else { break } } } return newSelector }
IncrementStepSelector Increment the given step selector, taking into account compound steps
IncrementStepSelector Increment the given step selector taking into account compound steps