org.powertac.common.repo
Class TariffSubscriptionRepo

java.lang.Object
  extended by org.powertac.common.repo.TariffSubscriptionRepo
All Implemented Interfaces:
org.powertac.common.repo.DomainRepo

@Repository
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
TariffSubscriptionRepo()
           
 
Method Summary
 TariffSubscription add(TariffSubscription subscription)
          Adds an existing subscription to the repo.
 List<TariffSubscription> findActiveSubscriptionsForCustomer(org.powertac.common.CustomerInfo customer)
          Returns the list of active subscriptions for a given customer.
 TariffSubscription findSubscriptionForTariffAndCustomer(org.powertac.common.Tariff tariff, org.powertac.common.CustomerInfo customer)
           
 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.
 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.
 void recycle()
          Clears out the repo in preparation for another simulation.
 void removeSubscriptionsForTariff(org.powertac.common.Tariff tariff)
          Removes all subscriptions for the given tariff.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TariffSubscriptionRepo

public TariffSubscriptionRepo()
Method Detail

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.


findSubscriptionsForTariff

public List<TariffSubscription> findSubscriptionsForTariff(org.powertac.common.Tariff tariff)
Returns the list of subscriptions for a given tariff.


findSubscriptionsForCustomer

public List<TariffSubscription> findSubscriptionsForCustomer(org.powertac.common.CustomerInfo customer)
Returns the list of subscriptions for a given customer.


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.


add

public TariffSubscription add(TariffSubscription subscription)
Adds an existing subscription to the repo.


findSubscriptionForTariffAndCustomer

public TariffSubscription findSubscriptionForTariffAndCustomer(org.powertac.common.Tariff tariff,
                                                               org.powertac.common.CustomerInfo customer)

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. Note that the returned subscriptions are expected to be removed from the repository when the tariffMarket is next activated, typically later in the same timeslot.


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


Copyright © 2012 Power TAC. All Rights Reserved.