search

Class myphysicslab.lab.model.SimList

Provided By
Extends
All Implemented Interfaces

The list of SimObjects that represent the current state of a Simulation. For an ODESim the current state is dictated by its VarsList and the SimObjects reflect that state in their positions. The SimObjects give additional information that is not in the VarsList, such as size, shape, and mass of objects, as well as forces like springs. The order of objects in a SimList has no significance, it should be regarded as an unordered set.

The purpose of SimObjects and the SimList is two-fold:

  1. to give the outside world a view of what is going on in the Simulation.

  2. SimObjects are often used by the Simulation's internal calculations.

See myphysicslab.lab.view.DisplayObject for a discussion of how SimObjects are made visible to the user. See myphysicslab.lab.app.SimController for information about how SimObjects participate in user interface interactions like dragging an object.

Events Broadcast

A SimList is a Subject, so you can add one or more Observers to it. When SimObjects are added or removed, the SimList broadcasts a GenericEvent with the name #OBJECT_ADDED or #OBJECT_REMOVED to inform the Observers. The value of the GenericEvent is the SimObject that was added or removed.

Similar Objects Are Not Added

We avoid adding a SimObject when it has finite expiration time and is similar to an existing SimObject as found using #getSimilar. There is a tolerance setting that determines when SimObjects are similar, see #getTolerance.

This is to prevent thousands of similar SimObjects being created which would only slow performance without adding any significant information to the visual display. An example of this is when we show forces in ContactSim.

new SimList()

Parameters

None.

Instance Methods

Static Properties