commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1042422 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/analysis/polynomials/ main/java/org/apache/commons/math/dfp/ main/java/org/apache/commons/math/random/ main/java/org/apache/commons/math/stat/ main/java/org/apa...
Date Sun, 05 Dec 2010 19:25:21 GMT
Author: sebb
Date: Sun Dec  5 19:25:21 2010
New Revision: 1042422

URL: http://svn.apache.org/viewvc?rev=1042422&view=rev
Log:
StringBuffer => StringBuilder for local variables

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/DfpMath.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/Frequency.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/EuclideanIntegerPoint.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/CompositeFormat.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/TestUtils.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomDataTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java?rev=1042422&r1=1042421&r2=1042422&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
Sun Dec  5 19:25:21 2010
@@ -281,7 +281,7 @@ public class PolynomialFunction implemen
     @Override
      public String toString() {
 
-       StringBuffer s = new StringBuffer();
+       StringBuilder s = new StringBuilder();
        if (coefficients[0] == 0.0) {
          if (coefficients.length == 1) {
            return "0";

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/DfpMath.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/DfpMath.java?rev=1042422&r1=1042421&r2=1042422&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/DfpMath.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/DfpMath.java Sun Dec
 5 19:25:21 2010
@@ -359,14 +359,14 @@ public class DfpMath {
         // X is now in the range of 2/3 < x < 4/3
         Dfp[] spz = logInternal(spx);
 
-        spx[0] = a.newInstance(new StringBuffer().append(p2+4*lr).toString());
+        spx[0] = a.newInstance(new StringBuilder().append(p2+4*lr).toString());
         spx[1] = a.getZero();
         spy = splitMult(a.getField().getLn2Split(), spx);
 
         spz[0] = spz[0].add(spy[0]);
         spz[1] = spz[1].add(spy[1]);
 
-        spx[0] = a.newInstance(new StringBuffer().append(4*lr).toString());
+        spx[0] = a.newInstance(new StringBuilder().append(4*lr).toString());
         spx[1] = a.getZero();
         spy = splitMult(a.getField().getLn5Split(), spx);
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java?rev=1042422&r1=1042421&r2=1042422&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java
Sun Dec  5 19:25:21 2010
@@ -159,7 +159,7 @@ public class RandomDataImpl implements R
         RandomGenerator ran = getRan();
 
         // Initialize output buffer
-        StringBuffer outBuffer = new StringBuffer();
+        StringBuilder outBuffer = new StringBuilder();
 
         // Get int(len/2)+1 random bytes
         byte[] randomBytes = new byte[(len / 2) + 1];
@@ -265,7 +265,7 @@ public class RandomDataImpl implements R
         // Compute number of iterations required (40 bytes each)
         int numIter = (len / 40) + 1;
 
-        StringBuffer outBuffer = new StringBuffer();
+        StringBuilder outBuffer = new StringBuilder();
         for (int iter = 1; iter < numIter + 1; iter++) {
             byte[] randomBytes = new byte[40];
             secRan.nextBytes(randomBytes);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/Frequency.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/Frequency.java?rev=1042422&r1=1042421&r2=1042422&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/Frequency.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/Frequency.java Sun
Dec  5 19:25:21 2010
@@ -80,7 +80,7 @@ public class Frequency implements Serial
     @Override
     public String toString() {
         NumberFormat nf = NumberFormat.getPercentInstance();
-        StringBuffer outBuffer = new StringBuffer();
+        StringBuilder outBuffer = new StringBuilder();
         outBuffer.append("Value \t Freq. \t Pct. \t Cum Pct. \n");
         Iterator<Comparable<?>> iter = freqTable.keySet().iterator();
         while (iter.hasNext()) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/EuclideanIntegerPoint.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/EuclideanIntegerPoint.java?rev=1042422&r1=1042421&r2=1042422&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/EuclideanIntegerPoint.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/EuclideanIntegerPoint.java
Sun Dec  5 19:25:21 2010
@@ -105,7 +105,7 @@ public class EuclideanIntegerPoint imple
      */
     @Override
     public String toString() {
-        final StringBuffer buff = new StringBuffer("(");
+        final StringBuilder buff = new StringBuilder("(");
         final int[] coordinates = getPoint();
         for (int i = 0; i < coordinates.length; i++) {
             buff.append(coordinates[i]);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java?rev=1042422&r1=1042421&r2=1042422&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java
Sun Dec  5 19:25:21 2010
@@ -409,7 +409,7 @@ public class DescriptiveStatistics imple
      */
     @Override
     public String toString() {
-        StringBuffer outBuffer = new StringBuffer();
+        StringBuilder outBuffer = new StringBuilder();
         String endl = "\n";
         outBuffer.append("DescriptiveStatistics:").append(endl);
         outBuffer.append("n: ").append(getN()).append(endl);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java?rev=1042422&r1=1042421&r2=1042422&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java
Sun Dec  5 19:25:21 2010
@@ -307,7 +307,7 @@ public class MultivariateSummaryStatisti
     public String toString() {
         final String separator = ", ";
         final String suffix = System.getProperty("line.separator");
-        StringBuffer outBuffer = new StringBuffer();
+        StringBuilder outBuffer = new StringBuilder();
         outBuffer.append("MultivariateSummaryStatistics:" + suffix);
         outBuffer.append("n: " + getN() + suffix);
         append(outBuffer, getMin(), "min: ", separator, suffix);
@@ -329,7 +329,7 @@ public class MultivariateSummaryStatisti
      * @param separator elements separator
      * @param suffix text suffix
      */
-    private void append(StringBuffer buffer, double[] data,
+    private void append(StringBuilder buffer, double[] data,
                         String prefix, String separator, String suffix) {
         buffer.append(prefix);
         for (int i = 0; i < data.length; ++i) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java?rev=1042422&r1=1042421&r2=1042422&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java
Sun Dec  5 19:25:21 2010
@@ -309,7 +309,7 @@ public class SummaryStatistics implement
      */
     @Override
     public String toString() {
-        StringBuffer outBuffer = new StringBuffer();
+        StringBuilder outBuffer = new StringBuilder();
         String endl = "\n";
         outBuffer.append("SummaryStatistics:").append(endl);
         outBuffer.append("n: ").append(getN()).append(endl);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/CompositeFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/CompositeFormat.java?rev=1042422&r1=1042421&r2=1042422&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/CompositeFormat.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/CompositeFormat.java
Sun Dec  5 19:25:21 2010
@@ -109,7 +109,7 @@ public abstract class CompositeFormat ex
                                final ParsePosition pos) {
         Number ret = null;
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append('(');
         sb.append(value);
         sb.append(')');

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/TestUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/TestUtils.java?rev=1042422&r1=1042421&r2=1042422&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/TestUtils.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/TestUtils.java Sun Dec
 5 19:25:21 2010
@@ -264,7 +264,7 @@ public class TestUtils {
 
         if (expected.getColumnDimension() != observed.getColumnDimension() ||
                 expected.getRowDimension() != observed.getRowDimension()) {
-            StringBuffer messageBuffer = new StringBuffer(msg);
+            StringBuilder messageBuffer = new StringBuilder(msg);
             messageBuffer.append("\nObserved has incorrect dimensions.");
             messageBuffer.append("\nobserved is " + observed.getRowDimension() +
                     " x " + observed.getColumnDimension());
@@ -275,7 +275,7 @@ public class TestUtils {
 
         RealMatrix delta = expected.subtract(observed);
         if (delta.getNorm() >= tolerance) {
-            StringBuffer messageBuffer = new StringBuffer(msg);
+            StringBuilder messageBuffer = new StringBuilder(msg);
             messageBuffer.append("\nExpected: " + expected);
             messageBuffer.append("\nObserved: " + observed);
             messageBuffer.append("\nexpected - observed: " + delta);
@@ -291,7 +291,7 @@ public class TestUtils {
 
         if (expected.getColumnDimension() != observed.getColumnDimension() ||
                 expected.getRowDimension() != observed.getRowDimension()) {
-            StringBuffer messageBuffer = new StringBuffer();
+            StringBuilder messageBuffer = new StringBuilder();
             messageBuffer.append("Observed has incorrect dimensions.");
             messageBuffer.append("\nobserved is " + observed.getRowDimension() +
                     " x " + observed.getColumnDimension());
@@ -312,7 +312,7 @@ public class TestUtils {
     /** verifies that two arrays are close (sup norm) */
     public static void assertEquals(String msg, double[] expected, double[] observed,
         double tolerance) {
-        StringBuffer out = new StringBuffer(msg);
+        StringBuilder out = new StringBuilder(msg);
         if (expected.length != observed.length) {
             out.append("\n Arrays not same length. \n");
             out.append("expected has length ");
@@ -382,7 +382,7 @@ public class TestUtils {
             // Fail if we can reject null hypothesis that distributions are the same
             Assert.assertFalse(chiSquareTest.chiSquareTest(expected, observed, alpha));
         } catch (AssertionFailedError ex) {
-            StringBuffer msgBuffer = new StringBuffer();
+            StringBuilder msgBuffer = new StringBuilder();
             DecimalFormat df = new DecimalFormat("#.##");
             msgBuffer.append("Chisquare test failed");
             msgBuffer.append(" p-value = ");

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomDataTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomDataTest.java?rev=1042422&r1=1042421&r2=1042422&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomDataTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomDataTest.java
Sun Dec  5 19:25:21 2010
@@ -355,7 +355,7 @@ public class RandomDataTest extends Retr
             // Fail if we can reject null hypothesis that distributions are the same
             assertFalse(chiSquareTest.chiSquareTest(expected, observed, alpha));
         } catch (AssertionFailedError ex) {
-            StringBuffer msgBuffer = new StringBuffer();
+            StringBuilder msgBuffer = new StringBuilder();
             DecimalFormat df = new DecimalFormat("#.##");
             msgBuffer.append("Chisquare test failed for mean = ");
             msgBuffer.append(mean);



Mime
View raw message