from orangescape.model.engine.execution.exFunctions import getNumber

def ISBLANK(argList):
    if argList[0] or argList[0]=="":
        return 0.0
    return 1.0

def ISEVEN(argList):
    number=int(argList[0])
    if number%2 == 0.0:
        return 1.0
    return 0.0

def ISNUMBER(argList):
    if type(argList[0]) in (int, long, float, complex):
        return 1.0
    else:
        return 0.0

def ISODD(argList):
    number=int(argList[0])
    if number%2 == 1.0:
        return 1.0
    return 0.0

def ISLOGICAL(argList):
    if argList[0]==1.0 or argList[0]==0.0:
        return 1.0
    return 0.0

def ISTEXT(argList):
    if type(argList[0]) in (int, long, float, complex):
        return 0.0
    return 1.0

def N(argList):
    if type(argList[0]) in (int, long, float, complex):
            return getNumber(argList[0])
    return 0.0
