public class VGDLFactory
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.HashMap<java.lang.String,java.lang.Class> |
registeredEffects
Cache for registered effects.
|
static java.util.HashMap<java.lang.String,java.lang.Class> |
registeredGames
Cache for registered games.
|
static java.util.HashMap<java.lang.String,java.lang.Class> |
registeredSprites
Cache for registered sprites.
|
static java.util.HashMap<java.lang.String,java.lang.Class> |
registeredTerminations
Cache for registered effects.
|
Modifier and Type | Method and Description |
---|---|
Effect |
createEffect(InteractionContent content)
Creates a new effect, with parameters passed as InteractionContent.
|
Game |
createGame(GameContent content)
Creates a game, receiving a GameContent object
|
VGDLSprite |
createSprite(SpriteContent content,
Vector2d position,
java.awt.Dimension dim)
Creates a new sprite with a given dimension in a certain position.
|
Termination |
createTermination(TerminationContent content)
Creates a new termination, with parameters passed as TerminationContent.
|
static VGDLFactory |
GetInstance()
Returns the unique instance of this class.
|
void |
init()
Initializes the maps for caching classes.
|
void |
parseParameters(Content content,
java.lang.Object obj)
Parses the parameters from content, assigns them to variables in obj.
|
int |
requestFieldValueInt(java.lang.Object obj,
java.lang.String fieldName)
Returns the value of an int field in the object specified
|
public static java.util.HashMap<java.lang.String,java.lang.Class> registeredGames
public static java.util.HashMap<java.lang.String,java.lang.Class> registeredSprites
public static java.util.HashMap<java.lang.String,java.lang.Class> registeredEffects
public static java.util.HashMap<java.lang.String,java.lang.Class> registeredTerminations
public void init()
public static VGDLFactory GetInstance()
public Game createGame(GameContent content)
content
- potential parameters for the class.public VGDLSprite createSprite(SpriteContent content, Vector2d position, java.awt.Dimension dim)
content
- parameters for the sprite, including its class.position
- position of the object.dim
- dimensions of the sprite on the world.public Effect createEffect(InteractionContent content)
content
- parameters for the effect, including its class.public Termination createTermination(TerminationContent content)
content
- parameters for the termination condition, including its class.public void parseParameters(Content content, java.lang.Object obj)
content
- contains the parameters to read.obj
- object with the variables to assign.public int requestFieldValueInt(java.lang.Object obj, java.lang.String fieldName)
obj
- object that holds the field.fieldName
- name of the field to retrieve.