Package org.powertac.common.repo
Class TariffRepo
- java.lang.Object
- 
- org.powertac.common.repo.TariffRepo
 
- 
- All Implemented Interfaces:
- DomainRepo
 
 @Service public class TariffRepo extends Object implements DomainRepo Repository for TariffSpecifications, Tariffs, Rates, and other related types.- Author:
- John Collins
 
- 
- 
Constructor SummaryConstructors Constructor Description TariffRepo()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBalancingOrder(BalancingOrder order)Adds a balancing order, indexed by its TariffSpecvoidaddSpecification(TariffSpecification spec)Adds a TariffSpecification to the repo just in case another spec (or this one) has not already been added sometime in the past.voidaddTariff(Tariff tariff)voiddeleteTariff(Tariff tariff)Deletes a tariff and its specification from the repo, without tracking.List<Tariff>findActiveTariffs(PowerType type)Returns the list of active tariffs that exactly match the given PowerType.List<Tariff>findAllActiveTariffs(PowerType type)Returns the list of active tariffs that can be used by a customer of the given PowerType, including those that are more generic than the specific type.List<Tariff>findAllTariffs()List<TariffSpecification>findAllTariffSpecifications()RatefindRateById(long id)List<Tariff>findRecentActiveTariffs(int n, PowerType type)Returns the n most "recent" active tariffs from each broker that can be used by a customer with the given powerType.TariffSpecificationfindSpecificationById(long id)TarifffindTariffById(long id)List<Tariff>findTariffsByBroker(Broker broker)List<Tariff>findTariffsByState(Tariff.State state)List<TariffSpecification>findTariffSpecificationsByBroker(Broker broker)List<TariffSpecification>findTariffSpecificationsByBrokerAndType(Broker broker, PowerType type)List<TariffSpecification>findTariffSpecificationsByPowerType(PowerType type)Collection<BalancingOrder>getBalancingOrders()Retrieves the complete set of balancing ordersTariffgetDefaultTariff(PowerType type)booleanisRemoved(long tariffId)Tests whether a tariff has been deleted.voidrecycle()Implementations must clear out the repository in preparation for a new simulation.voidremoveSpecification(long id)voidremoveTariff(Tariff tariff)Removes a tariff and its specification from the repo.voidsetDefaultTariff(TariffSpecification newSpec)
 
- 
- 
- 
Method Detail- 
addSpecificationpublic void addSpecification(TariffSpecification spec) Adds a TariffSpecification to the repo just in case another spec (or this one) has not already been added sometime in the past.
 - 
removeSpecificationpublic void removeSpecification(long id) 
 - 
setDefaultTariffpublic void setDefaultTariff(TariffSpecification newSpec) 
 - 
findSpecificationByIdpublic TariffSpecification findSpecificationById(long id) 
 - 
findTariffSpecificationsByBrokerpublic List<TariffSpecification> findTariffSpecificationsByBroker(Broker broker) 
 - 
findTariffSpecificationsByPowerTypepublic List<TariffSpecification> findTariffSpecificationsByPowerType(PowerType type) 
 - 
findTariffSpecificationsByBrokerAndTypepublic List<TariffSpecification> findTariffSpecificationsByBrokerAndType(Broker broker, PowerType type) 
 - 
findAllTariffSpecificationspublic List<TariffSpecification> findAllTariffSpecifications() 
 - 
addTariffpublic void addTariff(Tariff tariff) 
 - 
findTariffByIdpublic Tariff findTariffById(long id) 
 - 
findTariffsByStatepublic List<Tariff> findTariffsByState(Tariff.State state) 
 - 
findActiveTariffspublic List<Tariff> findActiveTariffs(PowerType type) Returns the list of active tariffs that exactly match the given PowerType.
 - 
findAllActiveTariffspublic List<Tariff> findAllActiveTariffs(PowerType type) Returns the list of active tariffs that can be used by a customer of the given PowerType, including those that are more generic than the specific type.
 - 
findRecentActiveTariffspublic List<Tariff> findRecentActiveTariffs(int n, PowerType type) Returns the n most "recent" active tariffs from each broker that can be used by a customer with the given powerType.
 - 
removeTariffpublic void removeTariff(Tariff tariff) Removes a tariff and its specification from the repo. remembers that tariff has been removed, prevents re-adding.
 - 
deleteTariffpublic void deleteTariff(Tariff tariff) Deletes a tariff and its specification from the repo, without tracking. Should not be used in the server.
 - 
isRemovedpublic boolean isRemoved(long tariffId) Tests whether a tariff has been deleted.
 - 
findRateByIdpublic Rate findRateById(long id) 
 - 
addBalancingOrderpublic void addBalancingOrder(BalancingOrder order) Adds a balancing order, indexed by its TariffSpec
 - 
getBalancingOrderspublic Collection<BalancingOrder> getBalancingOrders() Retrieves the complete set of balancing orders
 - 
recyclepublic void recycle() Description copied from interface:DomainRepoImplementations must clear out the repository in preparation for a new simulation.- Specified by:
- recyclein interface- DomainRepo
 
 
- 
 
-