Interface SelectionBase
- All Known Subinterfaces:
SelectionByApplicability, SelectionOrder
public interface SelectionBase
A selection which will match punishments in the database with certain details.
A punishment is said to match if it meets all of this selection's requirements.
A punishment is said to match if it meets all of this selection's requirements.
-
Method Summary
Modifier and TypeMethodDescriptionspace.arim.omnibus.util.concurrent.ReactionStage<Integer> Gets the number of punishments matching this selection.booleanWhether this punishment selection is equal to another, i.e. if the other selection would match the same punishments in all circumstances.default space.arim.omnibus.util.concurrent.ReactionStage<List<Punishment>> Gets all punishments matching this selection.space.arim.omnibus.util.concurrent.ReactionStage<List<Punishment>> getAllSpecificPunishments(SortPunishments... ordering) Gets all punishments matching this selection, ordered in the specified fashion.Gets the escalation tracks matcheddefault space.arim.omnibus.util.concurrent.ReactionStage<Optional<Punishment>> Gets the first punishment matching this selection.space.arim.omnibus.util.concurrent.ReactionStage<Optional<Punishment>> getFirstSpecificPunishment(SortPunishments... prioritization) Gets the first punishment matching this selection.Gets the operators matchedGets the scopes matchedgetTypes()Gets the punishment types matchedintGets the amount of punishments to retrieve.longGets the minimum ID after which punishments will be selected.Gets the minimum start time after which punishments will be selected.longGets the maximum ID before which punishments will be selected.Gets the maximum start time before which punishments will be selected.booleanWhether this selection will match only active, non-expired punishments.intGets the initial amount of punishments skipped.
-
Method Details
-
getTypes
SelectionPredicate<PunishmentType> getTypes()Gets the punishment types matched- Returns:
- the punishment types
-
getOperators
-
getScopes
-
getEscalationTracks
SelectionPredicate<Optional<EscalationTrack>> getEscalationTracks()Gets the escalation tracks matched- Returns:
- the escalation tracks
-
selectActiveOnly
boolean selectActiveOnly()Whether this selection will match only active, non-expired punishments. Iffalse, then this selection may match any punishments, including undone or expired punishments.- Returns:
- true to select only active and non-expired punishments, false to select all punishments
-
skipCount
int skipCount()- Returns:
- the amount of punishments skipped
-
limitToRetrieve
int limitToRetrieve()- Returns:
- the amount to retrieve, or
0for unlimited
-
seekAfterStartTime
Instant seekAfterStartTime()Gets the minimum start time after which punishments will be selected.
SeeSelectionBuilderBase.seekAfter(Instant, long)- Returns:
- the minimum start time, or
Instant.EPOCHfor none
-
seekAfterId
long seekAfterId()Gets the minimum ID after which punishments will be selected.
SeeSelectionBuilderBase.seekAfter(Instant, long)- Returns:
- the minimum ID, which is meaningless if
seekAfterStartTime()isInstant.EPOCH
-
seekBeforeStartTime
Instant seekBeforeStartTime()Gets the maximum start time before which punishments will be selected.
SeeSelectionBuilderBase.seekBefore(Instant, long)- Returns:
- the maximum start time, or
Instant.MAXfor none
-
seekBeforeId
long seekBeforeId()Gets the maximum ID before which punishments will be selected.
SeeSelectionBuilderBase.seekBefore(Instant, long)- Returns:
- the maximum ID, which is meaningless if
seekBeforeStartTime()isInstant.MAX
-
getFirstSpecificPunishment
default space.arim.omnibus.util.concurrent.ReactionStage<Optional<Punishment>> getFirstSpecificPunishment()Gets the first punishment matching this selection.
If multiple punishments exist, the one chosen depends on the date enacted. The latest punishment will come first.- Returns:
- a future which yields the first punishment matching this selection, or an empty optional if none matched
-
getFirstSpecificPunishment
space.arim.omnibus.util.concurrent.ReactionStage<Optional<Punishment>> getFirstSpecificPunishment(SortPunishments... prioritization) Gets the first punishment matching this selection.
If multiple punishments exist, theprioritizationparameter determines which will be returned.- Parameters:
prioritization- how to evaluate which punishment comes first- Returns:
- a future which yields the first punishment matching this selection, or an empty optional if none matched
-
getAllSpecificPunishments
default space.arim.omnibus.util.concurrent.ReactionStage<List<Punishment>> getAllSpecificPunishments()Gets all punishments matching this selection.
The returned list is ordered by the date the punishment was enacted. The latest punishments come first.- Returns:
- a future which yields all punishments matching this selection, or an empty set if none matched
-
getAllSpecificPunishments
space.arim.omnibus.util.concurrent.ReactionStage<List<Punishment>> getAllSpecificPunishments(SortPunishments... ordering) Gets all punishments matching this selection, ordered in the specified fashion.
Using theorderingparameter is potentially superior to manually sorting the returned list, since it may perform ordering on the database side.- Parameters:
ordering- how to order the returned punishments- Returns:
- a future which yields all punishments matching this selection, or an empty set if none matched
-
countNumberOfPunishments
space.arim.omnibus.util.concurrent.ReactionStage<Integer> countNumberOfPunishments()Gets the number of punishments matching this selection.- Returns:
- a future which yields the number of punishments matching this selection
-
equals
-