X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Futil%2FBasicTableParser.java;h=2917a3190ea7df605736cd6846f5182f40351600;hb=ebabb46561f996b5fcd59bd202defd7b189ea5b6;hp=bc369bfad1394b88f167ba82e0491da27d666032;hpb=c4cf3c01b3cbb89d98f29418444287ca8703a781;p=jalview.git diff --git a/forester/java/src/org/forester/util/BasicTableParser.java b/forester/java/src/org/forester/util/BasicTableParser.java index bc369bf..2917a31 100644 --- a/forester/java/src/org/forester/util/BasicTableParser.java +++ b/forester/java/src/org/forester/util/BasicTableParser.java @@ -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> tables = new ArrayList>(); BasicTable table = new BasicTable(); @@ -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 );