public class TournamentGenerator
extends java.lang.Object
Agents in a tournament must be of class NegotiationParty
.
Constructor and Description |
---|
TournamentGenerator(MultilateralTournamentConfiguration configuration,
TournamentIndicesGenerator indicesGenerator)
Creates a new instance of the
TournamentGenerator class. |
Modifier and Type | Method and Description |
---|---|
static MultilateralProtocol |
createFrom(MultiPartyProtocolRepItem protocolRepItem)
Create a new instance of the Protocol object from a
MultiPartyProtocolRepItem |
static NegotiationPartyInternal |
createFrom(PartyRepItem partyRepItem,
Domain domain,
UTILITYSPACETYPE type,
Session session)
Creates a new Party from repository items
|
protected static UTILITYSPACETYPE |
extractUtilitySpaceType(ProfileRepItem profile) |
static java.util.List<java.lang.Integer> |
generateIntegerList(int upToExclusive)
Generates a list of integer values.
|
protected static NegotiationPartyInternal |
generateMediator(PartyRepItem mediatorRepItem,
ProfileRepItem mediatorProfileRepItem,
ProfileRepItem alternativeProfileRepItem,
Session session)
Generates a mediator Party from the given information
|
static java.util.List<NegotiationPartyInternal> |
generateSessionParties(java.util.List<java.lang.Integer> partyIndices,
java.util.List<PartyRepItem> partyRepItems,
java.util.List<ProfileRepItem> profileRepItems,
java.util.List<AgentID> partyIds,
int mediatorIndex,
PartyRepItem mediatorRepItem,
ProfileRepItem mediatorProfileRepItem,
Session session)
Generate the list of parties in the given session
|
static java.util.List<NegotiationPartyInternal> |
generateSessionParties(java.util.List<PartyRepItem> partyRepItems,
java.util.List<ProfileRepItem> profileRepItems,
java.util.List<AgentID> partyIds,
int mediatorIndex,
PartyRepItem mediatorRepItem,
ProfileRepItem mediatorProfileRepItem,
Session session)
Generate the list of parties in the given session
|
int |
getMediatorIndex() |
boolean |
hasNext() |
java.util.List<NegotiationPartyInternal> |
next()
returns next list of negotiating parties for the next session.
|
int |
numSessionsPerTournament() |
public TournamentGenerator(MultilateralTournamentConfiguration configuration, TournamentIndicesGenerator indicesGenerator)
TournamentGenerator
class.configuration
- The configuration used for the tournamentsindicesGenerator
- The indices generator used to generate lists of partiespublic static MultilateralProtocol createFrom(MultiPartyProtocolRepItem protocolRepItem) throws java.lang.Exception
MultiPartyProtocolRepItem
protocolRepItem
- Item to create Protocol out ofjava.lang.Exception
- If
Repository.copyFrom(negotiator.repository.Repository)
throws an exception.public static NegotiationPartyInternal createFrom(PartyRepItem partyRepItem, Domain domain, UTILITYSPACETYPE type, Session session) throws java.lang.Exception
partyRepItem
- Party Repository item to createFrom party fromdomain
- Profile Repository item to createFrom party fromjava.lang.NoSuchMethodException
- If requested Party does not have a constructor accepting only
preference profilesjava.lang.ClassNotFoundException
- If requested Party class can not be found.java.lang.Exception
- If
Repository.copyFrom(negotiator.repository.Repository)
throws an exception.public static java.util.List<NegotiationPartyInternal> generateSessionParties(java.util.List<PartyRepItem> partyRepItems, java.util.List<ProfileRepItem> profileRepItems, java.util.List<AgentID> partyIds, int mediatorIndex, PartyRepItem mediatorRepItem, ProfileRepItem mediatorProfileRepItem, Session session) throws RepositoryException, NegotiatorException
partyRepItems
- The repository items for partiesprofileRepItems
- The repository items for profilesmediatorIndex
- The index of the mediator in the returned list (usually this
is 0)mediatorRepItem
- The mediator repository item (or null)mediatorProfileRepItem
- The mediator repository profile (or null)session
- The session used fot this sessionNegotiatorException
- if agent can not be createdRepositoryException
- if repository describing agent can not be loadedpublic static java.util.List<NegotiationPartyInternal> generateSessionParties(java.util.List<java.lang.Integer> partyIndices, java.util.List<PartyRepItem> partyRepItems, java.util.List<ProfileRepItem> profileRepItems, java.util.List<AgentID> partyIds, int mediatorIndex, PartyRepItem mediatorRepItem, ProfileRepItem mediatorProfileRepItem, Session session) throws RepositoryException, NegotiatorException
partyIndices
- The indices used for generating the sessionpartyRepItems
- The repository items for partyprofileRepItems
- The repository items for profiles. One party will be created
for each item in the list.partyIds
- the preferred party IDs for the parties, in the correct order.
If null, default IDs are generated (recommended). If a list,
the number of elements in this list must match the size of
list. profileRepItems.mediatorIndex
- The index of the mediator in the returned list (usually this
is 0)mediatorRepItem
- The mediator repository item (or null)mediatorProfileRepItem
- The mediator repository profile (or null)session
- The session used fot this sessionRepositoryException
- if repository describing agent can not be loadedNegotiatorException
- if agent can not be createdpublic static java.util.List<java.lang.Integer> generateIntegerList(int upToExclusive)
upToExclusive
- The number to generate the list fromprotected static NegotiationPartyInternal generateMediator(PartyRepItem mediatorRepItem, ProfileRepItem mediatorProfileRepItem, ProfileRepItem alternativeProfileRepItem, Session session)
mediatorRepItem
- The mediator repository itemmediatorProfileRepItem
- The mediator repository profile (or null)alternativeProfileRepItem
- If no profile item is given, this is used to get the domainsession
- The session used fot this sessionprotected static UTILITYSPACETYPE extractUtilitySpaceType(ProfileRepItem profile)
public int getMediatorIndex()
public java.util.List<NegotiationPartyInternal> next() throws RepositoryException, NegotiatorException
NegotiatorException
- if agent can not be createdRepositoryException
- if repository describing agent can not be loadedpublic boolean hasNext()
public int numSessionsPerTournament()