evolution.lands
Class LandKnowledgeCatalog

evolution.KnowledgeCatalog
  |
  +--evolution.lands.LandKnowledgeCatalog

public class LandKnowledgeCatalog
extends KnowledgeCatalog

Stereotype singleton The LandKnowledgeCatalog

Field Summary
 protected static LandKnowledgeCataloginstance
          Instance of the singleton.

Constructor Summary
 protected LandKnowledgeCatalog(String fileName)
          Create a new KnowledgeCatalog from the given file.

Method Summary
 MapgenerateLandResources(String landName)
          Generate a hash of resource names and a reference to such a land resource, populated for the given landType.
 ListgetInitLandTypes()
          The landtypes which may appear on the initial map in this game.
 static LandKnowledgeCataloggetInst()
          Return the instance of this singleton.
 ListgetLandTypes()
          The landtypes in this game.
 StringgetRandomType()
          Return a random landtype.
 static voidinitialize(String fileName)
          Initialize this singleton from the given file.
 LandResourceinstantiateLandResource(String resName, Double value, String land)
          Instantiate a LandResource.
 booleanisEvolver(String landType)
          Is the given landtype an auto-transformer?
 protected voidparseInitLandTypes(String landTypesString)
          Parse a initial landtypes string.
 protected voidparseLandTypes(String landTypesString)
          Parse a landtypes string.
 protected ListparseLandTypesInto(String landTypesString, List retain)
          Parse a landtypes string.
 doubletransformationSpeed(String landType)
          With which speed will this landtype auto-transform to the given landtype.
 MaptransformsLandResources(String landType)
          Which land resource transforms into which land resource.
 StringtransformsTo(String landType)
          To which landtype will this landtype transform automatically? Returns the given landtype if it doesn't auto-transform.

Methods inherited from class evolution.KnowledgeCatalog
dlClassForName, extractArgument, extractName, extractValue, getFileName, getProperty, getProperty, getResourcePath, isInitialized, makeStringDoubleMap, setResourcePath, split, stripPathFromClassName, stripPathFromClassName, stripPathFromClassName

Field Detail

instance

protected static LandKnowledgeCatalog instance
Instance of the singleton.
Constructor Detail

LandKnowledgeCatalog

protected LandKnowledgeCatalog(String fileName)
throws java.io.FileNotFoundException,
java.io.IOException
Create a new KnowledgeCatalog from the given file.
Method Detail

generateLandResources

public Map generateLandResources(String landName)
Generate a hash of resource names and a reference to such a land resource, populated for the given landType. Returns a Map of (String, LandResource). precondition: the landName must be valid.

getInitLandTypes

public List getInitLandTypes()
The landtypes which may appear on the initial map in this game. Returns a List of Strings.

getInst

public static LandKnowledgeCatalog getInst()
Return the instance of this singleton.

getLandTypes

public List getLandTypes()
The landtypes in this game. Returns a List of Strings.

getRandomType

public String getRandomType()
Return a random landtype.

initialize

public static void initialize(String fileName)
throws java.io.FileNotFoundException,
java.io.IOException
Initialize this singleton from the given file.

instantiateLandResource

public LandResource instantiateLandResource(String resName, Double value, String land)
Instantiate a LandResource.
Parameters:
resName - The name of the landresource.
value - The value to initialize the landresource with, if this is null a random value will be used within the range specified in the prop file.
land - The landtype.

isEvolver

public boolean isEvolver(String landType)
Is the given landtype an auto-transformer?

parseInitLandTypes

protected void parseInitLandTypes(String landTypesString)
Parse a initial landtypes string.

parseLandTypes

protected void parseLandTypes(String landTypesString)
Parse a landtypes string.

parseLandTypesInto

protected List parseLandTypesInto(String landTypesString, List retain)
Parse a landtypes string.
Parameters:
retain - A List of landtype names. If this is not null, only the specified landtypes will be extracted.

transformationSpeed

public double transformationSpeed(String landType)
With which speed will this landtype auto-transform to the given landtype.

transformsLandResources

public Map transformsLandResources(String landType)
Which land resource transforms into which land resource. Returns a map with as key the name of the initial land resource and as value an array with as first element the name of the land resource it transforms into and as second element a Double transformationvalue. Returns a Map of (String, [String, Double]).

transformsTo

public String transformsTo(String landType)
To which landtype will this landtype transform automatically? Returns the given landtype if it doesn't auto-transform.

Association Links

to Class java.util.List

The loaded landtypes. These are extracted from the properties list at construction. A List of Strings.

to Class java.util.List

Landtypes which may be used to initialize the map. These are extracted from the properties list at construction. A List of Strings.

to Class evolution.lands.LandKnowledgeCatalog

Instance of the singleton.

a gvijf production