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
Nested ClassesModifier and TypeClassDescription(package private) static class -
Field Summary
FieldsModifier 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 Stringboolean -
Constructor Summary
ConstructorsConstructorDescriptionGameWorldModel(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.booleanbooleancanInteract(String targetId)booleancanTravelTo(String destinationId)voidexecute(ITransition tr)voidbooleaninTheSameZone(String obj1, String obj2)Check whether two objects are in the same zone.booleanbooleanisBlocking(String id)static GameWorldModelloadGameWorldModelFromFile(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, ...voidreset()Reset this model to its initial-state.voidReset this model; use the given state as the new initial-state.voidSave this model as a JSON-object to a file.toString()voidGet 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:
resetin interfaceITargetModel
-
reset
Reset this model; use the given state as the new initial-state. -
getCurrentState
- Specified by:
getCurrentStatein interfaceITargetModel
-
backTrackToPreviousState
public boolean backTrackToPreviousState()- Specified by:
backTrackToPreviousStatein interfaceITargetModel
-
availableTransitions
- Specified by:
availableTransitionsin interfaceITargetModel
-
execute
- Specified by:
executein 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.JsonIOExceptionIOException
-
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
-