svn commit: r1161378 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/ComparatorUtils.java

2011-08-24 Thread bayard
Author: bayard
Date: Thu Aug 25 04:29:29 2011
New Revision: 1161378

URL: http://svn.apache.org/viewvc?rev=1161378&view=rev
Log:
Removing ComparatorUtils. I don't think min/max(Obj,Obj,Comparator) are the 
most useful methods, and I'm not sure we need the static factory methods to 
instantiate the comparators. 

Removed:

commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/ComparatorUtils.java



svn commit: r1161343 [2/2] - in /commons/proper/codec/branches/generics/src: java/org/apache/commons/codec/language/bm/ java/org/apache/commons/codec/net/ test/org/apache/commons/codec/binary/ test/or

2011-08-24 Thread ggregory
Modified: 
commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/binary/BinaryCharCodecTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/binary/BinaryCharCodecTest.java?rev=1161343&r1=1161342&r2=1161343&view=diff
==
--- 
commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/binary/BinaryCharCodecTest.java
 (original)
+++ 
commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/binary/BinaryCharCodecTest.java
 Thu Aug 25 00:35:31 2011
@@ -157,7 +157,7 @@ public class BinaryCharCodecTest {
  */
 void assertDecodeObject(byte[] bits, String encodeMe) throws 
DecoderException, UnsupportedEncodingException {
 byte[] decoded;
-decoded = (byte[]) instance.decode(encodeMe);
+decoded = instance.decode(encodeMe);
 assertEquals(new String(bits), new String(decoded));
 if (encodeMe == null) {
 decoded = instance.decode((byte[]) null);
@@ -365,90 +365,90 @@ public class BinaryCharCodecTest {
  */
 @Test
 public void testFromAsciiCharArray() {
-assertEquals(0, BinaryCharCodec.fromAscii((char[]) null).length);
-assertEquals(0, BinaryCharCodec.fromAscii(new char[0]).length);
+assertEquals(0, BinaryCodec.fromAscii((char[]) null).length);
+assertEquals(0, BinaryCodec.fromAscii(new char[0]).length);
 // With a single raw binary
 byte[] bits = new byte[1];
-byte[] decoded = BinaryCharCodec.fromAscii("".toCharArray());
+byte[] decoded = BinaryCodec.fromAscii("".toCharArray());
 assertEquals(new String(bits), new String(decoded));
 bits = new byte[1];
 bits[0] = BIT_0;
-decoded = BinaryCharCodec.fromAscii("0001".toCharArray());
+decoded = BinaryCodec.fromAscii("0001".toCharArray());
 assertEquals(new String(bits), new String(decoded));
 bits = new byte[1];
 bits[0] = BIT_0 | BIT_1;
-decoded = BinaryCharCodec.fromAscii("0011".toCharArray());
+decoded = BinaryCodec.fromAscii("0011".toCharArray());
 assertEquals(new String(bits), new String(decoded));
 bits = new byte[1];
 bits[0] = BIT_0 | BIT_1 | BIT_2;
-decoded = BinaryCharCodec.fromAscii("0111".toCharArray());
+decoded = BinaryCodec.fromAscii("0111".toCharArray());
 assertEquals(new String(bits), new String(decoded));
 bits = new byte[1];
 bits[0] = BIT_0 | BIT_1 | BIT_2 | BIT_3;
-decoded = BinaryCharCodec.fromAscii("".toCharArray());
+decoded = BinaryCodec.fromAscii("".toCharArray());
 assertEquals(new String(bits), new String(decoded));
 bits = new byte[1];
 bits[0] = BIT_0 | BIT_1 | BIT_2 | BIT_3 | BIT_4;
-decoded = BinaryCharCodec.fromAscii("0001".toCharArray());
+decoded = BinaryCodec.fromAscii("0001".toCharArray());
 assertEquals(new String(bits), new String(decoded));
 bits = new byte[1];
 bits[0] = BIT_0 | BIT_1 | BIT_2 | BIT_3 | BIT_4 | BIT_5;
-decoded = BinaryCharCodec.fromAscii("0011".toCharArray());
+decoded = BinaryCodec.fromAscii("0011".toCharArray());
 assertEquals(new String(bits), new String(decoded));
 bits = new byte[1];
 bits[0] = BIT_0 | BIT_1 | BIT_2 | BIT_3 | BIT_4 | BIT_5 | BIT_6;
-decoded = BinaryCharCodec.fromAscii("0111".toCharArray());
+decoded = BinaryCodec.fromAscii("0111".toCharArray());
 assertEquals(new String(bits), new String(decoded));
 bits = new byte[1];
 bits[0] = (byte) (BIT_0 | BIT_1 | BIT_2 | BIT_3 | BIT_4 | BIT_5 | 
BIT_6 | BIT_7);
-decoded = BinaryCharCodec.fromAscii("".toCharArray());
+decoded = BinaryCodec.fromAscii("".toCharArray());
 assertEquals(new String(bits), new String(decoded));
 // With a two raw binaries
 bits = new byte[2];
 bits[0] = (byte) (BIT_0 | BIT_1 | BIT_2 | BIT_3 | BIT_4 | BIT_5 | 
BIT_6 | BIT_7);
-decoded = BinaryCharCodec.fromAscii("".toCharArray());
+decoded = BinaryCodec.fromAscii("".toCharArray());
 assertEquals(new String(bits), new String(decoded));
 bits = new byte[2];
 bits[1] = BIT_0;
 bits[0] = (byte) (BIT_0 | BIT_1 | BIT_2 | BIT_3 | BIT_4 | BIT_5 | 
BIT_6 | BIT_7);
-decoded = BinaryCharCodec.fromAscii("0001".toCharArray());
+decoded = BinaryCodec.fromAscii("0001".toCharArray());
 assertEquals(new String(bits), new String(decoded));
 bits = new byte[2];
 bits[1] = BIT_0 | BIT_1;
 bits[0] = (byte) (BIT_0 | BIT_1 | BIT_2 | BIT_3 | BIT_4 | BIT_5 | 
BIT_6 | BIT_7);
-decoded = Bina

svn commit: r1161343 [1/2] - in /commons/proper/codec/branches/generics/src: java/org/apache/commons/codec/language/bm/ java/org/apache/commons/codec/net/ test/org/apache/commons/codec/binary/ test/or

2011-08-24 Thread ggregory
Author: ggregory
Date: Thu Aug 25 00:35:31 2011
New Revision: 1161343

URL: http://svn.apache.org/viewvc?rev=1161343&view=rev
Log:
Use blocks. Refer to constants and methods where they are defined in BaseNCodec 
instead of the Base32 and Base64 subclasses (and other classes.)

Modified:

commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/Lang.java

commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java

commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/net/URLStringCodec.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/binary/Base32InputStreamTest.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/binary/Base32OutputStreamTest.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/binary/Base64InputStreamTest.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/binary/Base64Test.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/binary/BinaryByteCodecTest.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/binary/BinaryCharCodecTest.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/binary/HexByteTest.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/binary/HexCharTest.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/net/BCodecTest.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/net/QCodecTest.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/net/QuotedPrintableBinaryCodecTest.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/net/QuotedPrintableStringCodecTest.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/net/URLCodecBinaryTest.java

commons/proper/codec/branches/generics/src/test/org/apache/commons/codec/net/URLCodecStringTest.java

Modified: 
commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/Lang.java
URL: 
http://svn.apache.org/viewvc/commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/Lang.java?rev=1161343&r1=1161342&r2=1161343&view=diff
==
--- 
commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/Lang.java
 (original)
+++ 
commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/Lang.java
 Thu Aug 25 00:35:31 2011
@@ -158,8 +158,9 @@ public class Lang {
 // trim leading-trailing whitespace
 line = line.trim();
 
-if (line.length() == 0)
+if (line.length() == 0) {
 continue; // empty lines can be safely skipped
+}
 
 // split it up
 String[] parts = line.split("\\s+");

Modified: 
commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
URL: 
http://svn.apache.org/viewvc/commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java?rev=1161343&r1=1161342&r2=1161343&view=diff
==
--- 
commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
 (original)
+++ 
commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
 Thu Aug 25 00:35:31 2011
@@ -189,8 +189,9 @@ public class PhoneticEngine {
 }
 
 public CharSequence subSequence(int start, int end) {
-if (start == end)
+if (start == end) {
 return "";
+}
 
 CharSequence res = cache[start][end - 1];
 if (res == null) {

Modified: 
commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/net/URLStringCodec.java
URL: 
http://svn.apache.org/viewvc/commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/net/URLStringCodec.java?rev=1161343&r1=1161342&r2=1161343&view=diff
==
--- 
commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/net/URLStringCodec.java
 (original)
+++ 
commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/net/URLStringCodec.java
 Thu Aug 25 00:35:31 2011
@@ -52,6 +52,7 @@ public class URLStringCodec extends URLC
  * 
  * @return the default string charset.
  */
+@Override
 public String getDef

svn commit: r1161342 - in /commons/proper/codec/trunk/src: java/org/apache/commons/codec/language/bm/ test/org/apache/commons/codec/binary/

2011-08-24 Thread ggregory
Author: ggregory
Date: Thu Aug 25 00:34:24 2011
New Revision: 1161342

URL: http://svn.apache.org/viewvc?rev=1161342&view=rev
Log:
Use blocks. Refer to constants where they are defined in BaseNCodec instead of 
the Base32 and Base64 subclasses.

Modified:

commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Lang.java

commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java

commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32InputStreamTest.java

commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32OutputStreamTest.java

commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64InputStreamTest.java

commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java

commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java

Modified: 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Lang.java
URL: 
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Lang.java?rev=1161342&r1=1161341&r2=1161342&view=diff
==
--- 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Lang.java
 (original)
+++ 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Lang.java
 Thu Aug 25 00:34:24 2011
@@ -158,8 +158,9 @@ public class Lang {
 // trim leading-trailing whitespace
 line = line.trim();
 
-if (line.length() == 0)
+if (line.length() == 0) {
 continue; // empty lines can be safely skipped
+}
 
 // split it up
 String[] parts = line.split("\\s+");

Modified: 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
URL: 
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java?rev=1161342&r1=1161341&r2=1161342&view=diff
==
--- 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
 (original)
+++ 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
 Thu Aug 25 00:34:24 2011
@@ -189,8 +189,9 @@ public class PhoneticEngine {
 }
 
 public CharSequence subSequence(int start, int end) {
-if (start == end)
+if (start == end) {
 return "";
+}
 
 CharSequence res = cache[start][end - 1];
 if (res == null) {

Modified: 
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32InputStreamTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32InputStreamTest.java?rev=1161342&r1=1161341&r2=1161342&view=diff
==
--- 
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32InputStreamTest.java
 (original)
+++ 
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base32InputStreamTest.java
 Thu Aug 25 00:34:24 2011
@@ -128,7 +128,7 @@ public class Base32InputStreamTest {
  */
 @Test
 public void testBase32EmptyInputStreamMimeChuckSize() throws Exception {
-testBase32EmptyInputStream(Base32.MIME_CHUNK_SIZE);
+testBase32EmptyInputStream(BaseNCodec.MIME_CHUNK_SIZE);
 }
 
 /**
@@ -139,7 +139,7 @@ public class Base32InputStreamTest {
  */
 @Test
 public void testBase32EmptyInputStreamPemChuckSize() throws Exception {
-testBase32EmptyInputStream(Base32.PEM_CHUNK_SIZE);
+testBase32EmptyInputStream(BaseNCodec.PEM_CHUNK_SIZE);
 }
 
 private void testBase32EmptyInputStream(int chuckSize) throws Exception {
@@ -160,12 +160,12 @@ public class Base32InputStreamTest {
 // Hello World test.
 byte[] encoded = 
StringUtils.getBytesUtf8(Base32TestData.BASE32_FIXTURE);
 byte[] decoded = 
StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE);
-testByChunk(encoded, decoded, Base32.MIME_CHUNK_SIZE, CRLF);
+testByChunk(encoded, decoded, BaseNCodec.MIME_CHUNK_SIZE, CRLF);
 
 // Single Byte test.
 encoded = StringUtils.getBytesUtf8("AA==\r\n");
 decoded = new byte[]{(byte) 0};
-testByChunk(encoded, decoded, Base32.MIME_CHUNK_SIZE, CRLF);
+testByChunk(encoded, decoded, BaseNCodec.MIME_CHUNK_SIZE, CRLF);
 
 //// OpenSSL interop test.
 //encoded = 
StringUtils.getBytesUtf8(Base32TestData.ENCODED_32_CHARS_PER_LINE);
@@ -199,12 +199,12 @@ public class Base32InputStreamTest {
 // Hello Wo

svn commit: r1161258 - in /commons/proper/configuration/trunk: RELEASE-NOTES.txt src/changes/changes.xml

2011-08-24 Thread oheger
Author: oheger
Date: Wed Aug 24 19:58:22 2011
New Revision: 1161258

URL: http://svn.apache.org/viewvc?rev=1161258&view=rev
Log:
Updated changes and release notes.

Modified:
commons/proper/configuration/trunk/RELEASE-NOTES.txt
commons/proper/configuration/trunk/src/changes/changes.xml

Modified: commons/proper/configuration/trunk/RELEASE-NOTES.txt
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/RELEASE-NOTES.txt?rev=1161258&r1=1161257&r2=1161258&view=diff
==
--- commons/proper/configuration/trunk/RELEASE-NOTES.txt (original)
+++ commons/proper/configuration/trunk/RELEASE-NOTES.txt Wed Aug 24 19:58:22 
2011
@@ -256,8 +256,8 @@ IMPROVEMENTS AND NEW FEATURES IN 1.7
 OTHER CHANGES
 =
 * [CONFIGURATION-459]
-  The user guide was updated to no more mention ConfigurationFactory. This 
class
-  is scheduled for deprecation.
+  ConfigurationFactory has been deprecated. The user guide was updated to no
+  more mention this class.
 
 * [CONFIGURATION-456]
   Improved Javadocs of getKeys(String) method for some configuration classes.

Modified: commons/proper/configuration/trunk/src/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/changes/changes.xml?rev=1161258&r1=1161257&r2=1161258&view=diff
==
--- commons/proper/configuration/trunk/src/changes/changes.xml (original)
+++ commons/proper/configuration/trunk/src/changes/changes.xml Wed Aug 24 
19:58:22 2011
@@ -29,8 +29,8 @@
 DefaultConfigurationBuilder.
   
   
-The user guide was updated to no more mention ConfigurationFactory.
-This class is scheduled for deprecation.
+ConfigurationFactory has been deprecated. The user guide was updated to
+no more mention this class.
   
   
 HierarchicalConfiguration now provides a specific implementation of the




svn commit: r1161254 - /commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationFactory.java

2011-08-24 Thread oheger
Author: oheger
Date: Wed Aug 24 19:54:07 2011
New Revision: 1161254

URL: http://svn.apache.org/viewvc?rev=1161254&view=rev
Log:
Deprecated ConfigurationFactory.

Modified:

commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationFactory.java

Modified: 
commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationFactory.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationFactory.java?rev=1161254&r1=1161253&r2=1161254&view=diff
==
--- 
commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationFactory.java
 (original)
+++ 
commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationFactory.java
 Wed Aug 24 19:54:07 2011
@@ -60,8 +60,10 @@ import org.xml.sax.SAXException;
  *
  * @author mailto:ep...@upstate.com";>Eric Pugh
  * @author mailto:h...@intermeta.de";>Henning P. Schmiedehausen
- * @author mailto:oliver.he...@t-online.de";>Oliver Heger
  * @version $Id$
+ * @deprecated Use {@link DefaultConfigurationBuilder} instead; this class
+ * provides the same features as ConfigurationFactory plus some more; it can
+ * also process the same configuration definition files.
  */
 public class ConfigurationFactory
 {




svn commit: r1161249 - in /commons/proper/configuration/trunk: maven-build.xml pom.xml

2011-08-24 Thread oheger
Author: oheger
Date: Wed Aug 24 19:47:54 2011
New Revision: 1161249

URL: http://svn.apache.org/viewvc?rev=1161249&view=rev
Log:
Updated dependency to commons-vfs2 2.0 final.

Modified:
commons/proper/configuration/trunk/maven-build.xml
commons/proper/configuration/trunk/pom.xml

Modified: commons/proper/configuration/trunk/maven-build.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/maven-build.xml?rev=1161249&r1=1161248&r2=1161249&view=diff
==
--- commons/proper/configuration/trunk/maven-build.xml (original)
+++ commons/proper/configuration/trunk/maven-build.xml Wed Aug 24 19:47:54 2011
@@ -54,7 +54,7 @@
 
 
 
-
+
 
 
 
@@ -76,7 +76,7 @@
 
 
 
-
+
 
 
 
@@ -395,13 +395,13 @@
  
dest="${maven.repo.local}/commons-jexl/commons-jexl/1.1/commons-jexl-1.1.jar" 
  usetimestamp="false" 
  ignoreerrors="true"/>
-
-http://repository.apache.org/snapshots/org/apache/commons/commons-vfs2/2.0-SNAPSHOT/commons-vfs2-2.0-20110818.063144-26.jar";
 
- 
dest="${maven.repo.local}/org/apache/commons/commons-vfs2/2.0-SNAPSHOT/commons-vfs2-2.0-20110818.063144-26.jar"
 
+
+http://repository.apache.org/snapshots/org/apache/commons/commons-vfs2/2.0/commons-vfs2-2.0.jar";
 
+ 
dest="${maven.repo.local}/org/apache/commons/commons-vfs2/2.0/commons-vfs2-2.0.jar"
 
  usetimestamp="false" 
  ignoreerrors="true"/>
-http://repo1.maven.org/maven2/org/apache/commons/commons-vfs2/2.0-SNAPSHOT/commons-vfs2-2.0-20110818.063144-26.jar";
 
- 
dest="${maven.repo.local}/org/apache/commons/commons-vfs2/2.0-SNAPSHOT/commons-vfs2-2.0-20110818.063144-26.jar"
 
+http://repo1.maven.org/maven2/org/apache/commons/commons-vfs2/2.0/commons-vfs2-2.0.jar";
 
+ 
dest="${maven.repo.local}/org/apache/commons/commons-vfs2/2.0/commons-vfs2-2.0.jar"
 
  usetimestamp="false" 
  ignoreerrors="true"/>
 

Modified: commons/proper/configuration/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/pom.xml?rev=1161249&r1=1161248&r2=1161249&view=diff
==
--- commons/proper/configuration/trunk/pom.xml (original)
+++ commons/proper/configuration/trunk/pom.xml Wed Aug 24 19:47:54 2011
@@ -258,7 +258,7 @@
 
   org.apache.commons
   commons-vfs2
-  2.0-SNAPSHOT
+  2.0
   true
 
 




svn commit: r1161181 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/analysis/integration/ site/xdoc/

2011-08-24 Thread luc
Author: luc
Date: Wed Aug 24 16:03:16 2011
New Revision: 1161181

URL: http://svn.apache.org/viewvc?rev=1161181&view=rev
Log:
Refactored integration API for consistency with solvers API.
Now the main convergence parameters are set in the constructor and remain fixed.

JIRA: MATH-501

Modified:

commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegrator.java

commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/RombergIntegrator.java

commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/SimpsonIntegrator.java

commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/TrapezoidIntegrator.java

commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegrator.java

commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegratorImpl.java
commons/proper/math/trunk/src/site/xdoc/changes.xml

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegrator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegrator.java?rev=1161181&r1=1161180&r2=1161181&view=diff
==
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegrator.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegrator.java
 Wed Aug 24 16:03:16 2011
@@ -214,8 +214,7 @@ public class LegendreGaussIntegrator ext
 
 // check convergence
 if ((iterations.getCount() + 1 >= minimalIterationCount) && (delta 
<= limit)) {
-setResult(t);
-return result;
+return t;
 }
 
 // prepare next iteration

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/RombergIntegrator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/RombergIntegrator.java?rev=1161181&r1=1161180&r2=1161181&view=diff
==
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/RombergIntegrator.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/RombergIntegrator.java
 Wed Aug 24 16:03:16 2011
@@ -131,8 +131,7 @@ public class RombergIntegrator extends U
 final double delta  = FastMath.abs(s - olds);
 final double rLimit = relativeAccuracy * (FastMath.abs(olds) + 
FastMath.abs(s)) * 0.5;
 if ((delta <= rLimit) || (delta <= absoluteAccuracy)) {
-setResult(s);
-return result;
+return s;
 }
 }
 olds = s;

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/SimpsonIntegrator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/SimpsonIntegrator.java?rev=1161181&r1=1161180&r2=1161181&view=diff
==
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/SimpsonIntegrator.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/SimpsonIntegrator.java
 Wed Aug 24 16:03:16 2011
@@ -102,10 +102,9 @@ public class SimpsonIntegrator extends U
 
 TrapezoidIntegrator qtrap = new TrapezoidIntegrator();
 if (minimalIterationCount == 1) {
-final double s = (4 * qtrap.stage(this, 1) - qtrap.stage(this, 0)) 
/ 3.0;
-setResult(s);
-return result;
+return (4 * qtrap.stage(this, 1) - qtrap.stage(this, 0)) / 3.0;
 }
+
 // Simpson's rule requires at least two trapezoid stages.
 double olds = 0;
 double oldt = qtrap.stage(this, 0);
@@ -118,8 +117,7 @@ public class SimpsonIntegrator extends U
 final double rLimit =
 relativeAccuracy * (FastMath.abs(olds) + FastMath.abs(s)) 
* 0.5;
 if ((delta <= rLimit) || (delta <= absoluteAccuracy)) {
-setResult(s);
-return result;
+return s;
 }
 }
 olds = s;

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/TrapezoidIntegrator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/com

svn commit: r1161146 - in /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection: Sandbox.java SandboxUberspectImpl.java

2011-08-24 Thread henrib
Author: henrib
Date: Wed Aug 24 15:13:39 2011
New Revision: 1161146

URL: http://svn.apache.org/viewvc?rev=1161146&view=rev
Log:
Improved usability

Modified:

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Sandbox.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/SandboxUberspectImpl.java

Modified: 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Sandbox.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Sandbox.java?rev=1161146&r1=1161145&r2=1161146&view=diff
==
--- 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Sandbox.java
 (original)
+++ 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Sandbox.java
 Wed Aug 24 15:13:39 2011
@@ -56,38 +56,113 @@ import java.util.Set;
  * 
  * @since 2.1
  */
-public class Sandbox {
+public final class Sandbox {
 /**
  * The map from class names to permissions.
  */
 private final Map sandbox;
-
+
 /**
  * Creates a new default sandbox.
  */
 public Sandbox() {
-sandbox = new HashMap();
+this(new HashMap());
 }
 
 /**
  * Creates a sandbox based on an existing permissions map.
  * @param map the permissions map
  */
-private Sandbox(Map map) {
+protected Sandbox(Map map) {
 sandbox = map;
 }
 
 /**
+ * Gets the read permission value for a given property of a class.
+ * @param clazz the class
+ * @param name the property name
+ * @return null if not allowed, the name of the property to use otherwise
+ */
+public String read(Class clazz, String name) {
+return read(clazz.getName(), name);
+}
+
+/**
+ * Gets the read permission value for a given property of a class.
+ * @param clazz the class name
+ * @param name the property name
+ * @return null if not allowed, the name of the property to use otherwise
+ */
+public String read(String clazz, String name) {
+Permissions permissions = sandbox.get(clazz);
+if (permissions == null) {
+return name;
+} else {
+return permissions.read().get(name);
+}
+}
+
+/**
+ * Gets the write permission value for a given property of a class.
+ * @param clazz the class
+ * @param name the property name
+ * @return null if not allowed, the name of the property to use otherwise
+ */
+public String write(Class clazz, String name) {
+return write(clazz.getName(), name);
+}
+
+/**
+ * Gets the write permission value for a given property of a class.
+ * @param clazz the class name
+ * @param name the property name
+ * @return null if not allowed, the name of the property to use otherwise
+ */
+public String write(String clazz, String name) {
+Permissions permissions = sandbox.get(clazz);
+if (permissions == null) {
+return name;
+} else {
+return permissions.write().get(name);
+}
+}
+
+/**
+ * Gets the execute permission value for a given method of a class.
+ * @param clazz the class
+ * @param name the method name
+ * @return null if not allowed, the name of the method to use otherwise
+ */
+public String execute(Class clazz, String name) {
+return execute(clazz.getName(), name);
+}
+
+/**
+ * Gets the execute permission value for a given method of a class.
+ * @param clazz the class name
+ * @param name the method name
+ * @return null if not allowed, the name of the method to use otherwise
+ */
+public String execute(String clazz, String name) {
+Permissions permissions = sandbox.get(clazz);
+if (permissions == null) {
+return name;
+} else {
+return permissions.execute().get(name);
+}
+}
+
+/**
  * A base set of names.
  */
 public abstract static class Names {
 /**
  * Adds a name to this set.
  * @param name the name to add
- * @return  true if the name was really added, false if it was already 
present
+ * @return  true if the name was really added, false if not
  */
 public abstract boolean add(String name);
-
+
 /**
  * Adds an alias to a name to this set.
  * This only has an effect on white lists.
@@ -104,32 +179,43 @@ public class Sandbox {
  * @param name the method/property name to check
  * @return null if not allowed, the actual name to use otherwise
  */
-public abstract String get(String name);
+public String get(String name) {
+return name;
+}
 }
+/**
+ * The pass-thru name set.
+  

svn commit: r1161145 - /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java

2011-08-24 Thread henrib
Author: henrib
Date: Wed Aug 24 15:12:30 2011
New Revision: 1161145

URL: http://svn.apache.org/viewvc?rev=1161145&view=rev
Log:
Added some coherence wrt empty string and NaN handling

Modified:

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java

Modified: 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java?rev=1161145&r1=1161144&r2=1161145&view=diff
==
--- 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
 (original)
+++ 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
 Wed Aug 24 15:12:30 2011
@@ -28,9 +28,9 @@ import java.math.MathContext;
  * All arithmetic operators (+, - , *, /, %) follow the same rules regarding 
their arguments.
  * 
  * If both are null, result is 0
+ * If either is a BigDecimal, coerce both to BigDecimal and and perform 
operation
  * If either is a floating point number, coerce both to Double and perform 
operation
  * If both are BigInteger, treat as BigInteger and perform operation
- * If either is a BigDecimal, coerce both to BigDecimal and and perform 
operation
  * Else treat as BigInteger, perform operation and attempt to narrow 
result:
  * 
  * if both arguments can be narrowed to Integer, narrow result to 
Integer
@@ -517,7 +517,7 @@ public class JexlArithmetic {
 BigInteger result = l.subtract(r);
 return narrowBigInteger(left, right, result);
 }
-
+
 /**
  * Negates a value (unary minus for numbers).
  * @param val the value to negate
@@ -703,6 +703,9 @@ public class JexlArithmetic {
 return false;
 } else if (val instanceof Boolean) {
 return ((Boolean) val).booleanValue();
+} else if (val instanceof Number) {
+double number = toDouble(val);
+return !Double.isNaN(number) && number != 0.d;
 } else if (val instanceof String) {
 return Boolean.valueOf((String) val).booleanValue();
 }
@@ -720,17 +723,23 @@ public class JexlArithmetic {
 if (val == null) {
 controlNullOperand();
 return 0;
+} else if (val instanceof Double) {
+if (!Double.isNaN((Double) val)) {
+return 0;
+} else {
+return ((Double) val).intValue();
+}
+}  else if (val instanceof Number) {
+return ((Number) val).intValue();
 } else if (val instanceof String) {
 if ("".equals(val)) {
 return 0;
 }
 return Integer.parseInt((String) val);
+} else if (val instanceof Boolean) {
+return ((Boolean) val).booleanValue() ? 1 : 0;
 } else if (val instanceof Character) {
 return ((Character) val).charValue();
-} else if (val instanceof Boolean) {
-throw new IllegalArgumentException("Boolean->Integer coercion 
exception");
-} else if (val instanceof Number) {
-return ((Number) val).intValue();
 }
 
 throw new IllegalArgumentException("Integer coercion exception. Can't 
coerce type: "
@@ -747,20 +756,27 @@ public class JexlArithmetic {
 if (val == null) {
 controlNullOperand();
 return 0L;
+} else if (val instanceof Double) {
+if (!Double.isNaN((Double) val)) {
+return 0;
+} else {
+return ((Double) val).longValue();
+}
+} else if (val instanceof Number) {
+return ((Number) val).longValue();
 } else if (val instanceof String) {
 if ("".equals(val)) {
 return 0;
+} else {
+return Long.parseLong((String) val);
 }
-return Long.parseLong((String) val);
+} else if (val instanceof Boolean) {
+return ((Boolean) val).booleanValue() ? 1L : 0L;
 } else if (val instanceof Character) {
 return ((Character) val).charValue();
-} else if (val instanceof Boolean) {
-throw new NumberFormatException("Boolean->Long coercion 
exception");
-} else if (val instanceof Number) {
-return ((Number) val).longValue();
 }
 
-throw new NumberFormatException("Long coercion exception. Can't coerce 
type: " + val.getClass().getName());
+throw new IllegalArgumentException("Long coercion exception. Can't 
coerce type: " + val.getClass().getName());
 }
 
 /**
@@ -771,20 +787,27 @@ public class JexlArithmetic {
  * @throws NullPointerException if val is null and mode is strict.
  */
 public BigInteger toBigInteger(Object val) {
-if (val instanceof BigInteger) {
-

svn commit: r1161143 - in /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2: Interpreter.java JexlEngine.java introspection/Uberspect.java introspection/UberspectImpl.java

2011-08-24 Thread henrib
Author: henrib
Date: Wed Aug 24 15:11:15 2011
New Revision: 1161143

URL: http://svn.apache.org/viewvc?rev=1161143&view=rev
Log:
Constructors wrapping in JexlMethod;
Allows to cache during interpretation and overload discovery related to 
constructor in Uberspect (for instance, using factories)

Modified:

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Uberspect.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/UberspectImpl.java

Modified: 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java?rev=1161143&r1=1161142&r2=1161143&view=diff
==
--- 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java
 (original)
+++ 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java
 Wed Aug 24 15:11:15 2011
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.jexl2;
 
-import java.lang.reflect.Constructor;
 import java.lang.reflect.Array;
 import java.lang.reflect.InvocationTargetException;
 import java.util.Collection;
@@ -335,10 +334,10 @@ public class Interpreter implements Pars
 // allow namespace to be instantiated as functor with context if 
possible, not an error otherwise
 if (namespace instanceof Class) {
 Object[] args = new Object[]{context};
-Constructor ctor = uberspect.getConstructor(namespace, args, 
node);
+JexlMethod ctor = uberspect.getConstructor(namespace, args, node);
 if (ctor != null) {
 try {
-namespace = ctor.newInstance(args);
+namespace = ctor.invoke(namespace, args);
 if (functors == null) {
 functors = new HashMap();
 }
@@ -416,10 +415,9 @@ public class Interpreter implements Pars
 
 /** {@inheritDoc} */
 public Object visit(ASTArrayAccess node, Object data) {
-// first objectNode is the identifier
+// first objectNode is the identifier
 Object object = node.jjtGetChild(0).jjtAccept(this, data);
-// can have multiple nodes - either an expression, integer literal or
-// reference
+// can have multiple nodes - either an expression, integer literal or 
reference
 int numChildren = node.jjtGetNumChildren();
 for (int i = 1; i < numChildren; i++) {
 JexlNode nindex = node.jjtGetChild(i);
@@ -855,7 +853,7 @@ public class Interpreter implements Pars
 int n = 0;
 try {
 Object result = null;
-/* first objectNode is the expression */
+/* first objectNode is the condition */
 Object expression = node.jjtGetChild(0).jjtAccept(this, data);
 if (arithmetic.toBoolean(expression)) {
 // first objectNode is true statement
@@ -1012,7 +1010,8 @@ public class Interpreter implements Pars
 }
 }
 if (xjexl == null) {
-Object eval = vm.invoke(bean, argv); // vm cannot be null if 
xjexl is null
+// vm cannot be null if xjexl is null
+Object eval = vm.invoke(bean, argv);
 // cache executor in volatile JexlNode.value
 if (cacheable && vm.isCacheable()) {
 node.jjtSetValue(vm);
@@ -1072,10 +1071,20 @@ public class Interpreter implements Pars
 }
 
 JexlException xjexl = null;
-try {
-Constructor ctor = uberspect.getConstructor(cobject, argv, 
node);
-// DG: If we can't find an exact match, narrow the parameters and
-// try again!
+try { 
+// attempt to reuse last constructor cached in volatile 
JexlNode.value
+if (cache) {
+Object cached = node.jjtGetValue();
+if (cached instanceof JexlMethod) {
+JexlMethod mctor = (JexlMethod) cached;
+Object eval = mctor.tryInvoke(null, cobject, argv);
+if (!mctor.tryFailed(eval)) {
+return eval;
+}
+}
+}
+JexlMethod ctor = uberspect.getConstructor(cobject, argv, node);
+// DG: If we can't find an exact match, narrow the parameters and 
try again
 if (ctor == null) {
 if (arithmetic.narrowArguments(argv)) {
 ctor = uberspect.getConstructor(cobject, argv, node);
@@ -1085,7 +1094,12 @@ public class Interpreter implements Pars
 }

svn commit: r1161064 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/linear/ test/java/org/apache/commons/math/linear/

2011-08-24 Thread erans
Author: erans
Date: Wed Aug 24 12:15:51 2011
New Revision: 1161064

URL: http://svn.apache.org/viewvc?rev=1161064&view=rev
Log:
MATH-646
Unmodifiable view of a vector.

Added:

commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/UnmodifiableArrayRealVectorTest.java
   (with props)

commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/UnmodifiableOpenMapRealVectorTest.java
   (with props)

commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/UnmodifiableRealVectorAbstractTest.java
   (with props)
Modified:

commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java?rev=1161064&r1=1161063&r2=1161064&view=diff
==
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
 Wed Aug 24 12:15:51 2011
@@ -631,4 +631,391 @@ public abstract class AbstractRealVector
 throw new MathUnsupportedOperationException();
 }
 }
+
+/**
+ * This class is an implementation of {@link RealVector} with read-only
+ * access.
+ * It wraps any {@link RealVector}, and exposes all methods which do not
+ * modify it. Invoking methods which should normally result in the
+ * modification of the calling {@link RealVector} results in an
+ * {@link MathUnsupportedOperationException}. It should be noted that
+ * {@link UnmodifiableVector} is not immutable.
+ */
+private static final class UnmodifiableVector implements RealVector {
+/** The vector for which an unmodifiable view is provided. */
+private final RealVector v;
+
+/**
+ * Creates a view of the given vector.
+ *
+ * @param v Vector wrapped in {@code this} view.
+ */
+public UnmodifiableVector(RealVector v) {
+this.v = v;
+}
+
+/** {@inheritDoc} */
+public RealVector mapToSelf(UnivariateRealFunction function) {
+throw new MathUnsupportedOperationException();
+}
+
+/** {@inheritDoc} */
+public RealVector map(UnivariateRealFunction function) {
+return v.map(function);
+}
+
+/** {@inheritDoc} */
+public Iterator iterator() {
+final Iterator i = v.iterator();
+return new Iterator() {
+/** The current entry. */
+private final UnmodifiableEntry e = new UnmodifiableEntry();
+
+public boolean hasNext() {
+return i.hasNext();
+}
+
+public Entry next() {
+e.setIndex(i.next().getIndex());
+return e;
+}
+
+public void remove() {
+throw new MathUnsupportedOperationException();
+}
+};
+}
+
+/** {@inheritDoc} */
+public Iterator sparseIterator() {
+final Iterator i = v.sparseIterator();
+return new Iterator() {
+/** The current entry. */
+private final UnmodifiableEntry e = new UnmodifiableEntry();
+
+public boolean hasNext() {
+return i.hasNext();
+}
+
+public Entry next() {
+e.setIndex(i.next().getIndex());
+return e;
+}
+
+public void remove() {
+throw new MathUnsupportedOperationException();
+}
+};
+}
+
+/** {@inheritDoc} */
+public RealVector copy() {
+return v.copy();
+}
+
+/** {@inheritDoc} */
+public RealVector add(RealVector w) {
+return v.add(w);
+}
+
+/** {@inheritDoc} */
+public RealVector add(double[] w) {
+return v.add(w);
+}
+
+/** {@inheritDoc} */
+public RealVector subtract(RealVector w) {
+return v.subtract(w);
+}
+
+/** {@inheritDoc} */
+public RealVector subtract(double[] w) {
+return v.subtract(w);
+}
+
+/** {@inheritDoc} */
+public RealVector mapAdd(double d) {
+return v.mapAdd(d);
+}
+
+/** {@inheritDoc} */
+public RealVector mapAddToSelf(double d) {
+throw new MathUnsupportedOperationException();
+}
+
+/** {@inheritDoc} */
+public RealVector mapSubtract(double d) {
+return v.mapSubtract(d);
+