Builder class for constructing and composing spawning strategies using a fluent API.
Provides a convenient way to create complex spawning strategies by combining basic strategies with transformations like scaling, offsetting, and clamping. Supports method chaining for readable strategy composition.
Value parameters
- strategy
-
the current strategy being built
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Constructors
Creates a new builder with a default constant strategy of rate 0.
Creates a new builder with a default constant strategy of rate 0.
Attributes
Concrete methods
Finalizes the builder and returns the constructed strategy.
Finalizes the builder and returns the constructed strategy.
Attributes
- Returns
-
the final SpawningStrategy instance
Clamps the current strategy's output within specified bounds.
Clamps the current strategy's output within specified bounds.
Ensures the spawning count never goes below the minimum or above the maximum, useful for preventing extreme values in complex strategy compositions.
Value parameters
- max
-
the maximum number of customers to spawn (must be >= min)
- min
-
the minimum number of customers to spawn (must be non-negative)
Attributes
- Returns
-
new builder with clamping applied
- Throws
-
IllegalArgumentException
if constraints are violated
Sets the strategy to a constant spawning rate.
Sets the strategy to a constant spawning rate.
Value parameters
- rate
-
the constant number of customers to spawn per time unit
Attributes
- Returns
-
new builder with the constant strategy
Sets the strategy to a custom function.
Sets the strategy to a custom function.
Value parameters
- f
-
function that maps time to customer count
Attributes
- Returns
-
new builder with the custom strategy
Sets the strategy to a Gaussian distribution pattern.
Sets the strategy to a Gaussian distribution pattern.
Value parameters
- mean
-
the time point of peak activity
- peak
-
the maximum number of customers at the distribution peak
- stdDev
-
the standard deviation of the distribution
Attributes
- Returns
-
new builder with the Gaussian strategy
Adds a constant offset to the current strategy's output.
Adds a constant offset to the current strategy's output.
Value parameters
- amount
-
the number of additional customers to spawn (must be non-negative)
Attributes
- Returns
-
new builder with offset applied
- Throws
-
IllegalArgumentException
if amount is negative
Scales the current strategy's output by a multiplication factor.
Scales the current strategy's output by a multiplication factor.
Value parameters
- factor
-
the scaling factor to apply (must be non-negative)
Attributes
- Returns
-
new builder with scaling applied
- Throws
-
IllegalArgumentException
if factor is negative
Sets the strategy to a step function with two distinct rates.
Sets the strategy to a step function with two distinct rates.
Value parameters
- end
-
end of the high-activity period
- highRate
-
customers per time unit during high-activity periods
- lowRate
-
customers per time unit during low-activity periods
- start
-
beginning of the high-activity period
Attributes
- Returns
-
new builder with the step strategy