Fixing a bug in ExtractorScript.py: consuming too many tokens.
authorrtrimana <rtrimana@uci.edu>
Tue, 23 Jul 2019 18:18:47 +0000 (11:18 -0700)
committerrtrimana <rtrimana@uci.edu>
Tue, 23 Jul 2019 18:18:47 +0000 (11:18 -0700)
Extractor/ExtractorScript.py

index ec39bdb..4551ca0 100644 (file)
@@ -62,17 +62,20 @@ def ExtractFunctions(F, appName):
                        #If counter >= 5 that means it is not found, so it must be appTouch
                        if (counter >= 5):
                                Temp = "Touched"
-                       eventMap.append(Temp)
-                       Temp = GetToken(F)
-       
+                       if Temp not in eventMap:
+                               eventMap.append(Temp)
+
                #Check and analyze capabilities for physical interaction
                AnalyzeCapabilities(Temp, appName)
+
                Temp = GetToken(F)
        
        #Warn if there is a potential for physical interaction
        AnalyzePhysicalInteraction(app1Capabilities, app2Capabilities)
        AnalyzePhysicalInteraction(app2Capabilities, app1Capabilities)
 
+               
+
 def AnalyzeCapabilities(Temp, appName):
                        #Illuminance related
        if (Temp == "capability.switch" or
@@ -109,7 +112,7 @@ def AnalyzePhysicalInteraction(app1Capab, app2Capab):
        if ("capability.soundSensor" in app1Capab) and ("capability.musicPlayer" in app2Capab or 
                        "capability.alarm" in app2Capab or "capability.speechSynthesis" in app2Capab):
                print ("\nWARNING: Potential PHYSICAL CONFLICT (sound) detected between App1 and App2!\n")
-                       
+
 def ExtractEvents(extractedEvents):
        global eventMap
        extractedEvents.write("Random random = new Random(42)\n")