source: tmcsimulator/trunk/webapps/einotebook/scripts/Incidents.js @ 468

Revision 468, 985 bytes checked in by jdalbey, 7 years ago (diff)

einotebook - multifile commit. Redesign to fix timing problem on some machines as well as improve file naming. Fixed #176.

  • Property svn:executable set to *
Line 
1/**
2 * Stores each Incident. You must set Incident.doc to the document that incidents will be
3 * displayed on before using this class.
4 */
5var incidents = new Array();
6
7//========== public members ==========/
8incidents.doc = null;
9
10//========== public methods ==========//
11incidents.get = incidents_get;
12incidents.add = incidents_add;
13
14//=========== method definitions ==========//
15/**
16 * Searches through each Incident to find an Incident with the given number.
17 * @param number {Integer} The number of an incident.
18 * @return The Incident with the given number.
19 */
20function incidents_get(number)
21{
22        var incident;
23       
24        // FOR each incident
25        for (var i = 0; i < this.length; i++)
26        {
27                // IF the incident's number matches
28                if (this[i].number == number)
29                {
30                        // remember the incident
31                        incident = this[i];
32                }
33        }
34        return incident;
35}
36
37/**
38 * Adds an Incident.
39 * @param incident {Incident} The Incident to be added.
40 */
41function incidents_add(incident)
42{
43        incidents.push(incident);
44}
Note: See TracBrowser for help on using the repository browser.