From: rtrimana Date: Tue, 23 Jul 2019 18:18:47 +0000 (-0700) Subject: Fixing a bug in ExtractorScript.py: consuming too many tokens. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=83c29285fc443d05c449cab55f5dbef8fb942447;p=smartthings-infrastructure.git Fixing a bug in ExtractorScript.py: consuming too many tokens. --- diff --git a/Extractor/ExtractorScript.py b/Extractor/ExtractorScript.py index ec39bdb..4551ca0 100644 --- a/Extractor/ExtractorScript.py +++ b/Extractor/ExtractorScript.py @@ -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")