private NumValue unary(NumValue[] params) { switch (m_uop) { case UMINUS: return m_right.evaluate(params).neg(); case NOT: return m_right.evaluate(params).not(); default: return null; } }
public NumValue evaluate(NumValue[] params) { switch (m_utype) { case SIN: return NumLang.Func.sin(m_func.evaluate(params)); case COS: return NumLang.Func.cos(m_func.evaluate(params)); case LN: return NumLang.Func.ln(m_func.evaluate(params)); case LOG: return NumLang.Func.log(m_func.evaluate(params)); case CEIL: return NumLang.Func.ceil(m_func.evaluate(params)); case FLOOR: return NumLang.Func.floor(m_func.evaluate(params)); default: return null; } }
public NumValue evaluate(NumValue[] paramlist) { return m_function.evaluate(paramlist); }
private NumValue binary(NumValue[] params) { switch (m_bop) { case ADD: return m_left.evaluate(params).add(m_right.evaluate(params)); case SUB: return m_left.evaluate(params).subtract(m_right.evaluate(params)); case MULT: return m_left.evaluate(params).multiply(m_right.evaluate(params)); case DIV: return m_left.evaluate(params).divide(m_right.evaluate(params)); case EXP: return m_left.evaluate(params).exp(m_right.evaluate(params)); case MOD: return m_left.evaluate(params).mod(m_right.evaluate(params)); case EQ: return m_left.evaluate(params).eq(m_right.evaluate(params)); case NEQ: return m_left.evaluate(params).neq(m_right.evaluate(params)); case LT: return m_left.evaluate(params).lt(m_right.evaluate(params)); case LEQ: return m_left.evaluate(params).leq(m_right.evaluate(params)); case GT: return m_left.evaluate(params).gt(m_right.evaluate(params)); case GEQ: return m_left.evaluate(params).geq(m_right.evaluate(params)); default: return null; } }