Package net.solarnetwork.domain.tariff
Class SimpleTemporalTariffSchedule
java.lang.Object
net.solarnetwork.domain.tariff.SimpleTemporalTariffSchedule
- All Implemented Interfaces:
TariffSchedule
A simple time-based tariff schedule based on a list of time-based rules.
- Since:
- 1.71
- Version:
- 1.0
- Author:
- matt
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TemporalRangesTariffEvaluatorTheevaluatordefault value.static final booleanThefirstMatchOnlydefault value. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.SimpleTemporalTariffSchedule(Iterable<TemporalRangesTariff> rules, TemporalRangesTariffEvaluator evaluator) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiongetRules()Get the configured rules.booleanGet the first-match-only flag.resolveTariff(LocalDateTime dateTime, Map<String, ?> parameters) Resolve a tariff.voidsetFirstMatchOnly(boolean firstMatchOnly) Set the first-match-only flag.
-
Field Details
-
DEFAULT_EVALUATOR
Theevaluatordefault value. -
DEFAULT_FIRST_MATCH_ONLY
public static final boolean DEFAULT_FIRST_MATCH_ONLYThefirstMatchOnlydefault value.- See Also:
-
-
Constructor Details
-
SimpleTemporalTariffSchedule
Constructor.- Parameters:
rules- the schedule rules
-
SimpleTemporalTariffSchedule
public SimpleTemporalTariffSchedule(Iterable<TemporalRangesTariff> rules, TemporalRangesTariffEvaluator evaluator) Constructor.- Parameters:
rules- the schedule rulesevaluator- the evaluator
-
-
Method Details
-
resolveTariff
Description copied from interface:TariffScheduleResolve a tariff.- Specified by:
resolveTariffin interfaceTariffSchedule- Parameters:
dateTime- the date to resolve a tariff forparameters- optional parameters- Returns:
- the tariff, or null if no tariff applies
-
isFirstMatchOnly
public boolean isFirstMatchOnly()Get the first-match-only flag.- Returns:
- true if only the first tariff rule that matches should
be returned, false to return a composite rule of all
matches; defaults to
DEFAULT_FIRST_MATCH_ONLY
-
setFirstMatchOnly
public void setFirstMatchOnly(boolean firstMatchOnly) Set the first-match-only flag.- Parameters:
firstMatchOnly- true if only the first tariff rule that matches should be returned
-
getRules
Get the configured rules.- Returns:
- the rules
-