Data-Test-Executer Framework speziell zum Test von Datenverarbeitungen mit Datengenerierung, Systemvorbereitungen, Einspielungen, ganzheitlicher diversifizierender Vergleich
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

98 lines
2.8 KiB

#
# ------------------------------------------------------------
"""
"""
class Matching():
def __init__(self, comp):
self.comp = comp
self.elements = {}
self.resultFiles = comp.resultFiles
self.targetFiles = comp.targetFiles
self.assignedFiles = {}
pass
def matchFiles(matching):
"""
post:
:param matching:
:return:
"""
pass
def matchBestfit(matching):
"""
in this strategy the difference-score of all elements of both sides will be calculated.
the best fit will assigned together until nothing is
* the elements can be each kind of object
* the count of elements should not be high
:param matching:
:return:
"""
hits = {}
output = []
results = {}
targets = {}
for tg in matching.elements["tgelement"]:
targets[tg] = True
for rs in matching.elements["rselement"]:
results[rs] = True
for tg in matching.elements["tgelement"]:
acthit = matching.comp.getHitscore(matching.elementtyp, matching.elements["rselement"][rs], matching.elements["tgelement"][tg])
while acthit in hits.keys():
acthit = getNextHitscore(acthit)
hits[acthit] = {}
hits[acthit]["result"] = rs
hits[acthit]["target"] = tg
for h in sorted(hits.keys()):
if results[h]["result"] and targets[h]["target"]:
results[h]["result"] = False
targets[h]["target"] = False
output.append((hits[acthit]["result"], hits[acthit]["target"]))
for rs in results.keys():
if results[rs]:
output.append((matching.elements["rselement"][rs], None))
for tg in targets.keys():
if results[rs]:
output.append((matching.elements["tgelement"][tg], None))
return output
# --------------------------------------------------------------------------
def matchTree(matching):
"""
:param matching:
:return:
"""
pass
def matchElement(matching, rs, tg):
if "array" in type(rs) and "array" in type(tg):
return matchArray(matching, rs, tg)
elif "dict" in type(rs) and "dict" in type(tg):
return matchDict(matching, rs, tg)
else:
pass
def matchDict(matching, rs, tg):
pass
def matchArray(matching, rs, tg):
pass # matchBest
# --------------------------------------------------------------------------
def matchLines(matching):
pass
# --------------------------------------------------------------------------
def getScoreint(score):
if score.is_integer():
return score
elif "h_" in score:
return int(score[2:])
def getHitscore(score):
return "h_" + ':04d'.format(getScoreint(score))
def getNextHitscore(score):
return "h_" + ':04d'.format(getScoreint(score)+1)