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.
 
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.


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 removed from the repository, so a second call in the same timeslot cycle will return an empty list.


recycle

public void recycle()
Clears out the repo in preparation for another simulation.

Specified by:
recycle in interface org.powertac.common.repo.DomainRepo


Copyright © 2011 Power TAC. All Rights Reserved.