Package org.powertac.common.repo
Class TariffSubscriptionRepo
- java.lang.Object
 - 
- org.powertac.common.repo.TariffSubscriptionRepo
 
 
- 
- All Implemented Interfaces:
 DomainRepo
@Service public class TariffSubscriptionRepo extends Object implements DomainRepo
Repository for TariffSubscriptions. This cannot be in common, because TariffSubscription is not in common.- Author:
 - John Collins
 
 
- 
- 
Constructor Summary
Constructors Constructor Description TariffSubscriptionRepo() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TariffSubscriptionadd(TariffSubscription subscription)Adds an existing subscription to the repo.List<TariffSubscription>findActiveSubscriptionsForBroker(Broker broker)Returns the list of active subscriptions for a given broker.List<TariffSubscription>findActiveSubscriptionsForCustomer(CustomerInfo customer)Returns the list of active subscriptions for a given customer.TariffSubscriptionfindSubscriptionForTariffAndCustomer(Tariff tariff, CustomerInfo customer)Returns the subscription, if any, for the specified tariff and customer.List<TariffSubscription>findSubscriptionsForBroker(Broker b)Returns the list of subscriptions for the specified broker.List<TariffSubscription>findSubscriptionsForCustomer(CustomerInfo customer)Returns the list of subscriptions for a given customer.List<TariffSubscription>findSubscriptionsForTariff(Tariff tariff)Returns the list of subscriptions for a given tariff.List<TariffSubscription>getRevokedSubscriptionList(CustomerInfo customer)Returns the list of subscriptions for this customer that have been revoked and have non-zero committed customer counts.TariffSubscriptiongetSubscription(CustomerInfo customer, Tariff tariff)Returns the TariffSubscription for the given Tariff/Customer pair, creating it if necessary.voidrecycle()Clears out the repo in preparation for another simulation.voidremoveSubscriptionsForTariff(Tariff tariff)Removes all subscriptions for the given tariff. 
 - 
 
- 
- 
Method Detail
- 
add
public TariffSubscription add(TariffSubscription subscription)
Adds an existing subscription to the repo. 
- 
getSubscription
public TariffSubscription getSubscription(CustomerInfo customer, Tariff tariff)
Returns the TariffSubscription for the given Tariff/Customer pair, creating it if necessary. Note that as of issue #505, you can get null back if you try to get a subscription for a non-existent tariff, such as one that has been revoked. 
- 
findSubscriptionForTariffAndCustomer
public TariffSubscription findSubscriptionForTariffAndCustomer(Tariff tariff, CustomerInfo customer)
Returns the subscription, if any, for the specified tariff and customer. Does not create a subscription in case it cannot be found in the repo. 
- 
findSubscriptionsForTariff
public List<TariffSubscription> findSubscriptionsForTariff(Tariff tariff)
Returns the list of subscriptions for a given tariff. Return value does not share structure with the repo. 
- 
findSubscriptionsForCustomer
public List<TariffSubscription> findSubscriptionsForCustomer(CustomerInfo customer)
Returns the list of subscriptions for a given customer. Return value does not share structure with the repo. 
- 
findActiveSubscriptionsForCustomer
public List<TariffSubscription> findActiveSubscriptionsForCustomer(CustomerInfo customer)
Returns the list of active subscriptions for a given customer. These are subscriptions that have non-zero committed-customer counts. 
- 
findSubscriptionsForBroker
public List<TariffSubscription> findSubscriptionsForBroker(Broker b)
Returns the list of subscriptions for the specified broker. Return value does not share structure with the repo. 
- 
findActiveSubscriptionsForBroker
public List<TariffSubscription> findActiveSubscriptionsForBroker(Broker broker)
Returns the list of active subscriptions for a given broker. These are subscriptions that have non-zero committed-customer counts. 
- 
getRevokedSubscriptionList
public List<TariffSubscription> getRevokedSubscriptionList(CustomerInfo customer)
Returns the list of subscriptions for this customer that have been revoked and have non-zero committed customer counts. Intended to be called in the context of tariff evaluation (typically by the TariffEvaluator). 
- 
removeSubscriptionsForTariff
public void removeSubscriptionsForTariff(Tariff tariff)
Removes all subscriptions for the given tariff. Presumably this is done when the tariff has been revoked and all revocation processing is complete. 
- 
recycle
public void recycle()
Clears out the repo in preparation for another simulation.- Specified by:
 recyclein interfaceDomainRepo
 
 - 
 
 -