All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.xmlform.expression.IntegerValue Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
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 IntegerValue extends AbstractValue implements NumericValue {
	private BigInteger value;

	public IntegerValue(BigInteger 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 FloatValue) {
			FloatValue fv=(FloatValue)obj;
			return fv.compareTo(this);
		}
		if(!(obj instanceof IntegerValue))
			throw new ExpressionException(obj+" is not a numieric");
		IntegerValue v=(IntegerValue)obj;
		return value.compareTo(v.value);
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy