A Simple Discrete-Event Simulation: Part 35

Today I finished mods to the DisplayGroup object that allows it to be set up to hide itself a set amount of time after one or more displayed variables change.

We begin with the code that now includes the requisite timing mechanisms. The turnOn method makes the display visible when it is invoked following a change in a displayed value. The turnOff method sets the visibility back to false unless a more recent timer has been started. The setVisibility method allows the visibility to be initialized to false (the default is true).

Here is the code used to initialize a display object in timing mode. This setup makes use of the fact that the updateValue methods for the individual display items can detect whether the values they point to have changed. Note that we can choose which variables can drive visibility changes when they are modified.

Finally, here’s how the updates are called in the main event loop.

This entry was posted in Simulation and tagged , . Bookmark the permalink.

Leave a Reply