Class SellerAgent
- java.lang.Object
-
- jadex.bdiv3.examples.booktrading.seller.SellerAgent
-
- All Implemented Interfaces:
IBuyBookService,INegotiationAgent
public class SellerAgent extends java.lang.Object implements IBuyBookService, INegotiationAgent
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classSellerAgent.ExecuteTaskclassSellerAgent.MakeProposalclassSellerAgent.SellBook
-
Field Summary
Fields Modifier and Type Field Description protected IInternalAccessagentprotected Future<Gui>guiprotected java.util.List<NegotiationReport>reports
-
Constructor Summary
Constructors Constructor Description SellerAgent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.lang.Void>acceptProposal(java.lang.String title, int price)Buy a bookvoidbody()The agent body.IFuture<java.lang.Integer>callForProposal(java.lang.String title)Ask the seller for a a quote on a book.voidcreateGoal(Order order)Create a purchase or sell oder.protected voidexecuteTask(SellerAgent.ExecuteTask goal)IInternalAccessgetAgent()Get the agent.java.util.Collection<INegotiationGoal>getGoals()Get all purchase or sell goals.java.util.List<Order>getOrders()Get all orders.java.util.List<Order>getOrders(java.lang.String title)java.util.List<NegotiationReport>getReports(Order order)Get all reports.protected longgetTime()Get the current time.protected voidmakeProposal(SellerAgent.MakeProposal goal)voidshutdown()Called when agent terminates.
-
-
-
Field Detail
-
agent
protected IInternalAccess agent
-
reports
protected java.util.List<NegotiationReport> reports
-
-
Method Detail
-
body
public void body()
The agent body.
-
shutdown
public void shutdown()
Called when agent terminates.
-
getOrders
public java.util.List<Order> getOrders()
Description copied from interface:INegotiationAgentGet all orders.- Specified by:
getOrdersin interfaceINegotiationAgent
-
getOrders
public java.util.List<Order> getOrders(java.lang.String title)
-
makeProposal
protected void makeProposal(SellerAgent.MakeProposal goal)
-
executeTask
protected void executeTask(SellerAgent.ExecuteTask goal)
-
getTime
protected long getTime()
Get the current time.
-
callForProposal
public IFuture<java.lang.Integer> callForProposal(java.lang.String title)
Ask the seller for a a quote on a book.- Specified by:
callForProposalin interfaceIBuyBookService- Parameters:
title- The book title.- Returns:
- The price.
-
acceptProposal
public IFuture<java.lang.Void> acceptProposal(java.lang.String title, int price)
Buy a book- Specified by:
acceptProposalin interfaceIBuyBookService- Parameters:
title- The book title.price- The price to pay.- Returns:
- A future indicating if the transaction was successful.
-
getAgent
public IInternalAccess getAgent()
Get the agent.- Specified by:
getAgentin interfaceINegotiationAgent- Returns:
- The agent.
-
createGoal
public void createGoal(Order order)
Create a purchase or sell oder.- Specified by:
createGoalin interfaceINegotiationAgent
-
getGoals
public java.util.Collection<INegotiationGoal> getGoals()
Get all purchase or sell goals.- Specified by:
getGoalsin interfaceINegotiationAgent
-
getReports
public java.util.List<NegotiationReport> getReports(Order order)
Get all reports.- Specified by:
getReportsin interfaceINegotiationAgent
-
-