Session

it.grypho.scala.leonardo.cli.Session
See theSession companion class
object Session

Companion object: constants and IO helpers shared across the REPL entry point.

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Session.type

Members list

Type members

Classlikes

final case class Samples(expr: String, variable: String, points: Vector[(Double, Double)])

A completed sampling: the points, and the text they came from.

A completed sampling: the points, and the text they came from.

The two strings are carried because a plot has to say what it is showing — they title the axes — and the alternative was for the caller to split the command a second time to recover them. A second parse of the same text is exactly the sort of duplicate this codebase removes on sight: the two could disagree, and then a figure would be labelled with something other than what it plots.

Value parameters

expr

the expression as the user typed it

points

the (x, y) pairs, with non-finite results already dropped

variable

the name sampled over

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Sweep(expr: String, variable: String, points: Vector[(Double, Double, Double)])

A completed frequency sweep: (omega, magnitude-in-dB, unwrapped-phase-in-degrees).

A completed frequency sweep: (omega, magnitude-in-dB, unwrapped-phase-in-degrees).

Distinct from Samples because a Bode diagram is two curves over one shared frequency axis, not one curve; flattening it to pairs would lose the pairing that makes the two panels line up.

Value parameters

expr

the plant as the user typed it

points

the swept response, ascending in omega

variable

the frequency variable

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def helpTopic(topic: String): String

Returns the help text for a specific topic, or the full help listing when not found.

Returns the help text for a specific topic, or the full help listing when not found.

Value parameters

topic

the command token to look up (e.g. "simplify", ":=")

Attributes

Returns

topic-specific text, or help when the topic is unknown

def loadFile(session: Session, path: String): String

Reads a saved session and replays it. Backs :load.

Reads a saved session and replays it. Backs :load.

The storage medium is platform-specific; this dispatch is not (issue F_0003 phase 2). SessionIO is a file path on the JVM and a localStorage key in the browser, so :load work means the same thing in both and only the medium differs. What made that cheap is that Session.load was already pure string-in: the file system was the only JVM-bound part of the command, and it was never inside Session.

Value parameters

path

the session name — a file path on the JVM, a storage key in a browser

session

the session to replay the script into

Attributes

Returns

the script's own output, or a message explaining why it could not be read

def saveFile(session: Session, path: String): String

Writes the session's replayable script. Backs :save; see loadFile on storage.

Writes the session's replayable script. Backs :save; see loadFile on storage.

Value parameters

path

the session name — a file path on the JVM, a storage key in a browser

session

the session to serialise

Attributes

Returns

a confirmation, or a message explaining why it could not be written

def step(session: Session, line: Option[String]): Option[String]

Interprets one line read by the REPL loop, resolving the commands execute cannot: the file-IO :load/:save and the quit/exit sentinels. A None line stands for end-of-input (Ctrl-D). Returns None to stop the loop, or Some(output) to continue — output is the (possibly empty) text to print. This keeps the loop's dispatch logic unit-testable; only the JLine plumbing in repl() is interactive-only.

Interprets one line read by the REPL loop, resolving the commands execute cannot: the file-IO :load/:save and the quit/exit sentinels. A None line stands for end-of-input (Ctrl-D). Returns None to stop the loop, or Some(output) to continue — output is the (possibly empty) text to print. This keeps the loop's dispatch logic unit-testable; only the JLine plumbing in repl() is interactive-only.

Value parameters

line

the input line, or None for end-of-input

session

the active Session that accumulates state

Attributes

Returns

None to terminate the loop; Some(output) to continue

Concrete fields

Points taken by samples / Session.samplePoints when the count is omitted.

Points taken by samples / Session.samplePoints when the count is omitted.

Named rather than inlined because it is now read by two renderings of one sampling — the printed table and the browser's plot — and a plot drawn at a different default density from the table beside it would be quietly confusing.

Attributes

val ReservedConstants: Set[String]

Names the parser always resolves as constants; assignment to them is rejected.

Names the parser always resolves as constants; assignment to them is rejected.

Attributes

val help: String

The full command-summary listing printed by help with no argument.

The full command-summary listing printed by help with no argument.

Attributes

val helpTopics: Map[String, String]

Per-command help text, keyed by the command token (:=, simplify, ...). Returned by help <topic>; bare help still shows the full help listing.

Per-command help text, keyed by the command token (:=, simplify, ...). Returned by help <topic>; bare help still shows the full help listing.

Attributes