
net.sf.xmlform.expression.FloatValue Maven / Gradle / Ivy
package net.sf.xmlform.expression;
import java.math.BigDecimal;
import java.math.BigInteger;
import net.sf.xmlform.expression.impl.AbstractValue;
/**
* @author Liu Zhikun
*/
public class FloatValue extends AbstractValue implements NumericValue {
private BigDecimal value;
public FloatValue(BigDecimal v){
value=v;
}
public Object getValue() {
return value;
}
public int intValue() {
return value.intValue();
}
public long longValue() {
return value.longValue();
}
public float floatValue() {
return value.floatValue();
}
public double doubleValue() {
return value.doubleValue();
}
public byte byteValue() {
return value.byteValue();
}
public short shortValue() {
return value.shortValue();
}
public String toString() {
return value.toString();
}
public int compareTo(Value obj) {
if(obj instanceof NullValue)
return 1;
if(obj instanceof IntegerValue) {
IntegerValue iv=(IntegerValue)obj;
BigInteger bi=(BigInteger)iv.getValue();
return value.compareTo(new BigDecimal(bi));
}
if(!(obj instanceof FloatValue))
throw new ExpressionException(obj+" is not a numieric");
FloatValue v=(FloatValue)obj;
return value.compareTo(v.value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy