public abstract class ProtocolAdapter extends java.lang.Object implements Protocol
Constructor and Description |
---|
ProtocolAdapter() |
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.Collection<NegotiationParty> |
exclude(java.util.Collection<NegotiationParty> negotiationParties,
java.lang.Class negotiationPartyClass)
Filters the list by including only the type of negotiation parties.
|
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.
|
java.util.Collection<NegotiationParty> |
includeOnly(java.util.Collection<NegotiationParty> negotiationParties,
java.lang.Class negotiationPartyClass)
Filters the list by including only the type of negotiation parties.
|
boolean |
isFinished(Session session,
java.util.List<NegotiationParty> parties)
Check if the protocol is done or still busy.
|
public 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.getRoundStructure
in interface Protocol
parties
- The parties currently participatingsession
- The complete session historypublic void beforeSession(Session session, java.util.List<NegotiationParty> parties)
beforeSession
in interface Protocol
session
- The session instance that will be used for the sessionparties
- The parties that will participate in the sessionpublic void afterSession(Session session, java.util.List<NegotiationParty> parties)
afterSession
in interface Protocol
session
- The session instance that was used for the sessionparties
- The parties that participated in the sessionpublic void applyAction(Action action, Session session)
applyAction
in interface Protocol
action
- action to applysession
- the current state of this sessionpublic boolean 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.isFinished
in interface Protocol
session
- the current state of this sessionpublic java.util.Map<NegotiationParty,java.util.List<NegotiationParty>> getActionListeners(java.util.List<NegotiationParty> parties)
getActionListeners
in interface Protocol
parties
- The parties involved in the current negotiationNegotiationParty
that is
responding to a NegotiationParty.chooseAction(java.util.List)
event, and the
value is a list of NegotiationParty
that are listening to that key party's
response.public Bid getCurrentAgreement(Session session, java.util.List<NegotiationParty> parties)
getCurrentAgreement
in interface Protocol
session
- The complete session history up to this pointparties
- The parties involved in the current negotiationpublic int getNumberOfAgreeingParties(Session session, java.util.List<NegotiationParty> parties)
getNumberOfAgreeingParties
in interface Protocol
session
- the current state of this sessionparties
- The parties currently participatingpublic java.util.Collection<NegotiationParty> includeOnly(java.util.Collection<NegotiationParty> negotiationParties, java.lang.Class negotiationPartyClass)
negotiationParties
- The original list of partiesnegotiationPartyClass
- The type of parties to includepublic java.util.Collection<NegotiationParty> exclude(java.util.Collection<NegotiationParty> negotiationParties, java.lang.Class negotiationPartyClass)
negotiationParties
- The original list of partiesnegotiationPartyClass
- The type of parties to include