Class StateEncoder

Object
StateEncoder

public class StateEncoder extends Object
Encapsulates encoding and restoration of EvoLudo engine state, including version handling.
  • Field Details

    • engine

      private final EvoLudo engine
      Owning runtime whose state will be encoded.
  • Constructor Details

    • StateEncoder

      public StateEncoder(EvoLudo engine)
      Create a state encoder for the supplied engine.
      Parameters:
      engine - EvoLudo runtime
  • Method Details

    • getVersion

      public String getVersion()
      Return version string of current model. Version must include reference to git commit to ensure reproducibility of results.
      Returns:
      the version string
    • encodeState

      public String encodeState()
      Encode current state of EvoLudo model as XML string (plist format).
      Returns:
      encoded state
    • restoreState

      public boolean restoreState(Plist plist)
      Restore state of EvoLudo model from pre-processed plist, which encodes engine state (see encodeState()).

      Note: the appropriate model must already have been loaded and the command line arguments specified with the key CLO in the plist must also have been processed already.

      In JRE the options in plist are merged with any other command line arguments (albeit the ones in plist have priority to minimize the chance of complications). In GWT restoreState(Plist) is overridden to first deal with the command line arguments.

      Parameters:
      plist - the lookup table with key value pairs
      Returns:
      true on successfully restoring state