eventMap = []
app1Capabilities = []
app2Capabilities = []
+app1Subscribe = False
+app2Subscribe = False
def GetToken(f):
global readyToReturn
def ExtractFunctions(F, appName):
global eventMap
+ global app1Subscribe
+ global app2Subscribe
Temp = GetToken(F)
while (Temp != "EOF"):
if (Temp == "def" or Temp == "private"):
#Check subscribed events
if (Temp == "subscribe"):
+ if (appName == "App1"):
+ app1Subscribe = True
+ else:
+ app2Subscribe = True
while (Temp != "\"" and Temp != "app" and Temp != "location"):
Temp = GetToken(F)
if Temp == "\"":
extractedEvents.write("\t}\n")
#extractedEvents.write("\tcounter--\n")
extractedEvents.write("}\n")
+
+def CheckIfOnlyTouchEvents():
+ #Check and throw an error if it is all touch events
+ #This is called Direct-Direct interaction and we do not model-check for this case
+ onlyTouchEvents = True
+ for item in eventMap:
+ if item != "nfcTouch" and item != "app":
+ onlyTouchEvents = False
+ if onlyTouchEvents is True and app1Subscribe is True and app2Subscribe is True:
+ raise Exception("\n\nDirect-Direct Interaction detected: we are skipping this pair...\n\n")
#Extract objects to call functions from App1
F1 = open("Extractor/App1/App1.groovy", "r")
#Prepare eventSimulator file while parsing the App1 and App2 files
extractedEvents = open("eventSimulator/eventSimulator.groovy", "w+")
+CheckIfOnlyTouchEvents()
ExtractEvents(extractedEvents)
extractedEvents.close()