/// <summary> /// /// </summary> /// <param name="actionList"></param> /// <param name="type">Specifies in what order the actions should be run.</param> /// <param name="minimumPause">Specifies the minimum wait time that /// should be used after an action has completed</param> /// <param name="maximumPause">Specifies the maximum wait time that /// should be used after an action has completed</param> /// <param name="loop">If false, the action will return after a complete run. Otherwise /// it will loop endlessly. Note that using false is not possible when specifying /// CompoundActionType.RandomIndex as type.</param> public CompoundAction(IList<IAction> actionList, CompoundActionType type = CompoundActionType.Sequential, int minimumPause = 0, int maximumPause = 0, bool loop = true) { if (actionList == null || actionList.Count == 0) throw new ArgumentException("There must be at least one IAction to start the simulator."); if (minimumPause < PauseIntervalMinimum || minimumPause > PauseIntervalMaximum || maximumPause < PauseIntervalMinimum || maximumPause > PauseIntervalMaximum) throw new ArgumentOutOfRangeException("The pause duration values must be between " + $"{PauseIntervalMinimum} and {PauseIntervalMaximum} milliseconds."); if (minimumPause > maximumPause) throw new ArgumentException("The minimum pause duration must not be greater " + "than the maximum wait interval."); if (type == CompoundActionType.RandomIndex && !loop) throw new ArgumentException("When using CompoundActionType.RandomIndex, it is not possible " + " to disable the loop."); this.actionList = actionList; this.type = type; this.minimumPauseDuration = minimumPause; this.maximumPauseDuration = maximumPause; this.loop = loop; }
/// <summary> /// /// </summary> /// <param name="actionList"></param> /// <param name="type">Specifies in what order the actions should be run.</param> /// <param name="minimumPause">Specifies the minimum wait time that /// should be used after an action has completed</param> /// <param name="maximumPause">Specifies the maximum wait time that /// should be used after an action has completed</param> /// <param name="loop">If false, the action will return after a complete run. Otherwise /// it will loop endlessly. Note that using false is not possible when specifying /// CompoundActionType.RandomIndex as type.</param> public CompoundAction( IList <IAction> actionList, CompoundActionType type = CompoundActionType.Sequential, int minimumPause = 0, int maximumPause = 0, bool loop = true) { if (actionList == null || actionList.Count == 0) { throw new ArgumentException("There must be at least one IAction to start the simulator."); } if (minimumPause < PauseIntervalMinimum || minimumPause > PauseIntervalMaximum || maximumPause < PauseIntervalMinimum || maximumPause > PauseIntervalMaximum) { throw new ArgumentOutOfRangeException("The pause duration values must be between " + $"{PauseIntervalMinimum} and {PauseIntervalMaximum} milliseconds."); } if (minimumPause > maximumPause) { throw new ArgumentException("The minimum pause duration must not be greater " + "than the maximum wait interval."); } if (type == CompoundActionType.RandomIndex && !loop) { throw new ArgumentException("When using CompoundActionType.RandomIndex, it is not possible " + " to disable the loop."); } this.actionList = actionList; this.type = type; this.minimumPauseDuration = minimumPause; this.maximumPauseDuration = maximumPause; this.loop = loop; }