marketplace
Class BestSellerAgent

java.lang.Object
  |
  +--ciagent.CIAgent
        |
        +--marketplace.SellerAgent
              |
              +--marketplace.BestSellerAgent

public class BestSellerAgent
extends SellerAgent
implements Effector

The BestSellerAgent class implements a buyer agent with the best negotiating skills in the marketplace application.

See Also:
Serialized Form

Field Summary
protected  RuleVariable firstOffer
           
protected  Offer offer
           
protected  RuleVariable offerDelta
           
protected  BooleanRuleBase rb
           
protected  RuleVariable spread
           
 
Fields inherited from class marketplace.SellerAgent
current, income, inventory, msg, negotiations
 
Fields inherited from class ciagent.CIAgent
agentPlatform, children, DEFAULT_ASYNCTIME, DEFAULT_SLEEPTIME, name, parent, traceLevel
 
Constructor Summary
BestSellerAgent()
          Creates a BestSellerAgent object.
BestSellerAgent(java.lang.String name)
          Creates a BestSellerAgent object with the given name.
 
Method Summary
 long effector(java.lang.Object obj, java.lang.String eName, java.lang.String args)
          Used by action rules in rule base to make or accept offers.
 void initBestSellerRuleBase()
          Initializes the BestSeler rule base.
 void initialize()
          Initializes the BestSeller rule base.
(package private)  void negotiate(Offer offer, BuySellMessage msg)
          Uses forward chaining and the rule base to determine whether to accept or reject an offer.
 
Methods inherited from class marketplace.SellerAgent
genId, getTaskDescription, itemInInventory, process, processCIAgentEvent, processMessage, processTimerPop, rejectOffer, removeItemFromInventory
 
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
 

Field Detail

rb

protected BooleanRuleBase rb

offerDelta

protected RuleVariable offerDelta

spread

protected RuleVariable spread

firstOffer

protected RuleVariable firstOffer

offer

protected Offer offer
Constructor Detail

BestSellerAgent

public BestSellerAgent()
Creates a BestSellerAgent object.

BestSellerAgent

public BestSellerAgent(java.lang.String name)
Creates a BestSellerAgent object with the given name.
Parameters:
name - the String object that contains the name
Method Detail

initialize

public void initialize()
Initializes the BestSeller rule base.
Overrides:
initialize in class SellerAgent

effector

public long effector(java.lang.Object obj,
                     java.lang.String eName,
                     java.lang.String args)
Used by action rules in rule base to make or accept offers.
Specified by:
effector in interface Effector
Parameters:
obj - the Object object implementing the effector
eName - the String object that contains the name of the effector
args - the String object that contains the arguments for the effector
Returns:
the long object

negotiate

void negotiate(Offer offer,
               BuySellMessage msg)
Uses forward chaining and the rule base to determine whether to accept or reject an offer.
Parameters:
offer - the Offer object that contains the current offer
msg - the BuySellMessage object
Overrides:
negotiate in class SellerAgent

initBestSellerRuleBase

public void initBestSellerRuleBase()
Initializes the BestSeler rule base.