public int getInt(){ return (int)getLong(); }
/** * 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()); }
return ((Long)value).compareTo((Long)other.value); case Double: // NOSONAR if (getLong() > other.getDouble()){ return 1; }else{ return other.getDouble() > getLong() ? -1 : 0; return ((Double)value).compareTo((Double)other.value); case Long: // NOSONAR boolean compare = getDouble() > other.getLong(); if (compare){ return 1; }else{ return getDouble() < other.getLong() ? -1 : 0;
case Long: // NOSONAR if (other.dataType == DataType.Long){ if (other.getLong() == 0) throw new FormulaException("divided by zero"); // NOSONAR setLong(getLong() / other.getLong()); return this; }else{ if (other.getDouble() == 0) // NOSONAR throw new FormulaException("divided by zero"); setDouble(getLong() / other.getDouble()); return this;
switch (value.getDataType()){ case Long: return new ExprValue(-value.getLong()); case Double: return new ExprValue(-value.getDouble());