public class TariffSpecification extends TariffMessage
TariffSpecifications and their associated Rates and HourlyCharges are specified from the Customer's viewpoint in terms of quantities and charges. In other words, a positive charge means the broker pays the customer, while a positive energy quantity means the broker sends energy to the customer.
Note: Must be serialized "deep" to gather up the Rates and associated HourlyCharge instances.
State log entry format for new instance:
long brokerId, PowerType powerType
State log fields for readResolve():
long brokerId, PowerType powerType, long minDuration,
double signupPayment, double earlyWithdrawPayment,
double periodicPayment, List
broker, id| Modifier | Constructor and Description |
|---|---|
protected |
TariffSpecification() |
|
TariffSpecification(Broker broker,
PowerType powerType)
Creates a new TariffSpecification for a broker and a specific powerType.
|
| Modifier and Type | Method and Description |
|---|---|
TariffSpecification |
addRate(RateCore rate)
Adds a new RateCore (Rate, RegulationRate, etc.) to this tariff.
|
TariffSpecification |
addSupersedes(long specId)
Indicates that this tariff supersedes the tariff specified by the
specId, the id of the superseded tariff.
|
Broker |
getBroker() |
double |
getEarlyWithdrawPayment() |
org.joda.time.Instant |
getExpiration() |
long |
getId() |
long |
getMinDuration() |
double |
getPeriodicPayment() |
PowerType |
getPowerType() |
List<Rate> |
getRates()
Returns the Rate instances from among the rates in this tariff spec.
|
List<RegulationRate> |
getRegulationRates()
Returns the RegulationRate instances from among the rates
in this tariff spec.
|
double |
getSignupPayment() |
List<Long> |
getSupersedes() |
boolean |
hasRegulationRate()
Returns true just in case this tariff has one or more RegulationRates.
|
boolean |
isValid()
A TariffSpecification is valid if
it has a least one Rate, and all its Rates are valid;
minDuration is non-negative;
|
String |
toString()
Returns a String giving the id, broker username, and powertype
|
TariffSpecification |
withEarlyWithdrawPayment(double earlyWithdrawPayment)
Sets the payment for a customer who withdraws from a subscription to
this tariff before the minimumDuration has expired.
|
TariffSpecification |
withExpiration(org.joda.time.Instant expiration)
Sets the expiration date for this tariff.
|
TariffSpecification |
withMinDuration(long minDuration)
Sets the minimum duration of a subscription for this tariff.
|
TariffSpecification |
withPeriodicPayment(double periodicPayment)
Sets the daily payment per customer for subscriptions to this tariff.
|
TariffSpecification |
withSignupPayment(double signupPayment)
Sets the signup payment for new subscriptions.
|
readResolvepublic TariffSpecification(Broker broker, PowerType powerType)
withX() methods.protected TariffSpecification()
public PowerType getPowerType()
public org.joda.time.Instant getExpiration()
public TariffSpecification withExpiration(org.joda.time.Instant expiration)
public long getMinDuration()
public TariffSpecification withMinDuration(long minDuration)
public double getSignupPayment()
public TariffSpecification withSignupPayment(double signupPayment)
public double getEarlyWithdrawPayment()
public TariffSpecification withEarlyWithdrawPayment(double earlyWithdrawPayment)
public double getPeriodicPayment()
public TariffSpecification withPeriodicPayment(double periodicPayment)
public long getId()
getId in class TariffMessagepublic Broker getBroker()
getBroker in class TariffMessagepublic List<Rate> getRates()
public List<RegulationRate> getRegulationRates()
public boolean hasRegulationRate()
public TariffSpecification addRate(RateCore rate)
public TariffSpecification addSupersedes(long specId)
public boolean isValid()
isValid in interface ValidatableMessageisValid in class TariffMessageCopyright © 2015. All Rights Reserved.