+ br = iter.next();
+ if ( !br.getFirstNode().getName().equals( "abc" ) && !br.getFirstNode().getName().equals( "cc" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "abc" ) && !br.getSecondNode().getName().equals( "cc" ) ) {
+ return false;
+ }
+ br = iter.next();
+ if ( !br.getFirstNode().getName().equals( "C1" ) && !br.getFirstNode().getName().equals( "cc" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "C1" ) && !br.getSecondNode().getName().equals( "cc" ) ) {
+ return false;
+ }
+ br = iter.next();
+ if ( !br.getFirstNode().getName().equals( "C2" ) && !br.getFirstNode().getName().equals( "cc" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "C2" ) && !br.getSecondNode().getName().equals( "cc" ) ) {
+ return false;
+ }
+ br = iter.next();
+ if ( !br.getFirstNode().getName().equals( "abc" ) && !br.getFirstNode().getName().equals( "cc" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "abc" ) && !br.getSecondNode().getName().equals( "cc" ) ) {
+ return false;
+ }
+ br = iter.next();
+ if ( !br.getFirstNode().getName().equals( "abc" ) && !br.getFirstNode().getName().equals( "abcd" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "abc" ) && !br.getSecondNode().getName().equals( "abcd" ) ) {
+ return false;
+ }
+ br = iter.next();
+ if ( !br.getFirstNode().getName().equals( "abcd" ) && !br.getFirstNode().getName().equals( "D" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "abcd" ) && !br.getSecondNode().getName().equals( "D" ) ) {
+ return false;
+ }
+ br = iter.next();
+ if ( !br.getFirstNode().getName().equals( "ef" ) && !br.getFirstNode().getName().equals( "abcd" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "ef" ) && !br.getSecondNode().getName().equals( "abcd" ) ) {
+ return false;
+ }
+ br = iter.next();
+ if ( !br.getFirstNode().getName().equals( "ef" ) && !br.getFirstNode().getName().equals( "E" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "ef" ) && !br.getSecondNode().getName().equals( "E" ) ) {
+ return false;
+ }
+ br = iter.next();
+ if ( !br.getFirstNode().getName().equals( "ef" ) && !br.getFirstNode().getName().equals( "F" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "ef" ) && !br.getSecondNode().getName().equals( "F" ) ) {
+ return false;
+ }
+ if ( iter.hasNext() ) {
+ return false;
+ }
+ final Phylogeny p1 = factory.create( "(C,(A,B)ab)abc", new NHXParser() )[ 0 ];
+ final List<PhylogenyBranch> l1 = SDIR.getBranchesInPreorder( p1 );
+ final Iterator<PhylogenyBranch> iter1 = l1.iterator();
+ br = iter1.next();
+ if ( !br.getFirstNode().getName().equals( "ab" ) && !br.getFirstNode().getName().equals( "C" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "ab" ) && !br.getSecondNode().getName().equals( "C" ) ) {
+ return false;
+ }
+ br = iter1.next();
+ if ( !br.getFirstNode().getName().equals( "ab" ) && !br.getFirstNode().getName().equals( "A" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "ab" ) && !br.getSecondNode().getName().equals( "A" ) ) {
+ return false;
+ }
+ br = iter1.next();
+ if ( !br.getFirstNode().getName().equals( "ab" ) && !br.getFirstNode().getName().equals( "B" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "ab" ) && !br.getSecondNode().getName().equals( "B" ) ) {
+ return false;
+ }
+ if ( iter1.hasNext() ) {
+ return false;
+ }
+ final Phylogeny p2 = factory.create( "((A,B)ab,C)abc", new NHXParser() )[ 0 ];
+ final List<PhylogenyBranch> l2 = SDIR.getBranchesInPreorder( p2 );
+ final Iterator<PhylogenyBranch> iter2 = l2.iterator();
+ br = iter2.next();
+ if ( !br.getFirstNode().getName().equals( "ab" ) && !br.getFirstNode().getName().equals( "C" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "ab" ) && !br.getSecondNode().getName().equals( "C" ) ) {
+ return false;
+ }
+ br = iter2.next();
+ if ( !br.getFirstNode().getName().equals( "ab" ) && !br.getFirstNode().getName().equals( "A" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "ab" ) && !br.getSecondNode().getName().equals( "A" ) ) {
+ return false;
+ }
+ br = iter2.next();
+ if ( !br.getFirstNode().getName().equals( "ab" ) && !br.getFirstNode().getName().equals( "B" ) ) {
+ return false;
+ }
+ if ( !br.getSecondNode().getName().equals( "ab" ) && !br.getSecondNode().getName().equals( "B" ) ) {
+ return false;
+ }
+ if ( iter2.hasNext() ) {
+ return false;
+ }
+ final Phylogeny species0 = factory
+ .create( "(((([&&NHX:S=A],[&&NHX:S=B]),[&&NHX:S=C]),[&&NHX:S=D]),([&&NHX:S=E],[&&NHX:S=F]))",
+ new NHXParser() )[ 0 ];
+ final Phylogeny gene1 = factory
+ .create( "(((((A:0.6[&&NHX:S=A],B:0.1[&&NHX:S=B])ab:0.1,C:0.1[&&NHX:S=C])abc:0.3,D:1.0[&&NHX:S=D])abcd:0.2,E:0.1[&&NHX:S=E])abcde:0.2,F:0.2[&&NHX:S=F])",
+ new NHXParser() )[ 0 ];
+ species0.setRooted( true );
+ gene1.setRooted( true );
+ final SDIR sdi_unrooted = new SDIR();
+ sdi_unrooted.infer( gene1, species0, false, true, true, true, 10 );
+ if ( sdi_unrooted.getCount() != 1 ) {
+ return false;
+ }
+ if ( sdi_unrooted.getMinimalDuplications() != 0 ) {
+ return false;
+ }
+ if ( !Test.isEqual( sdi_unrooted.getMinimalDiffInSubTreeHeights(), 0.4 ) ) {
+ return false;
+ }
+ if ( !Test.isEqual( sdi_unrooted.getMinimalTreeHeight(), 1.0 ) ) {
+ return false;
+ }
+ if ( sdi_unrooted.getMinimalMappingCost() != Integer.MAX_VALUE ) {
+ return false;
+ }
+ final Phylogeny gene2 = factory
+ .create( "(((((A:2.6[&&NHX:S=A],B:0.1[&&NHX:S=B])ab:0.1,C:0.1[&&NHX:S=C])abc:0.3,D:1.0[&&NHX:S=D])abcd:0.2,E:0.1[&&NHX:S=E])abcde:0.2,F:0.2[&&NHX:S=F])",
+ new NHXParser() )[ 0 ];
+ gene2.setRooted( true );
+ sdi_unrooted.infer( gene2, species0, false, false, true, true, 10 );
+ if ( sdi_unrooted.getCount() != 1 ) {
+ return false;
+ }
+ if ( sdi_unrooted.getMinimalDuplications() != 3 ) {
+ return false;
+ }
+ if ( !Test.isEqual( sdi_unrooted.getMinimalDiffInSubTreeHeights(), 0.0 ) ) {
+ return false;
+ }
+ if ( !Test.isEqual( sdi_unrooted.getMinimalTreeHeight(), 2.0 ) ) {
+ return false;
+ }
+ if ( sdi_unrooted.getMinimalMappingCost() != Integer.MAX_VALUE ) {
+ return false;
+ }
+ final Phylogeny species6 = factory
+ .create( "(((1:[&&NHX:S=1],5:[&&NHX:S=5])1-5,((4:[&&NHX:S=4],6:[&&NHX:S=6])4-6,2:[&&NHX:S=2])4-6-2)1-5-4-6-2,"
+ + "((9:[&&NHX:S=9],3:[&&NHX:S=3])9-3,(8:[&&NHX:S=8],7:[&&NHX:S=7])8-7)9-3-8-7)",
+ new NHXParser() )[ 0 ];
+ final Phylogeny gene6 = factory
+ .create( "((5:0.1[&&NHX:S=5],6:0.1[&&NHX:S=6])5-6:0.05[&&NHX:S=6],(4:0.1[&&NHX:S=4],"
+ + "(((1:0.1[&&NHX:S=1],2:0.1[&&NHX:S=2])1-2:0.1[&&NHX:S=2],3:0.25[&&NHX:S=3])1-2-3:0.2[&&NHX:S=2],"
+ + "(7:0.1[&&NHX:S=7],(8:0.1[&&NHX:S=8],"
+ + "9:0.1[&&NHX:S=9])8-9:0.1[&&NHX:S=9])7-8-9:0.1[&&NHX:S=8])"
+ + "4-5-6-7-8-9:0.1[&&NHX:S=5])4-5-6:0.05[&&NHX:S=5])",
+ new NHXParser() )[ 0 ];
+ species6.setRooted( true );
+ gene6.setRooted( true );
+ Phylogeny[] p6 = sdi_unrooted.infer( gene6, species6, false, true, true, true, 10 );
+ if ( sdi_unrooted.getCount() != 1 ) {
+ return false;
+ }
+ if ( !Test.isEqual( sdi_unrooted.getMinimalDiffInSubTreeHeights(), 0.0 ) ) {
+ return false;
+ }
+ if ( !Test.isEqual( sdi_unrooted.getMinimalTreeHeight(), 0.375 ) ) {
+ return false;
+ }
+ if ( sdi_unrooted.getMinimalDuplications() != 3 ) {
+ return false;
+ }
+ if ( sdi_unrooted.getMinimalMappingCost() != Integer.MAX_VALUE ) {
+ return false;
+ }
+ if ( !p6[ 0 ].getRoot().isDuplication() ) {
+ return false;
+ }
+ if ( !p6[ 0 ].getNode( "4-5-6" ).isDuplication() ) {
+ return false;
+ }
+ if ( !p6[ 0 ].getNode( "7-8-9" ).isDuplication() ) {
+ return false;
+ }
+ if ( p6[ 0 ].getNode( "1-2" ).isDuplication() ) {
+ return false;
+ }
+ if ( p6[ 0 ].getNode( "1-2-3" ).isDuplication() ) {
+ return false;
+ }
+ if ( p6[ 0 ].getNode( "5-6" ).isDuplication() ) {
+ return false;
+ }
+ if ( p6[ 0 ].getNode( "8-9" ).isDuplication() ) {
+ return false;
+ }
+ if ( p6[ 0 ].getNode( "4-5-6-7-8-9" ).isDuplication() ) {
+ return false;
+ }
+ p6 = null;
+ final Phylogeny species7 = factory
+ .create( "(((1:[&&NHX:S=1],5:[&&NHX:S=5])1-5,((4:[&&NHX:S=4],6:[&&NHX:S=6])4-6,2:[&&NHX:S=2])4-6-2)1-5-4-6-2,"
+ + "((9:[&&NHX:S=9],3:[&&NHX:S=3])9-3,(8:[&&NHX:S=8],7:[&&NHX:S=7])8-7)9-3-8-7)",
+ new NHXParser() )[ 0 ];
+ final Phylogeny gene7 = factory
+ .create( "((5:0.1[&&NHX:S=5],6:0.1[&&NHX:S=6])5-6:0.05[&&NHX:S=6],(4:0.1[&&NHX:S=4],"
+ + "(((1:0.1[&&NHX:S=1],2:0.1[&&NHX:S=2])1-2:0.1[&&NHX:S=2],3:0.25[&&NHX:S=3])1-2-3:0.2[&&NHX:S=2],"
+ + "(7:0.1[&&NHX:S=7],(8:0.1[&&NHX:S=8],"
+ + "9:0.1[&&NHX:S=9])8-9:0.1[&&NHX:S=9])7-8-9:0.1[&&NHX:S=8])"
+ + "4-5-6-7-8-9:0.1[&&NHX:S=5])4-5-6:0.05[&&NHX:S=5])",
+ new NHXParser() )[ 0 ];
+ species7.setRooted( true );
+ gene7.setRooted( true );
+ Phylogeny[] p7 = sdi_unrooted.infer( gene7, species7, true, true, true, true, 10 );
+ if ( sdi_unrooted.getCount() != 1 ) {
+ return false;
+ }
+ if ( !Test.isEqual( sdi_unrooted.getMinimalDiffInSubTreeHeights(), 0.0 ) ) {
+ return false;
+ }
+ if ( !Test.isEqual( sdi_unrooted.getMinimalTreeHeight(), 0.375 ) ) {
+ return false;
+ }
+ if ( sdi_unrooted.getMinimalDuplications() != 3 ) {
+ return false;
+ }
+ if ( sdi_unrooted.getMinimalMappingCost() != 17 ) {
+ return false;
+ }
+ if ( !p7[ 0 ].getRoot().isDuplication() ) {
+ return false;
+ }
+ if ( !p7[ 0 ].getNode( "4-5-6" ).isDuplication() ) {
+ return false;
+ }
+ if ( !p7[ 0 ].getNode( "7-8-9" ).isDuplication() ) {
+ return false;
+ }
+ if ( p7[ 0 ].getNode( "1-2" ).isDuplication() ) {
+ return false;
+ }
+ if ( p7[ 0 ].getNode( "1-2-3" ).isDuplication() ) {
+ return false;
+ }
+ if ( p7[ 0 ].getNode( "5-6" ).isDuplication() ) {
+ return false;
+ }
+ if ( p7[ 0 ].getNode( "8-9" ).isDuplication() ) {
+ return false;
+ }
+ if ( p7[ 0 ].getNode( "4-5-6-7-8-9" ).isDuplication() ) {
+ return false;
+ }
+ p7 = null;
+ final Phylogeny species8 = factory
+ .create( "(((1:[&&NHX:S=1],5:[&&NHX:S=5])1-5,((4:[&&NHX:S=4],6:[&&NHX:S=6])4-6,2:[&&NHX:S=2])4-6-2)1-5-4-6-2,"
+ + "((9:[&&NHX:S=9],3:[&&NHX:S=3])9-3,(8:[&&NHX:S=8],7:[&&NHX:S=7])8-7)9-3-8-7)",
+ new NHXParser() )[ 0 ];
+ final Phylogeny gene8 = factory
+ .create( "((5:0.1[&&NHX:S=5],6:0.1[&&NHX:S=6])5-6:0.05[&&NHX:S=6],(4:0.1[&&NHX:S=4],"
+ + "(((1:0.1[&&NHX:S=1],2:0.1[&&NHX:S=2])1-2:0.1[&&NHX:S=2],3:0.25[&&NHX:S=3])1-2-3:0.2[&&NHX:S=2],"
+ + "(7:0.1[&&NHX:S=7],(8:0.1[&&NHX:S=8],"
+ + "9:0.1[&&NHX:S=9])8-9:0.1[&&NHX:S=9])7-8-9:0.1[&&NHX:S=8])"
+ + "4-5-6-7-8-9:0.1[&&NHX:S=5])4-5-6:0.05[&&NHX:S=5])",
+ new NHXParser() )[ 0 ];
+ species8.setRooted( true );
+ gene8.setRooted( true );
+ Phylogeny[] p8 = sdi_unrooted.infer( gene8, species8, false, false, true, true, 10 );
+ if ( sdi_unrooted.getCount() != 1 ) {
+ return false;
+ }
+ if ( !Test.isEqual( sdi_unrooted.getMinimalDiffInSubTreeHeights(), 0.0 ) ) {
+ return false;
+ }
+ if ( !Test.isEqual( sdi_unrooted.getMinimalTreeHeight(), 0.375 ) ) {
+ return false;
+ }
+ if ( sdi_unrooted.getMinimalDuplications() != 3 ) {
+ return false;
+ }
+ if ( sdi_unrooted.getMinimalMappingCost() != Integer.MAX_VALUE ) {
+ return false;
+ }
+ if ( !p8[ 0 ].getRoot().isDuplication() ) {
+ return false;
+ }
+ if ( !p8[ 0 ].getNode( "4-5-6" ).isDuplication() ) {
+ return false;
+ }
+ if ( !p8[ 0 ].getNode( "7-8-9" ).isDuplication() ) {
+ return false;
+ }
+ if ( p8[ 0 ].getNode( "1-2" ).isDuplication() ) {
+ return false;
+ }
+ if ( p8[ 0 ].getNode( "1-2-3" ).isDuplication() ) {
+ return false;
+ }
+ if ( p8[ 0 ].getNode( "5-6" ).isDuplication() ) {
+ return false;
+ }
+ if ( p8[ 0 ].getNode( "8-9" ).isDuplication() ) {
+ return false;
+ }
+ if ( p8[ 0 ].getNode( "4-5-6-7-8-9" ).isDuplication() ) {
+ return false;
+ }
+ p8 = null;
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace( System.out );
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean testSequenceIdParsing() {
+ try {
+ Accession id = SequenceAccessionTools.parseAccessorFromString( "gb_ADF31344_segmented_worms_" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() )
+ || !id.getValue().equals( "ADF31344" ) || !id.getSource().equals( "ncbi" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getSource() );
+ }
+ return false;
+ }
+ //
+ id = SequenceAccessionTools.parseAccessorFromString( "segmented worms|gb_ADF31344" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() )
+ || !id.getValue().equals( "ADF31344" ) || !id.getSource().equals( "ncbi" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getSource() );
+ }
+ return false;
+ }
+ //
+ id = SequenceAccessionTools.parseAccessorFromString( "segmented worms gb_ADF31344 and more" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() )
+ || !id.getValue().equals( "ADF31344" ) || !id.getSource().equals( "ncbi" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getSource() );
+ }
+ return false;
+ }
+ //
+ id = SequenceAccessionTools.parseAccessorFromString( "gb_AAA96518_1" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() )
+ || !id.getValue().equals( "AAA96518" ) || !id.getSource().equals( "ncbi" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getSource() );
+ }
+ return false;
+ }
+ //
+ id = SequenceAccessionTools.parseAccessorFromString( "gb_EHB07727_1_rodents_" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() )
+ || !id.getValue().equals( "EHB07727" ) || !id.getSource().equals( "ncbi" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getSource() );
+ }
+ return false;
+ }
+ //
+ id = SequenceAccessionTools.parseAccessorFromString( "dbj_BAF37827_1_turtles_" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() )
+ || !id.getValue().equals( "BAF37827" ) || !id.getSource().equals( "ncbi" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getSource() );
+ }
+ return false;
+ }
+ //
+ id = SequenceAccessionTools.parseAccessorFromString( "emb_CAA73223_1_primates_" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() )
+ || !id.getValue().equals( "CAA73223" ) || !id.getSource().equals( "ncbi" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getSource() );
+ }
+ return false;
+ }
+ //
+ id = SequenceAccessionTools.parseAccessorFromString( "mites|ref_XP_002434188_1" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() )
+ || !id.getValue().equals( "XP_002434188" ) || !id.getSource().equals( "refseq" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getSource() );
+ }
+ return false;
+ }
+ //
+ id = SequenceAccessionTools.parseAccessorFromString( "mites_ref_XP_002434188_1_bla_XP_12345" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() )
+ || !id.getValue().equals( "XP_002434188" ) || !id.getSource().equals( "refseq" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getSource() );
+ }
+ return false;
+ }
+ //
+ id = SequenceAccessionTools.parseAccessorFromString( "P4A123" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getSource() )
+ || !id.getValue().equals( "P4A123" ) || !id.getSource().equals( "uniprot" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getSource() );
+ }
+ return false;
+ }
+ id = SequenceAccessionTools.parseAccessorFromString( "XP_12345" );
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getSource() );
+ return false;
+ }
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace( System.out );
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean testSequenceWriter() {
+ try {
+ final String n = ForesterUtil.LINE_SEPARATOR;
+ if ( !SequenceWriter.toFasta( "name", "awes", 5 ).toString().equals( ">name" + n + "awes" ) ) {
+ return false;
+ }
+ if ( !SequenceWriter.toFasta( "name", "awes", 4 ).toString().equals( ">name" + n + "awes" ) ) {
+ return false;
+ }
+ if ( !SequenceWriter.toFasta( "name", "awes", 3 ).toString().equals( ">name" + n + "awe" + n + "s" ) ) {
+ return false;
+ }
+ if ( !SequenceWriter.toFasta( "name", "awes", 2 ).toString().equals( ">name" + n + "aw" + n + "es" ) ) {
+ return false;
+ }
+ if ( !SequenceWriter.toFasta( "name", "awes", 1 ).toString()
+ .equals( ">name" + n + "a" + n + "w" + n + "e" + n + "s" ) ) {
+ return false;
+ }
+ if ( !SequenceWriter.toFasta( "name", "abcdefghij", 3 ).toString()
+ .equals( ">name" + n + "abc" + n + "def" + n + "ghi" + n + "j" ) ) {
+ return false;
+ }
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace();
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean testSpecies() {
+ try {
+ final Species s1 = new BasicSpecies( "a" );
+ final Species s2 = new BasicSpecies( "a" );
+ final Species s3 = new BasicSpecies( "A" );
+ final Species s4 = new BasicSpecies( "b" );
+ if ( !s1.equals( s1 ) ) {
+ return false;
+ }
+ if ( s1.getSpeciesId().equals( "x" ) ) {
+ return false;
+ }
+ if ( s1.getSpeciesId().equals( null ) ) {
+ return false;
+ }
+ if ( !s1.equals( s2 ) ) {
+ return false;
+ }
+ if ( s1.equals( s3 ) ) {
+ return false;
+ }
+ if ( s1.hashCode() != s1.hashCode() ) {
+ return false;
+ }
+ if ( s1.hashCode() != s2.hashCode() ) {
+ return false;
+ }
+ if ( s1.hashCode() == s3.hashCode() ) {
+ return false;
+ }
+ if ( s1.compareTo( s1 ) != 0 ) {
+ return false;
+ }
+ if ( s1.compareTo( s2 ) != 0 ) {
+ return false;
+ }
+ if ( s1.compareTo( s3 ) != 0 ) {
+ return false;
+ }
+ if ( s1.compareTo( s4 ) >= 0 ) {
+ return false;
+ }
+ if ( s4.compareTo( s1 ) <= 0 ) {
+ return false;
+ }
+ if ( !s4.getSpeciesId().equals( "b" ) ) {
+ return false;
+ }
+ final Species s5 = new BasicSpecies( " C " );
+ if ( !s5.getSpeciesId().equals( "C" ) ) {
+ return false;
+ }
+ if ( s5.equals( s1 ) ) {
+ return false;
+ }
+ }
+ catch ( final Exception e ) {