|
From: <jg...@us...> - 2006-10-04 08:57:07
|
Revision: 75
http://svn.sourceforge.net/surveyforge/?rev=75&view=rev
Author: jgongo
Date: 2006-10-04 01:56:58 -0700 (Wed, 04 Oct 2006)
Log Message:
-----------
Accept Integer objects
Modified Paths:
--------------
trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/QuantityValueDomain.java
Modified: trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/QuantityValueDomain.java
===================================================================
--- trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/QuantityValueDomain.java 2006-10-04 08:56:17 UTC (rev 74)
+++ trunk/surveyforge-core/src/main/java/org/surveyforge/core/metadata/domain/QuantityValueDomain.java 2006-10-04 08:56:58 UTC (rev 75)
@@ -132,8 +132,15 @@
public boolean isValid( Serializable object )
{
- if( object instanceof BigDecimal )
+ if( object instanceof Integer )
{
+ BigDecimal quantity = new BigDecimal( (Integer) object );
+ return quantity.scale( ) <= this.getScale( )
+ && (quantity.precision( ) - quantity.scale( )) <= (this.getPrecision( ) - this.getScale( ))
+ && this.getMinimum( ).compareTo( quantity ) <= 0 && quantity.compareTo( this.getMaximum( ) ) <= 0;
+ }
+ else if( object instanceof BigDecimal )
+ {
BigDecimal quantity = (BigDecimal) object;
return quantity.scale( ) <= this.getScale( )
&& (quantity.precision( ) - quantity.scale( )) <= (this.getPrecision( ) - this.getScale( ))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|