public interface Protocol
SessionManager
. There also exists an
ProtocolAdapter
which implements all the methods
in this interface with default values. *
For some examples on Alternating offer protocols, please refer to:
AlternatingOfferConsensusProtocol
AlternatingOfferCounterOfferProtocol
AlternatingOfferMajorityVotingProtocol
For an example on Mediator protocols, please refer to:
MediatorProtocol
Modifier and Type | Method and Description |
---|---|
void |
afterSession(Session session,
java.util.List<NegotiationParty> parties)
This will get called just after ending the session.
|
void |
applyAction(Action action,
Session session)
Apply the action according to the protocol.
|
void |
beforeSession(Session session,
java.util.List<NegotiationParty> parties)
This will get called just before the session starts.
|
java.util.Map<NegotiationParty,java.util.List<NegotiationParty>> |
getActionListeners(java.util.List<NegotiationParty> parties)
Get a map of parties that are listening to each other's response
|
Bid |
getCurrentAgreement(Session session,
java.util.List<NegotiationParty> parties)
This method should return the current agreement.
|
int |
getNumberOfAgreeingParties(Session session,
java.util.List<NegotiationParty> parties)
Gets the number of parties that currently agree to the offer.
|
Round |
getRoundStructure(java.util.List<NegotiationParty> parties,
Session session)
Get the structure of the current round.
|
boolean |
isFinished(Session session,
java.util.List<NegotiationParty> parties)
Check if the protocol is done or still busy.
|
Round getRoundStructure(java.util.List<NegotiationParty> parties, Session session)
NegotiationParty
and the complete Session
which can be
used to diversify the round
structure at some point during the session.parties
- The parties currently participatingsession
- The complete session historyvoid beforeSession(Session session, java.util.List<NegotiationParty> parties)
session
- The session instance that will be used for the sessionparties
- The parties that will participate in the sessionvoid afterSession(Session session, java.util.List<NegotiationParty> parties)
session
- The session instance that was used for the sessionparties
- The parties that participated in the sessionvoid applyAction(Action action, Session session)
action
- action to applysession
- the current state of this sessionboolean isFinished(Session session, java.util.List<NegotiationParty> parties)
SessionManager
will not start a new Round
after the
current one. It will however finish all the turns described in the
getRoundStructure(java.util.List, negotiator.session.Session)
method.session
- the current state of this sessionjava.util.Map<NegotiationParty,java.util.List<NegotiationParty>> getActionListeners(java.util.List<NegotiationParty> parties)
parties
- The parties involved in the current negotiationNegotiationParty
that is responding to a
NegotiationParty.chooseAction(List)
event, and the value is a list of
NegotiationParty
s that are listening to that key party's response.Bid getCurrentAgreement(Session session, java.util.List<NegotiationParty> parties)
session
- The complete session history up to this pointparties
- The parties involved in the current negotiationint getNumberOfAgreeingParties(Session session, java.util.List<NegotiationParty> parties)
session
- the current state of this sessionparties
- The parties currently participating