예제 #1
0
파일: core.py 프로젝트: vruijven/ixmp
def _getCleanDims(dims, dimsDefault=None):
    cleanDims = java.LinkedList()

    if dims is not None:
        for aDim in dims:
            cleanDims.add(aDim)
    elif dimsDefault is not None:
        for aDim in dimsDefault:
            cleanDims.add(aDim)

    return cleanDims
예제 #2
0
파일: core.py 프로젝트: vruijven/ixmp
def to_jlist(pylist, idxName=None):
    if pylist is None:
        return None

    jList = java.LinkedList()
    if idxName is None:
        if type(pylist) is list:
            for key in pylist:
                jList.add(str(key))
        elif type(pylist) is set:
            for key in list(pylist):
                jList.add(str(key))
        else:
            jList.add(str(pylist))
    else:
        for idx in idxName:
            jList.add(str(pylist[idx]))
    return jList
예제 #3
0
파일: core.py 프로젝트: yaruzhangiiasa/ixmp
def to_jlist(pylist, idx_names=None):
    """Transforms a python list to a Java.LinkedList"""
    if pylist is None:
        return None

    jList = java.LinkedList()
    if idx_names is None:
        if type(pylist) is list:
            for key in pylist:
                jList.add(str(key))
        elif type(pylist) is set:
            for key in list(pylist):
                jList.add(str(key))
        else:
            jList.add(str(pylist))
    else:
        for idx in idx_names:
            jList.add(str(pylist[idx]))
    return jList