org.powertac.common.msg
Class VariableRateUpdate

java.lang.Object
  extended by org.powertac.common.state.XStreamStateLoggable
      extended by org.powertac.common.TariffMessage
          extended by org.powertac.common.msg.TariffUpdate
              extended by org.powertac.common.msg.VariableRateUpdate
All Implemented Interfaces:
ValidatableMessage

public class VariableRateUpdate
extends TariffUpdate

Conveys an HourlyCharge instance, labeled by its Tariff and Rate. When received by the server, the HourlyCharge simply needs to be added to its Rate. State log fields for readResolve():
new(long brokerId, long tariffId, long hourlyChargeId, long rateId)

Author:
John Collins

Field Summary
 
Fields inherited from class org.powertac.common.TariffMessage
broker, id
 
Constructor Summary
protected VariableRateUpdate()
           
  VariableRateUpdate(Broker broker, Rate rate, HourlyCharge hourlyCharge)
           
 
Method Summary
 HourlyCharge getHourlyCharge()
           
 long getHourlyChargeId()
           
 HourlyCharge getPayload()
          conventional getter to satisfy beanutils
 long getRateId()
           
 boolean isValid()
          By default, these are invalid.
 boolean isValid(Rate rate)
          Given a Rate, a VRU is valid if it has the correct ID, if the Rate is not fixed, and if the HourlyCharge specifies a value between the minValue and maxValue of the Rate.
 
Methods inherited from class org.powertac.common.msg.TariffUpdate
getTariffId
 
Methods inherited from class org.powertac.common.TariffMessage
getBroker, getId
 
Methods inherited from class org.powertac.common.state.XStreamStateLoggable
readResolve
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariableRateUpdate

public VariableRateUpdate(Broker broker,
                          Rate rate,
                          HourlyCharge hourlyCharge)

VariableRateUpdate

protected VariableRateUpdate()
Method Detail

getHourlyCharge

public HourlyCharge getHourlyCharge()

getPayload

public HourlyCharge getPayload()
conventional getter to satisfy beanutils


getHourlyChargeId

public long getHourlyChargeId()

getRateId

public long getRateId()

isValid

public boolean isValid()
By default, these are invalid. You have to supply the Rate to test validity.

Specified by:
isValid in interface ValidatableMessage
Overrides:
isValid in class TariffMessage

isValid

public boolean isValid(Rate rate)
Given a Rate, a VRU is valid if it has the correct ID, if the Rate is not fixed, and if the HourlyCharge specifies a value between the minValue and maxValue of the Rate.



Copyright © 2013. All Rights Reserved.