*** empty log message ***
[IRC.git] / Robust / src / Analysis / TaskStateAnalysis / TaskAnalysisAlgorithm
1 Task Analysis:
2
3 Algorithm:
4
5 1.      Obtain the flags for each class in the program(Incase, a class has a super class, the super's flags, if any, are included
6     in the list of flags for the class)
7 2.      Create a new flagstate for the StartupObject class with the initialstate flag set to true.  Append this flagstate to the 
8     queue, QMAIN.  
9 3.      For each class that has only externs,  add all the possible runtime transitions(flagstates) to QMAIN.
10 4.      Pop the head of QMAIN and use this flagstate FS to evaluate which task triggers on this.
11 5.      Add all runtime transitions from FS to QMAIN and ADJLIST(as edges from FS) ensuring that the new states don't exist in QMAIN.
12 6.      Iterate through the list of tasks using FS.
13 7.      If a task is triggered, 
14         a.  If FS satisfies more than one parameter of the task,  throw an error stating that this is an illegal operation.
15         b.  If 7a is not true, then add FS to the ADJLIST for that particular class.  Before adding, ensure that the flagstate 
16     doesn't already exist in the ADJLIST.  Keep track of the temp (as TEMP) whose flags form the triggering flagstate.
17 8.      Search through the FFANS in this task:
18         a.      For NewObject node,  
19                 i.      If the new object is of a class which has only externs, create a new flagstate with all flags set to false and 
20                     push into QMAIN ensuring that it doesn't already exist in QMAIN and ADJLIST. 
21                 ii.     If the new object is of a class which has both types of flags, create the new flagstate and append to QMAIN and 
22                         ADJLIST ensuring that the state doesn't already exist.
23                 iii.If new object is of a class which has no externs, then create the new flagstate and append to QMAIN and ADJLIST
24                          ensuring that the state doesn't already exist.
25         b.      For the task exit node, apply the flag changes to the tempflag pairs corresponding to TEMP and create the new flagstate.  
26             Add this state alongwith the task as an Edge to FS in the ADJLIST.
27                 i.      If the class has no external flags, append the new flagstate to QMAIN ensuring that it doesn't already exist.
28                 ii.     If the class has both types of flags, create the possible runtime states from the base state obtained in 6b;  
29                         Also add the Runtime edges to the base state in ADJLIST.  Append the states to QMAIN ensuring that they are not there 
30                         already.
31         c.      For the PRE node, throw an error stating that this type of node isn't supported anymore in Bristlecone.
32 9.      Repeat steps 4-8 until QMAIN is empty.