clean up
[jalview.git] / forester / java / src / org / forester / pccx / ExternalNodeBasedCoverageMethodOptions.java
1 // $Id:
2 // cmzmasek Exp $
3 // FORESTER -- software libraries and applications
4 // for evolutionary biology research and applications.
5 //
6 // Copyright (C) 2008-2009 Christian M. Zmasek
7 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
8 // All rights reserved
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 //
24 // Contact: phylosoft @ gmail . com
25 // WWW: www.phylosoft.org/forester
26
27 package org.forester.pccx;
28
29 public class ExternalNodeBasedCoverageMethodOptions implements CoverageCalculationOptions {
30
31     final private String _scoring_method;
32
33     /**
34      * This constructor sets the class name for the scoring method e.g.
35      * "org.forester.tools.modeling.BranchCountingBasedScoringMethod"
36      * 
37      * @param scoring_method
38      *            class name for the scoring method
39      */
40     public ExternalNodeBasedCoverageMethodOptions( final String scoring_method ) {
41         _scoring_method = scoring_method;
42     }
43
44     @Override
45     public String asString() {
46         final StringBuffer sb = new StringBuffer();
47         sb.append( "scoring method: " );
48         BranchCountingBasedScoringMethod scoring_method;
49         try {
50             scoring_method = ( BranchCountingBasedScoringMethod ) ( Class.forName( getScoringMethod() ) ).newInstance();
51         }
52         catch ( final Exception e ) {
53             sb.append( "?" );
54             return sb.toString();
55         }
56         sb.append( scoring_method.getDesciption() );
57         return sb.toString();
58     }
59
60     public String getScoringMethod() {
61         return _scoring_method;
62     }
63 }