public String toString() { switch (m_type) { case VAR: return "in[" + m_index + "]"; case CONST: return m_value.toString(); case UNOP: return uopString() + "(" + m_right.toString() + ")"; case BINOP: return "(" + m_left.toString() + " " + bopString() + " " + m_right.toString() + ")"; default: return ""; } }
public String toString() { switch (m_utype) { case SIN: return "sin(" + m_func.toString() + ")"; case COS: return "cos(" + m_func.toString() + ")"; case LN: return "ln(" + m_func.toString() + ")"; case LOG: return "log(" + m_func.toString() + ")"; case CEIL: return "ceil(" + m_func.toString() + ")"; case FLOOR: return "floor(" + m_func.toString() + ")"; default: return null; } }
/* public FuncValue nest(FuncValue[] inputs) { Func[] funcs = new Func[inputs.length]; for(int i = 0; i < inputs.length; i++) { funcs[i] = inputs[i].m_function; } int shift = inputs[0].m_params; for(int i = 1; i < inputs.length; i++) { funcs[i] = funcs[i].shift(shift); shift += inputs[i].m_params; } return new FuncValue(shift, m_function.nest(funcs)); } */ public String toString() { String output = "|in[0]"; for (int i = 1; i < m_params; i++) output += ", in[" + i + "]"; output += "| -> |" + m_function.toString() + "|"; return output; }