You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2005/07/08 19:28:53 UTC

svn commit: r209845 - /incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BigIntegerDecimal.java

Author: djd
Date: Fri Jul  8 10:28:52 2005
New Revision: 209845

URL: http://svn.apache.org/viewcvs?rev=209845&view=rev
Log:
DERBY-447
This patch implements getBoolean() method in BigIntegerDecimal, which is the class used for DECIMAL support
in J2ME/CDC/Foundation. The method returns false for zero or null values and true for all other values.

Contributed by Deepa Remesh dremesh@gmail.com

Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BigIntegerDecimal.java

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BigIntegerDecimal.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BigIntegerDecimal.java?rev=209845&r1=209844&r2=209845&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BigIntegerDecimal.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BigIntegerDecimal.java Fri Jul  8 10:28:52 2005
@@ -98,6 +98,15 @@
 		return NumberDataType.normalizeDOUBLE(Double.parseDouble(getString()));
 	}	
 	
+    // 0 or null is false, all else is true
+	public boolean	getBoolean()
+	{
+		if (isNull())
+			return false;
+		
+		BigInteger bi = new BigInteger(data2c);
+		return bi.compareTo(java.math.BigInteger.ZERO) != 0;
+	}
 
 	/**
 	 * Set the value from a String, the format is