Package jline.io

Class LQNX2SRVN

java.lang.Object
jline.io.LQNX2SRVN

public final class LQNX2SRVN extends Object
SRVN output: translates an LQN XML document into SRVN text (the LQNS .in grammar).

The writer is the inverse of SRVN2LQNX: an LQN XML document goes to SRVN text, so LayeredNetwork.writeSRVN is writeXML followed by translate(java.lang.String), and the mapping of a model onto the LQN schema stays in one place. The output is deterministic and byte-identical across the four codebases (the srvn/expected_srvn golden; Python line_solver.io.srvn_io.lqnx2srvn is the reference). What SRVN cannot say is refused by name (LINE:unsupported:Format) rather than dropped: an LQX program, SPEX parameters, a semaphore's initial state, the LINE dialect elements (cache, setup, call groups), and names that are not LQNS identifiers. Requests for output (results, histograms, mva-info) are skipped, as the reader skips them. Entry phases carry no activity names in SRVN, so a phase activity reads back as <entry>_<phase>.

  • Method Details

    • translate

      public static String translate(String xml)
      Translates an LQN XML document into SRVN text, naming the model after <lqn-model name>.
      Parameters:
      xml - the LQN XML document
      Returns:
      the SRVN text, newline-terminated
      Throws:
      LineInputException - (LINE:input:Format) when the XML is malformed
      LineUnsupportedException - (LINE:unsupported:Format) for content SRVN cannot express
    • translate

      public static String translate(String xml, String name)
      Translates an LQN XML document into SRVN text.
      Parameters:
      xml - the LQN XML document
      name - the model name for the header comment; null for <lqn-model name>
      Returns:
      the SRVN text, newline-terminated
      Throws:
      LineInputException - (LINE:input:Format) when the XML is malformed
      LineUnsupportedException - (LINE:unsupported:Format) for content SRVN cannot express