Package org.powertac.common
Class TransactionFactory
- java.lang.Object
-
- org.powertac.common.TransactionFactory
-
@Scope("singleton") @Service public class TransactionFactory extends Object
Constructs transaction objects in a way that guarantees that the correct data goes into the state log, without requiring unnecessary couplings on the part of transaction sources. Each method constructs a new transaction for the given broker and arguments and returns it. There is no attempt to cache them or look them up.- Author:
- John Collins
-
-
Constructor Summary
Constructors Constructor Description TransactionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BalancingTransaction
makeBalancingTransaction(Broker broker, double kWh, double charge)
BankTransaction
makeBankTransaction(Broker broker, double amount)
CapacityTransaction
makeCapacityTransaction(Broker broker, int peakTimeslot, double threshold, double kWh, double fee)
CashPosition
makeCashPosition(Broker broker, double balance)
DistributionTransaction
makeDistributionTransaction(Broker broker, int nSmall, int nLarge, double transport, double distroCharge)
MarketTransaction
makeMarketTransaction(Broker broker, Timeslot timeslot, double mWh, double price)
TariffTransaction
makeTariffTransaction(Broker broker, TariffTransaction.Type txType, TariffSpecification spec, CustomerInfo customer, int customerCount, double kWh, double charge)
Creates a tariff transaction that is not a regulation transaction.TariffTransaction
makeTariffTransaction(Broker broker, TariffTransaction.Type txType, TariffSpecification spec, CustomerInfo customer, int customerCount, double kWh, double charge, boolean isRegulation)
Creates a tariff transaction that could be a regulation transaction, depending on the value of the isRegulation parameter.
-
-
-
Method Detail
-
makeBankTransaction
public BankTransaction makeBankTransaction(Broker broker, double amount)
-
makeBalancingTransaction
public BalancingTransaction makeBalancingTransaction(Broker broker, double kWh, double charge)
-
makeCashPosition
public CashPosition makeCashPosition(Broker broker, double balance)
-
makeDistributionTransaction
public DistributionTransaction makeDistributionTransaction(Broker broker, int nSmall, int nLarge, double transport, double distroCharge)
-
makeMarketTransaction
public MarketTransaction makeMarketTransaction(Broker broker, Timeslot timeslot, double mWh, double price)
-
makeTariffTransaction
public TariffTransaction makeTariffTransaction(Broker broker, TariffTransaction.Type txType, TariffSpecification spec, CustomerInfo customer, int customerCount, double kWh, double charge)
Creates a tariff transaction that is not a regulation transaction.
-
makeTariffTransaction
public TariffTransaction makeTariffTransaction(Broker broker, TariffTransaction.Type txType, TariffSpecification spec, CustomerInfo customer, int customerCount, double kWh, double charge, boolean isRegulation)
Creates a tariff transaction that could be a regulation transaction, depending on the value of the isRegulation parameter.
-
makeCapacityTransaction
public CapacityTransaction makeCapacityTransaction(Broker broker, int peakTimeslot, double threshold, double kWh, double fee)
-
-