db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r209845 - /incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BigIntegerDecimal.java
Date Fri, 08 Jul 2005 17:28:53 GMT
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



Mime
View raw message