Class 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.powertac.common.BalancingTransaction makeBalancingTransaction​(org.powertac.common.Broker broker, double kWh, double charge)  
      org.powertac.common.BankTransaction makeBankTransaction​(org.powertac.common.Broker broker, double amount)  
      org.powertac.common.CapacityTransaction makeCapacityTransaction​(org.powertac.common.Broker broker, int peakTimeslot, double threshold, double kWh, double fee)  
      org.powertac.common.CashPosition makeCashPosition​(org.powertac.common.Broker broker, double balance)  
      org.powertac.common.DistributionTransaction makeDistributionTransaction​(org.powertac.common.Broker broker, int nSmall, int nLarge, double transport, double distroCharge)  
      org.powertac.common.MarketTransaction makeMarketTransaction​(org.powertac.common.Broker broker, org.powertac.common.Timeslot timeslot, double mWh, double price)  
      org.powertac.common.TariffTransaction makeTariffTransaction​(org.powertac.common.Broker broker, org.powertac.common.TariffTransaction.Type txType, org.powertac.common.TariffSpecification spec, org.powertac.common.CustomerInfo customer, int customerCount, double kWh, double charge)
      Creates a tariff transaction that is not a regulation transaction.
      org.powertac.common.TariffTransaction makeTariffTransaction​(org.powertac.common.Broker broker, org.powertac.common.TariffTransaction.Type txType, org.powertac.common.TariffSpecification spec, org.powertac.common.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.
    • Constructor Detail

      • TransactionFactory

        public TransactionFactory()
    • Method Detail

      • makeBankTransaction

        public org.powertac.common.BankTransaction makeBankTransaction​(org.powertac.common.Broker broker,
                                                                       double amount)
      • makeBalancingTransaction

        public org.powertac.common.BalancingTransaction makeBalancingTransaction​(org.powertac.common.Broker broker,
                                                                                 double kWh,
                                                                                 double charge)
      • makeCashPosition

        public org.powertac.common.CashPosition makeCashPosition​(org.powertac.common.Broker broker,
                                                                 double balance)
      • makeDistributionTransaction

        public org.powertac.common.DistributionTransaction makeDistributionTransaction​(org.powertac.common.Broker broker,
                                                                                       int nSmall,
                                                                                       int nLarge,
                                                                                       double transport,
                                                                                       double distroCharge)
      • makeMarketTransaction

        public org.powertac.common.MarketTransaction makeMarketTransaction​(org.powertac.common.Broker broker,
                                                                           org.powertac.common.Timeslot timeslot,
                                                                           double mWh,
                                                                           double price)
      • makeTariffTransaction

        public org.powertac.common.TariffTransaction makeTariffTransaction​(org.powertac.common.Broker broker,
                                                                           org.powertac.common.TariffTransaction.Type txType,
                                                                           org.powertac.common.TariffSpecification spec,
                                                                           org.powertac.common.CustomerInfo customer,
                                                                           int customerCount,
                                                                           double kWh,
                                                                           double charge)
        Creates a tariff transaction that is not a regulation transaction.
      • makeTariffTransaction

        public org.powertac.common.TariffTransaction makeTariffTransaction​(org.powertac.common.Broker broker,
                                                                           org.powertac.common.TariffTransaction.Type txType,
                                                                           org.powertac.common.TariffSpecification spec,
                                                                           org.powertac.common.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 org.powertac.common.CapacityTransaction makeCapacityTransaction​(org.powertac.common.Broker broker,
                                                                               int peakTimeslot,
                                                                               double threshold,
                                                                               double kWh,
                                                                               double fee)