marketplace
Class BuyerAgent
java.lang.Object
|
+--ciagent.CIAgent
|
+--marketplace.BuyerAgent
- Direct Known Subclasses:
- BestBuyerAgent, BetterBuyerAgent
- public class BuyerAgent
- extends CIAgent
The BuyerAgent
class implements a very simple buyer agent.
- See Also:
- Serialized Form
Constructor Summary |
BuyerAgent()
Creates a BuyerAgent object. |
BuyerAgent(java.lang.String name)
Creates a BuyerAgent object with the given name. |
Methods inherited from class ciagent.CIAgent |
addAgent,
addCIAgentEventListener,
addPropertyChangeListener,
getAgent,
getAgentPlatform,
getAgents,
getAsyncTime,
getChildren,
getCustomizerClass,
getDisplayName,
getName,
getParent,
getSleepTime,
getState,
getTraceLevel,
notifyCIAgentEventListeners,
postCIAgentEvent,
processAsynchronousEvents,
removeAgent,
removeCIAgentEventListener,
removePropertyChangeListener,
reset,
resumeAgentProcessing,
setAgentPlatform,
setAsyncTime,
setName,
setParent,
setSleepTime,
setState,
setTraceLevel,
startAgentProcessing,
stopAgentProcessing,
suspendAgentProcessing,
trace |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
msg
protected BuySellMessage msg
current
protected BasicNegotiation current
wishList
protected java.util.Vector wishList
pending
protected BasicNegotiation pending
inventory
protected java.util.Hashtable inventory
totalSpent
protected long totalSpent
negotiations
protected java.util.Hashtable negotiations
BuyerAgent
public BuyerAgent()
- Creates a
BuyerAgent
object.
BuyerAgent
public BuyerAgent(java.lang.String name)
- Creates a
BuyerAgent
object with the given name.
- Parameters:
Name
- the String object the name of the agent
initialize
public void initialize()
- Registers with the facilitator and initializes its wish list.
- Overrides:
- initialize in class CIAgent
getTaskDescription
public java.lang.String getTaskDescription()
- Retrieves a description of what this agent is doing.
- Returns:
- the String object that contains the description
- Overrides:
- getTaskDescription in class CIAgent
process
public void process()
- Does nothing.
- Overrides:
- process in class CIAgent
processTimerPop
public void processTimerPop()
- Kicks off netotiations if there are items on the wish list and no
negotiation is already in progress.
- Overrides:
- processTimerPop in class CIAgent
processCIAgentEvent
public void processCIAgentEvent(CIAgentEvent e)
- Processes a CIAgentEvent.
- Parameters:
e
- the CIAgentEvent object that contains the message to be processed- Overrides:
- processCIAgentEvent in class CIAgent
processMessage
public void processMessage(BuySellMessage msg)
- Processes a BuySellMessage received in a CIAgentEvent.
- Parameters:
msg
- the BuySellMessage object to be processed
negotiate
void negotiate(Offer offer,
BuySellMessage msg)
- Accepts the offer if it is less than the strike price or offers a
counter offer.
- Parameters:
offer
- the Offer object that contains the current offermsg
- the BuySellMessage object