public class StateJSONParser extends java.lang.Object implements StateParser
State
into a datastructure that can be easily
parsed into an JSON representation and for taking a datastructure preapred for a JSON representation and converting it into an OO-MDP State
.Modifier and Type | Field and Description |
---|---|
protected Domain |
domain
The domain holding the object class definitions that states represented in JSON strings will be converted to.
|
Constructor and Description |
---|
StateJSONParser(Domain domain)
Initializes with a given domain object.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getJSONPrepared(State s)
Returns the data structure of a state that is passed to JSON.
|
State |
JSONPreparedToState(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> objects)
Takes a JSON prepared datastructure representation of a state and turns it into an actual state object.
|
java.lang.String |
stateToString(State s)
Converts state s into a parsable string representation.
|
State |
stringToState(java.lang.String str)
Converts a string into a State object assuming the string representation was produced using this state parser.
|
protected Domain domain
public StateJSONParser(Domain domain)
domain
- the domain object to which state objects will be associated.public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getJSONPrepared(State s)
s
- the input state to turn into a JSON prepared datastructurepublic java.lang.String stateToString(State s)
StateParser
stateToString
in interface StateParser
s
- the state to convertpublic State stringToState(java.lang.String str)
StateParser
stringToState
in interface StateParser
str
- a string representation of a statepublic State JSONPreparedToState(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> objects)
objects
- the list of OO-MDP object instancesState
object.