Clover coverage report - baseCode - 0.2.5 Coverage timestamp: Tue Apr 12 2005 11:31:58 EDT FRAMES NO FRAMES |
file stats: | LOC: | 63 |  | Methods: | 4
| NCLOC: | 31 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
StringConverter.java | 71.4% | 76.2% | 75% | 74.4% |

1 |  |
     package baseCode.io;
2 |  |
3 |  |
     //import org.apache.commons.lang.time.StopWatch;
4 |  |
5 |  |
     /**
6 |  |
      * @author Kiran Keshav
7 |  |
      * @author Paul Pavlidis
8 |  |
      * @version $Id: StringConverter.java,v 1.6 2005/04/08 00:23:42 pavlidis Exp $
9 |  |
      */
10 |  |
     public class StringConverter {
11 |  |
12 |  |
         private String delimiter = "\t"; // it's a regexp.
13 |  |
14 | 0 |
         public void setDelimiter( String delimiter ) {
15 | 0 |
             this.delimiter = delimiter;
16 |  |
         }
17 |  |
18 |  |
         /**
19 |  |
          * @param stringToParse
20 |  |
          * @return double[]
21 |  |
          */
22 | 8 |
         public double[] StringToDoubles( String stringToParse ) {
23 | 1 |
             if ( stringToParse == null ) return null;
24 | 7 |
             String[] sArray = stringToParse.split( delimiter );
25 | 7 |
             double[] result = new double[sArray.length];
26 | 7 |
             for ( int i = 0; i < sArray.length; i++ ) {
27 | 6667556 |
                 result[i] = Double.parseDouble( sArray[i] );
28 |  |
             }
29 |  |
30 | 7 |
             return result;
31 |  |
         }
32 |  |
33 |  |
         /**
34 |  |
          * Convert a double array to a delimited string.
35 |  |
          *
36 |  |
          * @param arrayToConvert
37 |  |
          * @return
38 |  |
          */
39 | 1 |
         public String DoubleArrayToString( double[] arrayToConvert ) {
40 | 0 |
             if ( arrayToConvert == null ) return null;
41 | 1 |
             StringBuffer buf = new StringBuffer();
42 | 1 |
             for ( int i = 0; i < arrayToConvert.length; i++ ) {
43 | 952508 |
                 buf.append( arrayToConvert[i] );
44 | 952507 |
                 if ( i > 0 ) buf.append( delimiter );
45 |  |
             }
46 |  |
47 | 1 |
             return buf.toString();
48 |  |
         }
49 |  |
50 |  |
         /**
51 |  |
          * FIXME this is broken.
52 |  |
          *
53 |  |
          * @param stringToConvert
54 |  |
          * @return byte[]
55 |  |
          */
56 | 1 |
         public byte[] StringArrayToBytes( String[] stringsToConvert ) {
57 | 1 |
             if ( stringsToConvert == null ) return null;
58 | 0 |
             for ( int i = 0; i < stringsToConvert.length; i++ ) {
59 | 0 |
                 String s = stringsToConvert[i];
60 |  |
             }
61 | 0 |
             return null;
62 |  |
         }
63 |  |
     }