Package jline.io

Class LineConsole

java.lang.Object
jline.io.LineConsole

public class LineConsole extends Object
Running progress log of a LINE solver run (the "solver console").

The console narrates what a solver is doing while it does it: reading the model, compiling the network structure, computing chains, visits and demands, resolving the method, iterating, and closing with the figures of merit. Each line carries the elapsed time since the run started:

 [   0.014s] compiling the network structure of model 'cqn'
 [   0.031s]   solving the routing DTMC for the visit ratios
 [   0.052s] recognized a closed queueing network: 3 stations, 1 class, 1 chain
 [   0.061s]   AMVA sweep 10: queue-length residual 1.11e-01, X = 1.2225
 

It prints no tables: the result table stays the caller's own getAvgTable. THE CONSOLE IS VerboseLevel.DEBUG: it narrates exactly when the run is at DEBUG and is silent at every lower level, and it never alters a numerical result. There is no separate console switch -- the console was one, until it became clear that a running progress log IS what a debug verbosity is for, and two switches for one channel only let a session ask for DEBUG and get nothing.

Typical use: GlobalConstants.setVerbose(VerboseLevel.DEBUG) for the session, or options.verbose = VerboseLevel.DEBUG for one run.

Nested runs (an inner solver driven by SolverLN, SolverENV or the UQ ensemble) do not narrate: only the outermost run writes, so several inner solves cannot interleave their lines. Use isActive() to suppress a legacy print, ownsLog() to emit.

Mirrors MATLAB matlab/src/io/LineConsole.m and python line_solver/api/io/console.py.

  • Method Details

    • reset

      public static void reset()
      Forget any open run (used after an interrupted solve).
    • wanted

      public static boolean wanted(SolverOptions options)
      Resolve whether a run with these options should narrate.

      THE CONSOLE IS DEBUG, and this is the whole rule: a run narrates when it is at VerboseLevel.DEBUG and at no lower level. The run's own options.verbose decides when it carries one, otherwise the session level does; there is no third switch that could put the two out of step.

    • isActive

      public static boolean isActive()
      Returns:
      true while a run is narrating; gates SUPPRESSION of legacy prints
    • deferPrint

      public static void deferPrint(String fmt, Object... args)
      Queue a legacy line for after the run closes.

      The console owns the log while a run narrates, so a solver's standard completion message is held here and written once the closing DONE line has gone out, reading as it would with the console off.

    • ownsLog

      public static boolean ownsLog()
      Returns:
      true only inside the OUTERMOST open run; gates EMISSION
    • writes

      public static boolean writes()
      Returns:
      true when a progress line should be printed: either the outermost run is narrating, or no run is open and the session is at DEBUG -- the second case is what lets model construction narrate before any solver exists.
    • beginRun

      public static boolean beginRun(Object solver, SolverOptions options)
      Open a console run.

      The caller MUST pair this with closeRun(java.lang.Object) in a finally block, so that a failed analysis still reports what it had reached.

      Parameters:
      solver - the solver about to run (read for its model and result)
      options - its options
      Returns:
      true when this call opened the outermost run
    • closeRun

      public static void closeRun(Object solver)
      Close the innermost open run, writing the closing lines.
      Parameters:
      solver - the solver whose result is reported, or null
    • step

      public static void step(String fmt, Object... args)
      Write one progress line.
    • substep

      public static void substep(String fmt, Object... args)
      Write one indented progress line.
    • compileDetail

      public static void compileDetail(String fmt, Object... args)
      One stage line of a structure compile.

      Silenced inside a pushQuiet() scope, and inside an open run, where the structures being compiled are those of auxiliary models (SolverLN layers) rather than of the model under study.

    • compiling

      public static void compiling(String name)
      Announce the compilation of a model structure.
    • detail

      public static void detail(String text)
      Report a solver's own debug message as a substep.

      InputOutput.line_debug routes here while a run narrates. Consecutive repeats are dropped, at most three messages of the same SHAPE (the text with its numbers masked) are reported, and the channel is capped per run, since a message inside a loop would bury the narration.

    • loop

      public static void loop(String fmt, Object... args)
      Announce an iteration loop and reset its reporting budget.

      Re-announcing the SAME text (a solver that restarts its loop) neither reprints the header nor refills the budget.

    • iter

      public static void iter(long k, String fmt, Object... args)
      Report iteration k of the current loop.

      Lines are decimated: the first 20 iterations report in full, then every 10th, and the loop stops reporting after 30 lines, so that a long run cannot bury the rest of the narration.

    • pushQuiet

      public static void pushQuiet()
      Suppress structure-compile detail until popQuiet().
    • popQuiet

      public static void popQuiet()
      End one pushQuiet() scope.
    • plural

      public static String plural(int n, String singular, String plural)
      Count with an agreeing noun, e.g. "1 chain" or "3 chains".