public abstract class InstanceHandler extends Object
| Constructor and Description |
|---|
InstanceHandler() |
| Modifier and Type | Method and Description |
|---|---|
static InstanceHandler |
getDefaultHandler()
Get the default instance handler.
|
abstract long |
getNextPopulationId(long worldId)
Returns a new population id
The id is unique amongst all previously generated population ids with the same worldId.
|
abstract long |
getNextWorldId()
Returns an new unused world id.
|
abstract Collection<Long> |
getPopulationIds(long worldId) |
abstract <T extends Bidder<?>> |
readBidder(Class<T> type,
World world,
long populationId,
long bidderId)
Used to deserialize a bidder, if its implementing class is known
|
abstract <T extends Bidder<?>> |
readBidderWithUnknownType(Class<T> bidderSuperType,
World world,
long populationId,
long bidderId)
Used to deserialize a bidder, if its type is not exactly known,
i.e., if there are different bidder implementations for this model.
|
abstract <T extends Bidder<?>> |
readPopulation(Class<T> type,
World world,
long populationId)
Used to deserialize a set of bidders, if the implementing class of all bidders is known and the same
|
abstract <T extends Bidder<?>> |
readPopulationWithUnknownTypes(Class<T> bidderSuperType,
World world,
long populationId)
Used to deserialize a set of bidders, if their type is not exactly known,
i.e., if there are different bidder implementations for this model.
|
abstract <T extends World> |
readWorld(Class<T> type,
long world)
Reads a world instance.
|
static void |
setDefaultHandler(InstanceHandler defaultHandler)
|
abstract void |
writeBidder(Bidder<?> bidder)
Writes a new bidder instance.
|
abstract void |
writeWorld(World world)
Writes a world instance.
|
public static InstanceHandler getDefaultHandler()
World, population and Bidder creation
for id selection and default storing.public static void setDefaultHandler(InstanceHandler defaultHandler)
World, population and Bidder creation
for id selection and default storing.defaultHandler - the new default instance handlerpublic abstract void writeWorld(World world)
world - the world to be writtenpublic abstract <T extends World> T readWorld(Class<T> type, long world)
public abstract void writeBidder(Bidder<?> bidder)
bidder - the bidder to be writtenpublic abstract Collection<Long> getPopulationIds(long worldId)
public abstract <T extends Bidder<?>> T readBidder(Class<T> type, World world, long populationId, long bidderId)
type - the class of which a new instance should be createdworld - the world the bidder lives inpopulationId - the id of the populationbidderId - the id of the bidderpublic abstract <T extends Bidder<?>> T readBidderWithUnknownType(Class<T> bidderSuperType, World world, long populationId, long bidderId)
bidderSuperType - the deserialized bidder is either of class bidderSuperType or of a subclass of bidderSuperTypeworld - the world the bidder lives inpopulationId - the id of the populationbidderId - the id of the bidderpublic abstract <T extends Bidder<?>> Collection<T> readPopulation(Class<T> type, World world, long populationId)
type - the class of which the new bidder instances should be createdworld - the world the bidders live inpopulationId - the id of the populationpublic abstract <T extends Bidder<?>> Collection<T> readPopulationWithUnknownTypes(Class<T> bidderSuperType, World world, long populationId)
bidderSuperType - the deserialized bidder is either of class bidderSuperType or of a subclass of bidderSuperTypeworld - the world the bidders live inpopulationId - the id of the populationpublic abstract long getNextWorldId()
public abstract long getNextPopulationId(long worldId)
worldId - The id of the world to which the new population will belongCopyright © 2017. All rights reserved.