/** * mod * @param other anther <code>ExprValue</code> * @return ExprValue * @throws FormulaException */ public ExprValue mod(ExprValue other){ switch (dataType){ // NOSONAR case Long: if (other.dataType == DataType.Long){ setLong(getLong() % other.getLong()); return this; } default: } throw new FormulaException("Can not mod value between " + dataType.toString() + " and " + other.dataType.toString()); }
/** * get boolean value from <code>ExprValue</code> * @return boolean value * @throws FormulaException en excption when data type is mismatched */ public boolean getBoolean(){ switch (dataType){ case Long: return ((Long) value).longValue() != 0; case Boolean: return ((Boolean) value).booleanValue(); default: } throw new FormulaException("Can not get a boolean value from " + dataType.toString()); }
/** * get double value from <code>ExprValue</code> * @return double value * @throws FormulaException en excption when data type is mismatched */ public double getDouble(){ switch (dataType) { case Long: return ((Long) value).doubleValue(); case Double: return ((Double) value).doubleValue(); default: } throw new FormulaException("Can not get a double value from " + dataType.toString()); }
/** * get long value from <code>ExprValue</code> * @return long value of the expr value * @throws FormulaException en excption when data type is mismatched */ public long getLong(){ switch (dataType){ case Long:return ((Long)value).longValue(); case Double:return ((Double)value).longValue(); default: } throw new FormulaException("Can not get a long value from " + dataType.toString()); }
/** * get date value from <code>ExprValue</code> * @return date value * @throws FormulaException en excption when data type is mismatched */ public Date getDate(){ if (dataType == DataType.Date){ return (Date)value; } throw new FormulaException("Can not get a date value from " + dataType.toString()); }