Class GameWorldModel
java.lang.Object
eu.iv4xr.framework.extensions.ltl.gameworldmodel.GameWorldModel
- All Implemented Interfaces:
ITargetModel
An EFSM-like model of a game-world.
- Author:
- Samira, Wish.
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
-
Field Summary
Modifier and TypeFieldDescriptionThe history of the the states, stored in reverse order (the head of the list is the current state, the last state in the list is the oldest).static String
boolean
-
Constructor Summary
ConstructorDescriptionGameWorldModel(GWState initialState)
Create an instance of GameWorldModel with the specified state as the initial state. -
Method Summary
Modifier and TypeMethodDescriptionAdd the given zones to this GameWorldModel.boolean
boolean
canInteract(String targetId)
boolean
canTravelTo(String destinationId)
void
execute(ITransition tr)
void
boolean
inTheSameZone(String obj1, String obj2)
Check whether two objects are in the same zone.boolean
boolean
isBlocking(String id)
static GameWorldModel
loadGameWorldModelFromFile(String filename)
Read saved model (in JSON) from a file, and return the corresponding GameWorldModel object.markAsBlockers(String... objectIds)
Mark the specified objects (identified by their ids) as blockers.registerObjectLinks(String switcherId, String... newAffectedIds)
When we register (i,o1,o2,..) we are saying that interacting with the object i will affect o1, o2, ...void
reset()
Reset this model to its initial-state.void
Reset this model; use the given state as the new initial-state.void
Save this model as a JSON-object to a file.toString()
void
Get the zone where a object is located.
-
Field Details
-
initialState
-
history
The history of the the states, stored in reverse order (the head of the list is the current state, the last state in the list is the oldest). Each k-th entry in the history is a pair (st,tr) where st is a state, and tr is the transition that was taken to get to that state from its previous state (so, that is the k+1 st state). The exception is the last state in the history, which is the model initial state, and has no tr. -
zones
-
objectlinks
-
blockers
-
IS_OPEN_NAME
-
alpha
-
StressingMode
public boolean StressingMode
-
-
Constructor Details
-
GameWorldModel
GameWorldModel() -
GameWorldModel
Create an instance of GameWorldModel with the specified state as the initial state.
-
-
Method Details
-
addZones
Add the given zones to this GameWorldModel. It returns this model. -
markAsBlockers
Mark the specified objects (identified by their ids) as blockers. The method returns this model. -
getZone
-
registerObjectLinks
When we register (i,o1,o2,..) we are saying that interacting with the object i will affect o1, o2, ... These connections will be added to [objectlinks
.The method returns this model.
-
isBlocker
-
isBlocking
-
zonesOf
Get the zone where a object is located. Note that a non-blocker will be in exactly one zone. A blocker is in either one or two zones. -
inTheSameZone
Check whether two objects are in the same zone. -
canTravelTo
-
travelTo
-
canInteract
-
interact
-
reset
public void reset()Reset this model to its initial-state.- Specified by:
reset
in interfaceITargetModel
-
reset
Reset this model; use the given state as the new initial-state. -
getCurrentState
- Specified by:
getCurrentState
in interfaceITargetModel
-
backTrackToPreviousState
public boolean backTrackToPreviousState()- Specified by:
backTrackToPreviousState
in interfaceITargetModel
-
availableTransitions
- Specified by:
availableTransitions
in interfaceITargetModel
-
execute
- Specified by:
execute
in interfaceITargetModel
-
toString
-
save
Save this model as a JSON-object to a file. The alpha-component is not saved though, as it is a function.- Throws:
com.google.gson.JsonIOException
IOException
-
loadGameWorldModelFromFile
Read saved model (in JSON) from a file, and return the corresponding GameWorldModel object. The alpha-component is left null, as it cannot be saved, being a function.- Throws:
IOException
-