public class CNPInitiatorPlan extends AbstractInitiatorPlan
Plan.PlanWaitAbstraction
Modifier and Type | Field and Description |
---|---|
protected IMessageEvent |
me
Last sent message with convid for receiving answer messages.
|
Constructor and Description |
---|
CNPInitiatorPlan() |
Modifier and Type | Method and Description |
---|---|
void |
aborted()
Called when the plan is aborted, i.e.,
when the corresponding interaction goal
is dropped.
|
protected NegotiationRecord |
acceptAllProposals(NegotiationRecord nr,
ParticipantProposal[] acceptables,
java.util.Map proposalmessages)
Accept all proposals in parallel.
|
protected NegotiationRecord |
acceptOneProposal(NegotiationRecord nr,
ParticipantProposal[] acceptables,
java.util.Map proposalmessages)
Sequentially accept proposals until the first successful execution.
|
void |
body()
The body method is called on the
instatiated plan instance from the scheduler.
|
protected void |
collectProposals(NegotiationRecord nr,
java.util.Map proposalmessages)
Collect proposal messages.
|
protected void |
determineFailure(NegotiationRecord nr,
ParticipantProposal[] acceptables)
Determine success or failure of the interaction.
|
protected ParticipantProposal[] |
evaluateProposals(NegotiationRecord nr,
java.util.Map proposalmessages)
Determine acceptable proposals.
|
void |
failed()
The failed method is called on plan failure/abort.
|
protected IMessageEvent |
getInitialMessage()
Get the initial message.
|
protected java.lang.String |
getShortProtocolName()
Get protocol abbrev name.
|
protected boolean |
isIterated()
Test if it is the iterated contract-net version.
|
void |
passed()
The passed method is called on plan success.
|
protected NegotiationRecord |
queryNextroundInfo(NegotiationRecord nr)
Decide if a new iteration should be performed.
|
protected void |
rejectExcludedProposals(NegotiationRecord nr,
IComponentIdentifier[] newparticipants,
java.util.Map proposalmessages)
Reject all proposals, which are not part of the next round.
|
protected void |
sendCFP(NegotiationRecord nr,
java.lang.String convid)
Send the cfp message.
|
getTimeout
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
protected IMessageEvent me
public void body()
body
in class AbstractInitiatorPlan
public void passed()
Plan
public void failed()
Plan
public void aborted()
AbstractInitiatorPlan
aborted
in class AbstractInitiatorPlan
protected boolean isIterated()
protected java.lang.String getShortProtocolName()
protected void sendCFP(NegotiationRecord nr, java.lang.String convid)
nr
- The current negotation record.convid
- The conversation id.protected void collectProposals(NegotiationRecord nr, java.util.Map proposalmessages)
nr
- The negotiation record.proposalmessages
- Map for storing the message of each current proposal (part. proposal -> message event).protected ParticipantProposal[] evaluateProposals(NegotiationRecord nr, java.util.Map proposalmessages)
nr
- The negotiation record.proposalmessages
- The received proposal messages (required to detect null proposals).protected NegotiationRecord queryNextroundInfo(NegotiationRecord nr)
nr
- The negotiation record of the current round.protected void rejectExcludedProposals(NegotiationRecord nr, IComponentIdentifier[] newparticipants, java.util.Map proposalmessages)
nr
- The current negotiation record.newparticipants
- The remaining participants of the next round, which should not be rejected.protected NegotiationRecord acceptAllProposals(NegotiationRecord nr, ParticipantProposal[] acceptables, java.util.Map proposalmessages)
nr
- The current negotiation record.acceptables
- The acceptable proposals.proposalmessages
- The map containing proposal messages to reply to.protected NegotiationRecord acceptOneProposal(NegotiationRecord nr, ParticipantProposal[] acceptables, java.util.Map proposalmessages)
nr
- The current negotiation record.acceptables
- The acceptable proposals.proposalmessages
- The map containing proposal messages to reply to.protected void determineFailure(NegotiationRecord nr, ParticipantProposal[] acceptables)
nr
- The final negotiation record containing executed proposals.acceptables
- The acceptable proposals.protected IMessageEvent getInitialMessage()
getInitialMessage
in class AbstractInitiatorPlan