Commit 41d1f09c authored by Lars Schieffer's avatar Lars Schieffer
Browse files

unique renaming

parent 4935d687
......@@ -25,7 +25,6 @@ def instancesOf(model: dict, functions: dict) -> list:
for element in system["elements"]
]
automataByName = {automaton["name"]: automaton for automaton in model["automata"]}
ndLabels = []
instances = []
for index, automaton in enumerate(elements):
uniqueNumber = elements[:index].count(automaton)
......@@ -33,9 +32,8 @@ def instancesOf(model: dict, functions: dict) -> list:
edgesByLocation = edgesByLocationOf(
automataByName[automaton], functions, inputEnable[index]
)
edges, nonDet = edgesByLabelOf(edgesByLocation, instance)
edges = edgesByLabelOf(edgesByLocation, instance)
instances.append(edges)
ndLabels.append(nonDet)
if "syncs" not in system:
syncs = []
......@@ -59,8 +57,8 @@ def instancesOf(model: dict, functions: dict) -> list:
edges.append(instances[index][label])
removeLabel[index].add(label)
edges = flattenOf(edges)
for uniqueIndex, edge in enumerate(edges):
updatedLabel = "{}_flatten_{}".format(result, uniqueIndex)
for edge in edges:
updatedLabel = "{}_{}".format(result, len(updatedSyncs))
updatedVector = []
for index, entry in enumerate(syncVector):
if entry:
......@@ -77,35 +75,6 @@ def instancesOf(model: dict, functions: dict) -> list:
return instances
def isLocal(synchronisation: list) -> bool:
"""
Function Description:
Return wether transition are executed locally in automaton.
Function Parameters:
synchronisation: list
Single synchronisation vector in jani-model system
"""
return len(synchronisation) - synchronisation.count(None) == 1
def ndProblem(synchronisation: list, ndLabels: dict) -> bool:
"""
Function Description:
Return wether non deterministic choice can occur in synchronised labels.
Function Parameters:
synchronisation: list
Single synchronisation vector in jani-model system
ndLabels: dict
Labels with non deterministic choices
"""
containND = []
for index, label in enumerate(synchronisation):
containND.append(label in ndLabels[index])
return any(containND)
def flattenOf(edges: list) -> list:
"""
Function Description:
......@@ -249,15 +218,12 @@ def edgesByLabelOf(edgesByLocation: dict, automaton: str) -> dict:
automaton: str
Name of automaton
"""
ndLabels = set()
edgesByLabel = dict()
for edges in edgesByLocation.values():
for label, information in edges.items():
if information["amount"] > 1:
ndLabels.add(label)
if label not in edgesByLabel:
edgesByLabel[label] = []
for edge in information["edges"]:
individual = edgeHelper.unificationOf(edge, automaton)
edgesByLabel[label] += individual
return edgesByLabel, ndLabels
return edgesByLabel
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment