예제 #1
0
def create_formula_with_value(variable_value):
    assert variable_value != None
    if type(variable_value) is int:
        java_variable_value = java.lang.Integer(variable_value)
    elif isinstance(variable_value, (float, long)):
        java_variable_value = java.lang.Double(variable_value)
    elif isinstance(variable_value, (str, unicode)):
        try:
            temp = common.int_or_float(variable_value)
            if temp is not None:
                variable_value = java.lang.Integer(temp) if isinstance(
                    temp, int) else java.lang.Double(temp)
            java_variable_value = variable_value
        except:
            java_variable_value = variable_value
    else:
        assert isinstance(variable_value, catformula.FormulaElement)
        java_variable_value = variable_value
    return catformula.Formula(java_variable_value)
예제 #2
0
def create_formula_for(expression):
    return catformula.Formula(create_formula_element_for(expression))