Package energy.eddie.aiida.utils
Class ConnectionLimitCalculation
java.lang.Object
energy.eddie.aiida.utils.ConnectionLimitCalculation
Provides
effectiveLimits() to calculate which limits apply when during the requested time frame and scope.
Limits are scoped by permission id and meter id and may overlap within the same scope. When multiple limits overlap, the limit with the newest createdAt timestamp takes precedence.
The calculation is performed independently for each scope using a sweep-line algorithm:
- Create start and end events for all limits.
- Sweep chronologically through the requested interval.
- Maintain the currently active limits per event.
- Select the active limit with the newest createdAt.
- Emit effective time segments.
If no limit is active for a segment, the scope defaults are used when available. Defaults are time-bounded and only apply between their own start and end. If neither limits nor any default coverage exists for a scope, no segment is emitted.
If multiple active limits share the same newest creation timestamp, the most recently inserted is used.
-
Constructor Summary
ConstructorsConstructorDescriptionConnectionLimitCalculation(List<ConnectionLimit> limits, List<ConnectionLimitDefault> defaults, Instant from, Instant to) -
Method Summary
-
Constructor Details
-
ConnectionLimitCalculation
public ConnectionLimitCalculation(List<ConnectionLimit> limits, List<ConnectionLimitDefault> defaults, Instant from, Instant to)
-
-
Method Details
-
effectiveLimits
-