TipRule class abstract
A condition for a tip to become available.
Rules are evaluated synchronously against the current state, so anything outside the tip system that a rule depends on is passed in through a TipParameter or counted with a TipEvent.
Implement this class for conditions the built-in rules cannot express.
- Annotations
Constructors
- TipRule()
-
Lets subclasses be
const.const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
evaluate(
TipRuleContext context) → bool -
Whether the rule holds in
context. -
nextChange(
TipRuleContext context) → DateTime? -
The earliest time after
context.nowat which the result of evaluate can change by itself, without any parameter, event or tip changing. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
allOf(
List< TipRule> rules) → TipRule -
Holds when every rule in
rulesholds. -
anyOf(
List< TipRule> rules) → TipRule -
Holds when at least one rule in
rulesholds. -
event(
TipEvent event, bool predicate(TipEventDonations donations)) → TipRule -
Holds while
predicatereturns true for the donations ofevent. -
not(
TipRule rule) → TipRule -
Holds when
ruledoes not. -
parameter<
T> (TipParameter< T> parameter, bool predicate(T value)) → TipRule -
Holds while
predicatereturns true for the value ofparameter. -
tipInvalidated(
Tip tip, {Duration minAge = Duration.zero, Set< TipInvalidationReason> ? reasons}) → TipRule -
Holds once
tiphas been invalidated, at leastminAgeago, and, ifreasonsis given, for one of those reasons.