예제 #1
0
def filter_sort_meth_basic(j, x, value):
    z = sorted(iter(x.items()), key=lambda k_v: (k_v[1], k_v[0]))

    if get_debug():
        for i in z:
            debug("\t %s %f" % (i[0].get_info(), i[1]))

    if z[:1][0][1] > value:
        return []

    return z[:1]
예제 #2
0
def filter_sort_meth_basic( j, x, value ) :
    z = sorted(x.iteritems(), key=lambda (k,v): (v,k))

    if get_debug() :
        for i in z :
            debug("\t %s %f" %(i[0].get_info(), i[1]))
 
    if z[:1][0][1] > value :
        return []

    return z[:1]
예제 #3
0
def filter_sort_meth_basic(j, x, value):
    z = sorted(x.iteritems(), key=lambda (k, v): (v, k))

    if get_debug():
        for i in z:
            debug("\t %s %f" % (i[0].get_info(), i[1]))

    if z[:1][0][1] > value:
        return []

    return z[:1]
예제 #4
0
def filter_sort_meth_basic( j, x, value ):
    z = sorted(iter(x.items()), key=lambda k_v: (k_v[1],k_v[0]))

    if get_debug():
        for i in z:
            debug("\t %s %f" %(i[0].get_info(), i[1]))

    if z[:1][0][1] > value:
        return []

    return z[:1]
예제 #5
0
파일: dalvik.py 프로젝트: themoep/elsim
def getDiff(C, X, Y, i, j, a, r):
    if i > 0 and j > 0 and X[i - 1] == Y[j - 1]:
        getDiff(C, X, Y, i - 1, j - 1, a, r)
        debug(" " + "%02X" % ord(X[i - 1]))
    else:
        if j > 0 and (i == 0 or C[i][j - 1] >= C[i - 1][j]):
            getDiff(C, X, Y, i, j - 1, a, r)
            a.append((j - 1, Y[j - 1]))
            debug(" + " + "%02X" % ord(Y[j - 1]))
        elif i > 0 and (j == 0 or C[i][j - 1] < C[i - 1][j]):
            getDiff(C, X, Y, i - 1, j, a, r)
            r.append((i - 1, X[i - 1]))
            debug(" - " + "%02X" % ord(X[i - 1]))
예제 #6
0
파일: dalvik.py 프로젝트: themoep/elsim
def filter_diff_bb(x, y):
    final_add = []
    final_rm = []

    hS = {}
    rS = {}

    X, map_x = toString(x.bb, hS, rS)
    Y, map_y = toString(y.bb, hS, rS)

    debug("%s %d" % (repr(X), len(X)))
    debug("%s %d" % (repr(Y), len(Y)))

    m = len(X)
    n = len(Y)

    C = LCS(X, Y)
    a = []
    r = []

    getDiff(C, X, Y, m, n, a, r)
    debug(a)
    debug(r)

    debug("DEBUG ADD")
    for i in a:
        instructions = [j for j in y.bb.get_instructions()]
        debug(" \t %s %s %s" % (i[0], instructions[i[0]].get_name(),
                                instructions[i[0]].get_output()))
        final_add.append((i[0], map_y[i[0]], instructions[i[0]]))

    debug("DEBUG REMOVE")
    for i in r:
        instructions = [j for j in x.bb.get_instructions()]
        debug(" \t %s %s %s" % (i[0], instructions[i[0]].get_name(),
                                instructions[i[0]].get_output()))
        final_rm.append((i[0], map_x[i[0]], instructions[i[0]]))

    return DiffBasicBlock(y, x, final_add, final_rm)