Code example for BigDecimal

Methods: signum

0
 */ 
public class FeedInRate extends Modifier {
	BigDecimal feedInRate; // $ amount feed in rate per kWh
	 
	public FeedInRate(Node n) throws EstimatorException {
		setRate( new BigDecimal(((Element) n).getAttribute("rate")) );
	} 
	 
	public FeedInRate(BigDecimal rate) throws EstimatorException {
		setRate( rate );
	} 
	 
	/** 
	 *  
	 * @param rate 
	 * @throws EstimatorException 
	 */ 
	private void setRate( BigDecimal rate ) throws EstimatorException {
		// sanity checks 
		 
		if ( rate.signum() <= 0 ) {
			throw new EstimatorException ( "Feed in rate cannot be equal to, or under, $0.00" ); 
		} 
		 
		this.feedInRate = rate;
	}