annotation things
[jalview.git] / forester / java / src / org / forester / util / BasicTableParser.java
index bc369bf..2917a31 100644 (file)
@@ -62,6 +62,9 @@ public class BasicTableParser {
                                                   final String start_of_comment_line,
                                                   final boolean tables_separated_by_single_string_line )
             throws IOException {
+        if ( use_first_separator_only && use_last_separator_only ) {
+            throw new IllegalArgumentException();
+        }
         final BufferedReader reader = ForesterUtil.obtainReader( source );
         final List<BasicTable<String>> tables = new ArrayList<BasicTable<String>>();
         BasicTable<String> table = new BasicTable<String>();
@@ -90,13 +93,13 @@ public class BasicTableParser {
                     && ( !use_start_of_comment_line || !line.startsWith( start_of_comment_line ) ) ) {
                 saw_first_table = true;
                 if ( use_last_separator_only ) {
-                    String e[] = line.split( column_delimiter );
+                    final String e[] = line.split( column_delimiter );
                     final StringBuffer rest = new StringBuffer();
-                    for( int i = 0; i < e.length - 1; ++i ) {
+                    for( int i = 0; i < ( e.length - 1 ); ++i ) {
                         rest.append( e[ i ].trim() );
                     }
-                    table.setValue( 0, row, e[ e.length - 1 ] );
-                    table.setValue( 1, row, rest.toString() );
+                    table.setValue( 0, row, rest.toString() );
+                    table.setValue( 1, row, e[ e.length - 1 ] );
                 }
                 else {
                     final StringTokenizer st = new StringTokenizer( line, column_delimiter );
@@ -117,8 +120,8 @@ public class BasicTableParser {
                         }
                     }
                 }
+                ++row;
             }
-            ++row;
         }
         if ( !table.isEmpty() ) {
             tables.add( table );