Class EAInitiatorPlan
- java.lang.Object
-
- jadex.bdiv3x.runtime.Plan
-
- jadex.bdi.planlib.protocols.AbstractInitiatorPlan
-
- jadex.bdi.planlib.protocols.englishauction.EAInitiatorPlan
-
public class EAInitiatorPlan extends AbstractInitiatorPlan
This plan implements the initiator of the "FIPA English Auction Interaction Protocol Specification" (XC00031 - Experimental). An English auction is one where bidders continously can increase the current offer until no one is willing to increase any more.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jadex.bdiv3x.runtime.Plan
Plan.PlanWaitAbstraction
-
-
Field Summary
Fields Modifier and Type Field Description protected IMessageEvent
start
The initial message.
-
Constructor Summary
Constructors Constructor Description EAInitiatorPlan()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
aborted()
Called when the plan is aborted, i.e., when the corresponding interaction goal is dropped.protected void
announceAuction(java.lang.Object auctiondesc, java.util.List receivers, java.lang.String convid)
Announce the planned auction.protected void
announceAuctionEnd(java.util.List receivers, java.lang.String convid, java.lang.Object winning_offer, IComponentIdentifier winner)
Announce the end of the auction to all participants that did not leave the auction.void
body()
The plan body.protected java.lang.Object[]
decideIteration(java.lang.Object cfp_info, java.lang.Object[] history)
Decide about the next iteration.protected void
evaluateAuctionResults(AuctionDescription auctiondesc, java.lang.Object cfp_info, java.lang.Object[] history, IComponentIdentifier winner, java.lang.Object winning_offer)
Evaluate the auction results and decide about participation.void
failed()
The failed method is called on plan failure/abort.protected IMessageEvent
getInitialMessage()
Get the initial message.void
passed()
The passed method is called on plan success.protected void
sendCFP(java.lang.Object cfp, java.lang.String convid, java.util.List receivers)
Send cfps to all receivers.protected void
waitForAuctionStart(AuctionDescription auctiondesc, java.util.List receivers)
Wait for the auction start time.protected IComponentIdentifier
waitForProposals(java.lang.Object cfp, long roundtimeout, java.util.List receivers)
Wait for proposals of participants.-
Methods inherited from class jadex.bdi.planlib.protocols.AbstractInitiatorPlan
getTimeout
-
Methods inherited from class jadex.bdiv3x.runtime.Plan
checkNotInAtomic, createExpression, createGoal, createInternalEvent, createMessageEvent, dispatchInternalEvent, dispatchSubgoal, dispatchSubgoalAndWait, dispatchSubgoalAndWait, dispatchTopLevelGoal, endAtomic, fail, fail, fail, getAgent, getBeliefbase, getClock, getComponentDescription, getComponentIdentifier, getComponentName, getDispatchedElement, getEventbase, getException, getExpression, getExpressionbase, getExternalAccess, getGoalbase, getLogger, getParameter, getParameters, getParameterSet, getParameterSets, getPlanbase, getPlanElement, getReason, getRPlan, getScope, getTime, getWaitqueue, hasParameter, hasParameterSet, killAgent, sendMessage, sendMessageAndWait, sendMessageAndWait, startAtomic, toString, waitFor, waitForCondition, waitForCondition, waitForCondition, waitForConditionInline, waitForConditionInline, waitForEver, waitForFactAdded, waitForFactAdded, waitForFactChanged, waitForFactChanged, waitForFactRemoved, waitForFactRemoved, waitForGoalFinished, waitForGoalFinished, waitForGoalFinished, waitForGoalFinished, waitForInternalEvent, waitForInternalEvent, waitForMessageEvent, waitForMessageEvent, waitForReply, waitForReply, waitForReply, waitForReply, waitForTick
-
-
-
-
Field Detail
-
start
protected IMessageEvent start
The initial message.
-
-
Method Detail
-
body
public void body()
The plan body.- Overrides:
body
in classAbstractInitiatorPlan
-
passed
public void passed()
Description copied from class:Plan
The passed method is called on plan success.
-
failed
public void failed()
Description copied from class:Plan
The failed method is called on plan failure/abort.
-
aborted
public void aborted()
Description copied from class:AbstractInitiatorPlan
Called when the plan is aborted, i.e., when the corresponding interaction goal is dropped. Terminates the interaction using the FIPA-Cancel-Meta-Protocol.- Overrides:
aborted
in classAbstractInitiatorPlan
-
announceAuction
protected void announceAuction(java.lang.Object auctiondesc, java.util.List receivers, java.lang.String convid)
Announce the planned auction.- Parameters:
auctiondesc
- the auction description.receivers
- The receivers.convid
- The conversation id.
-
waitForAuctionStart
protected void waitForAuctionStart(AuctionDescription auctiondesc, java.util.List receivers)
Wait for the auction start time.- Parameters:
auctiondesc
- The auction description.receivers
- The receivers.
-
sendCFP
protected void sendCFP(java.lang.Object cfp, java.lang.String convid, java.util.List receivers)
Send cfps to all receivers.- Parameters:
cfp
- The cfp.convid
- The conversation id.receivers
- The receivers.
-
decideIteration
protected java.lang.Object[] decideIteration(java.lang.Object cfp_info, java.lang.Object[] history)
Decide about the next iteration.- Parameters:
cfp_info
- The cfp info.history
- The history.- Returns:
- The new cfp and cfp_info as an object array.
-
waitForProposals
protected IComponentIdentifier waitForProposals(java.lang.Object cfp, long roundtimeout, java.util.List receivers)
Wait for proposals of participants.- Parameters:
cfp
- the cfp.roundtimeout
- The round timeout.receivers
- The receivers.- Returns:
- The message of the winner.
-
evaluateAuctionResults
protected void evaluateAuctionResults(AuctionDescription auctiondesc, java.lang.Object cfp_info, java.lang.Object[] history, IComponentIdentifier winner, java.lang.Object winning_offer)
Evaluate the auction results and decide about participation.- Parameters:
auctiondesc
- The auction description.cfp_info
- The cfp info.history
- The historz of cfps.winner
- the winner.winning_offer
- The winning offer.
-
announceAuctionEnd
protected void announceAuctionEnd(java.util.List receivers, java.lang.String convid, java.lang.Object winning_offer, IComponentIdentifier winner)
Announce the end of the auction to all participants that did not leave the auction.- Parameters:
receivers
- The receivers.convid
- The conversation id.winning_offer
- The winning offer.winner
- The winner.
-
getInitialMessage
protected IMessageEvent getInitialMessage()
Get the initial message.- Specified by:
getInitialMessage
in classAbstractInitiatorPlan
-
-