velodrome/transform/plugins/states.go
func NewState(statesDescription string) State {
	states := []State{}

	if statesDescription == "" {
		// Create an infinite inactive state
		return &InactiveState{
			entry: FalseEvent{},
		}
	}

	splitDescription := strings.Split(statesDescription, ",")
	for _, description := range splitDescription {
		description = strings.TrimSpace(description)
		if strings.HasPrefix(description, "!") {
			states = append(states, &ActiveState{
				startTime: time.Time{},
				exit:      NewEventMatcher(description[1:]),
			})
		} else {
			states = append(states, &InactiveState{
				entry: NewEventMatcher(description),
			})
		}
	}

	return &MultiState{states: states}
}
func NewState(statesDescription string) State {
	states := []State{}

	if statesDescription == "" {
		// Create an infinite inactive state
		return &InactiveState{
			entry: FalseEvent{},
		}
	}

	splitDescription := strings.Split(statesDescription, ",")
	for _, description := range splitDescription {
		description = strings.TrimSpace(description)
		if strings.HasPrefix(description, "!") {
			states = append(states, &ActiveState{
				startTime: time.Time{},
				exit:      NewEventMatcher(description[1:]),
			})
		} else {
			states = append(states, &InactiveState{
				entry: NewEventMatcher(description),
			})
		}
	}

	return &MultiState{states: states}
}
// NewState creates a MultiState instance based on the statesDescription
// string. statesDescription is a comma separated list of
// events. Events can be prepended with "!" (bang) to say that the state
// will be activated only if this event doesn't happen (or is inverted).