|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectBrokerage
public class Brokerage
Represents a brokerage.
Constructor Summary | |
---|---|
Brokerage(StockExchange exchange)
Constructs new brokerage affiliated with a given stock exchange. |
Method Summary | |
---|---|
int |
addUser(java.lang.String name,
java.lang.String password)
Tries to register a new trader with a given screen name and password. |
void |
getQuote(java.lang.String symbol,
Trader trader)
Requests a quote for a given stock from the stock exachange and passes it along to the trader by calling trader's receiveMessage method. |
int |
login(java.lang.String name,
java.lang.String password)
Tries to login a trader with a given screen name and password. |
void |
logout(Trader trader)
Removes a specified trader from the set of logged-in traders. |
void |
placeOrder(TradeOrder order)
Places an order at the stock exchange. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Brokerage(StockExchange exchange)
exchange
- a stock exchange.Method Detail |
---|
public int addUser(java.lang.String name, java.lang.String password)
Trader
object
for this trader and adds this trader to the map of all traders
(using the screen name as the key).
addUser
in interface Login
name
- the screen name of the trader.password
- the password for the trader.
public int login(java.lang.String name, java.lang.String password)
openWindow()
method.
Adds the trader to the set of all logged-in traders.
login
in interface Login
name
- the screen name of the trader.password
- the password for the trader.
public void logout(Trader trader)
trader
- the trader that logs out.public void getQuote(java.lang.String symbol, Trader trader)
receiveMessage
method.
symbol
- the stock symbol.trader
- the trader who requested a quote.public void placeOrder(TradeOrder order)
order
- an order to be placed at the stock exchange.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |