2 // FORESTER -- software libraries and applications
3 // for evolutionary biology research and applications.
5 // Copyright (C) 2008-2009 Christian M. Zmasek
6 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 // Contact: phylosoft @ gmail . com
24 // WWW: www.phylosoft.org/forester
25 // javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
26 // ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/set_comparator.java
28 // /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
29 // org.forester.applications.set_comparator
31 package org.forester.applications;
34 import java.io.IOException;
37 import org.forester.util.ForesterUtil;
39 public class set_comparator {
41 public static void main( final String args[] ) {
43 if ( args.length != 2 ) {
44 System.out.println( "Usage: set_comparator <set A> <set B>" );
47 Set<String> set_a = ForesterUtil.file2set( new File( args[ 0 ] ) );
48 final Set<String> set_b = ForesterUtil.file2set( new File( args[ 1 ] ) );
49 System.out.println( "# A SIZE: " + set_a.size() );
50 System.out.println( "# B SIZE: " + set_b.size() );
51 set_a.retainAll( set_b );
52 System.out.println( "# INTERSECTION (" + set_a.size() + "):" );
53 for( final String s : set_a ) {
54 System.out.println( s );
56 set_a = ForesterUtil.file2set( new File( args[ 0 ] ) );
58 set_a.removeAll( set_b );
59 System.out.println( "# A ONLY (" + set_a.size() + "):" );
60 for( final String s : set_a ) {
61 System.out.println( s );
63 set_a = ForesterUtil.file2set( new File( args[ 0 ] ) );
65 set_b.removeAll( set_a );
66 System.out.println( "# B ONLY (" + set_b.size() + "):" );
67 for( final String s : set_b ) {
68 System.out.println( s );
71 catch ( final IOException e ) {