|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.powertac.common.Broker
public class Broker
A broker instance represents a competition participant. Broker instances are not communicated to other brokers; only usernames are considered public information and get communicated. Every entity that needs to trade in the wholesale market or post TariffSpecifications must be a broker.
Brokers may be local or non-local (remote), and they may be wholesale or non-wholesale (retail) brokers. Remote brokers receive messages through JMS, while local brokers are assumed to reside in the server's process space where they receive messages by calls to their receiveMessage() methods. Local brokers must override receiveMessage() to see these messages, otherwise they will be dropped on the floor. Local brokers can send messages by calling BrokerProxy.routeMessage();
Wholesale brokers are not permitted to offer tariffs, but may trade in the wholesale market, and they are not included in the balancing process.
| Constructor Summary | |
|---|---|
Broker(String username)
Constructor for username only. |
|
Broker(String username,
boolean local,
boolean wholesale)
Constructor to specify non-standard local/wholesale flags. |
|
| Method Summary | |
|---|---|
Broker |
addMarketPosition(MarketPosition posn,
Timeslot slot)
Associates a MarketPosition with a given Timeslot. |
MarketPosition |
findMarketPositionByTimeslot(Timeslot slot)
Returns the MarketPosition associated with the given Timeslot. |
String |
getApiKey()
Returns the unique ID for this broker as a String. |
CashPosition |
getCash()
Returns the CashPosition for this broker, which is either the CashPosition supplied with the most recent call to setCash(), or a dummy CashPosition with a balance of 0.0. |
long |
getId()
Returns the unique ID for this broker |
String |
getUsername()
Returns the username for this Broker. |
boolean |
isEnabled()
True just in case either the broker is logged in, or is a local wholesale broker. |
boolean |
isLocal()
True for a Broker that is local to the server. |
boolean |
isWholesale()
True for a broker that operates on the wholeside of the wholesale market. |
void |
receiveMessage(Object object)
Default implementation does nothing. |
void |
setCash(CashPosition thing)
Updates the current CashPosition for this Broker. |
void |
setEnabled(boolean enabled)
Enables this Broker. |
protected void |
setLocal(boolean value)
Allows subclasses to set themselves as local brokers. |
protected void |
setWholesale(boolean value)
Allows subclasses to make themselves wholesale brokers |
String |
toQueueName()
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Broker(String username)
public Broker(String username,
boolean local,
boolean wholesale)
| Method Detail |
|---|
public long getId()
public String getApiKey()
public CashPosition getCash()
public void setCash(CashPosition thing)
public Broker addMarketPosition(MarketPosition posn,
Timeslot slot)
public MarketPosition findMarketPositionByTimeslot(Timeslot slot)
public String getUsername()
public boolean isEnabled()
public void setEnabled(boolean enabled)
public boolean isLocal()
protected void setLocal(boolean value)
public boolean isWholesale()
protected void setWholesale(boolean value)
public String toString()
toString in class Objectpublic String toQueueName()
public void receiveMessage(Object object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||