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 Details

  • Method Details

    • add

      public TariffSubscription add​(TariffSubscription subscription)
      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

      public List<TariffSubscription> findSubscriptionsForTariff​(org.powertac.common.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​(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

      public List<TariffSubscription> findSubscriptionsForBroker​(org.powertac.common.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​(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:
      recycle in interface org.powertac.common.repo.DomainRepo