search

Interface myphysicslab.lab.util.MemoList

Provided By
All Extended Interfaces
All Known Subinterfaces
All Known Implementations

A Memorizable object that keeps a list of other Memorizable objects and tells them to memorize which memorizes simulation data or performs some other function that needs to happen regularly. The memorize method is meant to be called after each simulation time step, as is done in myphysicslab.lab.model.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 myphysicslab.lab.app.SimRunner. You can add a Memorizable directly to SimRunner using #addMemo. Or you can add a Memorizable to one of the branches of the tree, such as a myphysicslab.lab.view.LabCanvas contained in the SimRunner, or a myphysicslab.lab.view.LabView contained in the LabCanvas.

In a typical simulation, a graph is periodically updated because myphysicslab.lab.app.SimRunner#callback causes the AdvanceStrategy to both advance the simulation and also call memorize on each LabCanvas. The memorize of the LabCanvas calls memorize on each LabView, which in turn calls memorize on any Memorizable objects contained in the LabView, such as a myphysicslab.lab.graph.GraphLine.

Instance Methods