Package org.powertac.common.repo
Class TariffSubscriptionRepo
java.lang.Object
org.powertac.common.repo.TariffSubscriptionRepo
- All Implemented Interfaces:
org.powertac.common.repo.DomainRepo
@Service public class TariffSubscriptionRepo extends Object implements org.powertac.common.repo.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
Modifier and Type Method Description TariffSubscriptionadd(TariffSubscription subscription)Adds an existing subscription to the repo.List<TariffSubscription>findActiveSubscriptionsForBroker(org.powertac.common.Broker broker)Returns the list of active subscriptions for a given broker.List<TariffSubscription>findActiveSubscriptionsForCustomer(org.powertac.common.CustomerInfo customer)Returns the list of active subscriptions for a given customer.TariffSubscriptionfindSubscriptionForTariffAndCustomer(org.powertac.common.Tariff tariff, org.powertac.common.CustomerInfo customer)Returns the subscription, if any, for the specified tariff and customer.List<TariffSubscription>findSubscriptionsForBroker(org.powertac.common.Broker b)Returns the list of subscriptions for the specified broker.List<TariffSubscription>findSubscriptionsForCustomer(org.powertac.common.CustomerInfo customer)Returns the list of subscriptions for a given customer.List<TariffSubscription>findSubscriptionsForTariff(org.powertac.common.Tariff tariff)Returns the list of subscriptions for a given tariff.List<TariffSubscription>getRevokedSubscriptionList(org.powertac.common.CustomerInfo customer)Returns the list of subscriptions for this customer that have been revoked and have non-zero committed customer counts.TariffSubscriptiongetSubscription(org.powertac.common.CustomerInfo customer, org.powertac.common.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(org.powertac.common.Tariff tariff)Removes all subscriptions for the given tariff.
-
Constructor Details
-
TariffSubscriptionRepo
public TariffSubscriptionRepo()
-
-
Method Details
-
add
Adds an existing subscription to the repo. -
getSubscription
public TariffSubscription getSubscription(org.powertac.common.CustomerInfo customer, org.powertac.common.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(org.powertac.common.Tariff tariff, org.powertac.common.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
Returns the list of subscriptions for a given tariff. Return value does not share structure with the repo. -
findSubscriptionsForCustomer
public List<TariffSubscription> findSubscriptionsForCustomer(org.powertac.common.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(org.powertac.common.CustomerInfo customer)Returns the list of active subscriptions for a given customer. These are subscriptions that have non-zero committed-customer counts. -
findSubscriptionsForBroker
Returns the list of subscriptions for the specified broker. Return value does not share structure with the repo. -
findActiveSubscriptionsForBroker
public List<TariffSubscription> findActiveSubscriptionsForBroker(org.powertac.common.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(org.powertac.common.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(org.powertac.common.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 interfaceorg.powertac.common.repo.DomainRepo
-