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 class
SellerAgent.ExecuteTask
class
SellerAgent.MakeProposal
class
SellerAgent.SellBook
-
Field Summary
Fields Modifier and Type Field Description protected IInternalAccess
agent
protected Future<Gui>
gui
protected 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 bookvoid
body()
The agent body.IFuture<java.lang.Integer>
callForProposal(java.lang.String title)
Ask the seller for a a quote on a book.void
createGoal(Order order)
Create a purchase or sell oder.protected void
executeTask(SellerAgent.ExecuteTask goal)
IInternalAccess
getAgent()
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 long
getTime()
Get the current time.protected void
makeProposal(SellerAgent.MakeProposal goal)
void
shutdown()
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:INegotiationAgent
Get all orders.- Specified by:
getOrders
in 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:
callForProposal
in 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:
acceptProposal
in 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:
getAgent
in interfaceINegotiationAgent
- Returns:
- The agent.
-
createGoal
public void createGoal(Order order)
Create a purchase or sell oder.- Specified by:
createGoal
in interfaceINegotiationAgent
-
getGoals
public java.util.Collection<INegotiationGoal> getGoals()
Get all purchase or sell goals.- Specified by:
getGoals
in interfaceINegotiationAgent
-
getReports
public java.util.List<NegotiationReport> getReports(Order order)
Get all reports.- Specified by:
getReports
in interfaceINegotiationAgent
-
-