Private
elements_The SimObjectss that this SimList contains.
Static
Readonly
OBJECT_Name of event broadcast when a SimObject is added to the SimList.
Static
Readonly
OBJECT_Name of event broadcast when a SimObject has been modified, but not added or removed from the SimList.
Static
Readonly
OBJECT_Name of event broadcast when a SimObject is removed from the SimList.
Adds the SimObject to this SimList. Notifies Observers by broadcasting the OBJECT_ADDED event. For SimObjects with finite expiration time, we remove any existing similar SimObject in this SimList, as found using getSimilar with the default tolerance from getTolerance.
Rest
...objs: SimObject[]the SimObjects to add
Adds the set of SimObjects to this SimList. Notifies Observers by broadcasting the OBJECT_ADDED event for each SimObject added.
the SimObjects to add
Adds the given Observer to this Subject's list of Observers, so that the Observer
will be notified of changes in this Subject. An Observer may call Subject.addObserver
during its observe
method.
the Observer to add
Adds the Parameter to the list of this Subject's available Parameters.
the Parameter to add
if a Parameter with the same name already exists.
Notifies all Observers that this Subject has changed by calling observe on each Observer.
An Observer may call addObserver or removeObserver during its observe
method.
a SubjectEvent with information relating to the change
Notifies all Observers that the Parameter with the given name has changed by calling observe on each Observer.
the language-independent or English name of the Parameter that has changed
if there is no Parameter with the given name
Removes all SimObjects from this SimList. Notifies Observers by broadcasting the OBJECT_REMOVED event for each SimObject removed.
Returns true if the SimObject is in this SimList.
the SimObject to look for
true if the SimObject is in this SimList.
Returns the SimObject at the specified position in this SimList, or the first SimObject in this SimList with the given name.
index number or name of SimObject. Name should be English or language-independent version of name.
the SimObject at the specified position in this SimList, or with the given name
if SimObject not found or index out of range
Protected
getReturns whether broadcasting is enabled for this Subject. See setBroadcast.
whether broadcasting is enabled for this Subject
Returns the ConcreteLine with the given name, if found in this SimList.
name of ConcreteLine to find
the ConcreteLine with the given name
if ConcreteLine not found
Returns the MassObject with the given name, if found in this SimList.
name of MassObject to find
the MassObject with the given name
if MassObject not found
Returns the ParameterBoolean with the given name.
the language-independent or English name of the ParameterBoolean
the ParameterBoolean with the given name
if there is no ParameterBoolean with the given name
Returns the ParameterNumber with the given name.
the language-independent or English name of the ParameterNumber
the ParameterNumber with the given name
if there is no ParameterNumber with the given name
Returns the ParameterString with the given name.
the language-independent or English name of the ParameterString
the ParameterString with the given name
if there is no ParameterString with the given name
Returns a similar SimObject already in this SimList, or null
if there isn't one.
See SimObject.similar for how similarity is determined.
the SimObject to use for comparison
Optional
tolerance: numberthe tolerance used when testing for similarity; default is given by getTolerance
a similar looking SimObject on this SimList,
or null
if there isn't one
Returns the tolerance used for similarity testing when adding objects to this SimList. See SimObject.similar for how similarity is determined.
the tolerance used for similarity testing when adding SimObjects
Returns the index of the first occurrence of the specified SimObject in this list, or -1 if this list does not contain the SimObject.
the SimObject to look for
the index of the first occurrence of the specified SimObject in this list, or -1 if this list does not contain the SimObject
Removes the SimObject from this SimList. Notifies Observers by broadcasting the OBJECT_REMOVED event.
the SimObject to remove
Removes the set of SimObjects from this SimList. Notifies Observers by broadcasting the OBJECT_REMOVED event for each SimObject removed.
the SimObjects to remove
Removes the Observer from this Subject's list of Observers. An Observer may
call removeObserver
during its observe
method.
the Observer to detach from list of Observers
Removes the Parameter from the list of this Subject's available Parameters.
the Parameter to remove
Removes SimObjects from this SimList whose expiration time is less than the given time. Notifies Observers by broadcasting the OBJECT_REMOVED event for each SimObject removed. See SimObject.getExpireTime
the current simulation time
Protected
setSets whether this Subject will broadcast events, typically used to temporarily disable broadcasting. Intended to be used in situations where a subclass overrides a method that broadcasts an event. This allows the subclass to prevent the superclass broadcasting that event, so that the subclass can broadcast the event when the method is completed.
whether this Subject should broadcast events
the previous value
Sets the tolerance used for similarity testing when adding objects to this SimList. See SimObject.similar for how similarity is determined.
the tolerance used for similarity testing when adding SimObjects
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
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:
to give the outside world a view of what is going on in the Simulation.
SimObjects are often used by the Simulation's internal calculations.
See DisplayObject for a discussion of how SimObjects are made visible to the user.
See 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.