Adds an object to the list of Memorizable objects. These object's memorize
methods will be called from this object's memorize
method.
object to add to the list of Memorizable objects
if called during the memorize
method.
Returns the list of Memorizable objects stored in this MemoList.
the list of Memorizable objects
Removes an object from the list of Memorizable objects.
object to remove from the list of Memorizable objects
if called during the memorize
method.
Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.
For an object whose main purpose is to represent another Printable object, it is
recommended to include the result of calling toStringShort
on that other object.
For example, calling toStringShort()
on a DisplayShape might return something like
this:
DisplayShape{polygon:Polygon{'chain3'}}
a minimal string representation of this object.
Generated using TypeDoc
A Memorizable object that keeps a list of other Memorizable objects and frequently tells them to
memorize
simulation data. Thememorize
method is meant to be called after each simulation time step, as is done in AdvanceStrategy.advance.This is an example of Composite design pattern: it is a tree structure where every node on the tree defines the
memorize
method and calls that method on its sub-nodes.The base of the tree structure is usually SimRunner. You can add a Memorizable directly to SimRunner using MemoList.addMemo. Or you can add a Memorizable to one of the branches of the tree, such as a LabCanvas contained in the SimRunner, or a SimView contained in the LabCanvas.
In a typical simulation, a graph is periodically updated because SimRunner.callback causes the AdvanceStrategy to both advance the simulation and also call
memorize
on each LabCanvas. Thememorize
of the LabCanvas callsmemorize
on each SimView, which in turn callsmemorize
on any Memorizable objects contained in the SimView, such as a GraphLine.