Interface PunishmentDetailsCalculator
public interface PunishmentDetailsCalculator
Client interface implemented in order to provide calculation of punishment details
within the scope of a database transaction.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordThe computed details of a punishment -
Method Summary
Modifier and TypeMethodDescriptioncompute(EscalationTrack track, Victim victim, SelectionOrderBuilder selectionOrderBuilder) Computes punishment details for the given victim.
-
Method Details
-
compute
PunishmentDetailsCalculator.CalculationResult compute(EscalationTrack track, Victim victim, SelectionOrderBuilder selectionOrderBuilder) Computes punishment details for the given victim.
This method is typically called during the scope of a database transaction, so it should be fast and responsive. The implementation should be stateless, as it may be retried in the case of transaction serialization failure.
Most implementations will wish to retrieve punishments for the specified victim. Punishment retrieval should be performed through and only through the provided selection order builder. A special implementation of the selection interfaces is utilized which completes database operations immediately using the same transaction within which this method is called.- Parameters:
track- the escalation track according to which to computevictim- the victim being punishedselectionOrderBuilder- the selection order builder for which to retrieve punishments in the same context as this calculator is called. It is guaranteed that all futures returned from any built selection orders are completed immediately- Returns:
- the calculated punishment details
- Throws:
IllegalArgumentException- optionally, if this calculator does not support the specified escalation track
-