public abstract class MultilateralProtocolAdapter extends java.lang.Object implements MultilateralProtocol
Modifier and Type | Field and Description |
---|---|
protected boolean |
isAborted |
Constructor and Description |
---|
MultilateralProtocolAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
afterSession(Session session,
java.util.List<NegotiationPartyInternal> 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<NegotiationPartyInternal> parties)
This will get called just before the session starts.
|
void |
endNegotiation()
Overwrites the rest of the protocol and sets the protocol state to finish
|
void |
endNegotiation(java.lang.String reason)
Overwrites the rest of the protocol and sets the protocol state to finish
|
java.util.Collection<NegotiationPartyInternal> |
exclude(java.util.Collection<NegotiationPartyInternal> negotiationParties,
java.lang.Class negotiationPartyClass)
Filters the list by including only the type of negotiation parties.
|
java.util.Map<NegotiationPartyInternal,java.util.List<NegotiationPartyInternal>> |
getActionListeners(java.util.List<NegotiationPartyInternal> parties)
Get a map of parties that are listening to each other's response
|
Bid |
getCurrentAgreement(Session session,
java.util.List<NegotiationPartyInternal> parties)
This method should return the current agreement.
|
ExecutorWithTimeout |
getExecutor()
Gets the executor used to box actions that agents can influence.
|
int |
getNumberOfAgreeingParties(Session session,
java.util.List<NegotiationPartyInternal> parties)
Gets the number of parties that currently agree to the offer.
|
Round |
getRoundStructure(java.util.List<NegotiationPartyInternal> parties,
Session session)
Get the structure of the current round.
|
java.util.Collection<NegotiationPartyInternal> |
includeOnly(java.util.Collection<NegotiationPartyInternal> negotiationParties,
java.lang.Class negotiationPartyClass)
Filters the list by including only the type of negotiation parties.
|
boolean |
isFinished(Session session,
java.util.List<NegotiationPartyInternal> parties)
Check if the protocol is done or still busy.
|
void |
setExecutor(ExecutorWithTimeout executor)
Sets the executor used to box actions that agents can influence.
|
public Round getRoundStructure(java.util.List<NegotiationPartyInternal> 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 MultilateralProtocol
parties
- The parties currently participatingsession
- The complete session historypublic void beforeSession(Session session, java.util.List<NegotiationPartyInternal> parties) throws NegotiationPartyTimeoutException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
beforeSession
in interface MultilateralProtocol
session
- The session instance that will be used for the sessionparties
- The parties that will participate in the sessionNegotiationPartyTimeoutException
java.util.concurrent.ExecutionException
java.lang.InterruptedException
public void afterSession(Session session, java.util.List<NegotiationPartyInternal> parties)
afterSession
in interface MultilateralProtocol
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 MultilateralProtocol
action
- action to applysession
- the current state of this sessionpublic boolean isFinished(Session session, java.util.List<NegotiationPartyInternal> 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 MultilateralProtocol
session
- the current state of this sessionpublic java.util.Map<NegotiationPartyInternal,java.util.List<NegotiationPartyInternal>> getActionListeners(java.util.List<NegotiationPartyInternal> parties)
getActionListeners
in interface MultilateralProtocol
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<NegotiationPartyInternal> parties)
getCurrentAgreement
in interface MultilateralProtocol
session
- The complete session history up to this pointparties
- The parties involved in the current negotiationpublic int getNumberOfAgreeingParties(Session session, java.util.List<NegotiationPartyInternal> parties)
getNumberOfAgreeingParties
in interface MultilateralProtocol
session
- the current state of this sessionparties
- The parties currently participatingpublic java.util.Collection<NegotiationPartyInternal> includeOnly(java.util.Collection<NegotiationPartyInternal> negotiationParties, java.lang.Class negotiationPartyClass)
negotiationParties
- The original list of partiesnegotiationPartyClass
- The type of parties to includepublic java.util.Collection<NegotiationPartyInternal> exclude(java.util.Collection<NegotiationPartyInternal> negotiationParties, java.lang.Class negotiationPartyClass)
negotiationParties
- The original list of partiesnegotiationPartyClass
- The type of parties to includepublic void endNegotiation()
endNegotiation
in interface MultilateralProtocol
public void endNegotiation(java.lang.String reason)
endNegotiation
in interface MultilateralProtocol
reason
- Optionally give a reason why the protocol is finished.public ExecutorWithTimeout getExecutor()
getExecutor
in interface MultilateralProtocol
public void setExecutor(ExecutorWithTimeout executor)
setExecutor
in interface MultilateralProtocol
executor
-