001/**
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 * Created on Apr 24, 2012
021 * Created by Andreas Prlic
022 *
023 * @since 3.0.2
024 */
025package org.biojava.nbio.structure.align.ce;
026
027import org.biojava.nbio.structure.align.StructureAlignment;
028import org.biojava.nbio.structure.align.ce.CECPParameters.DuplicationHint;
029
030public class CeCPUserArgumentProcessor extends CeUserArgumentProcessor {
031
032        protected class CeCPStartupParams extends CeStartupParams {
033                protected DuplicationHint duplicationHint;
034                protected Integer minCPLength;
035
036                public CeCPStartupParams() {
037                        duplicationHint = DuplicationHint.SHORTER;
038                        minCPLength = CECPParameters.DEFAULT_MIN_CP_LENGTH;
039                        maxGapSize = 0;
040                }
041
042                public DuplicationHint getDuplicationHint() {
043                        return duplicationHint;
044                }
045
046                public void setDuplicationHint(DuplicationHint duplicationHint) {
047                        this.duplicationHint = duplicationHint;
048                }
049
050                public Integer getMinCPLength() {
051                        return minCPLength;
052                }
053
054                public void setMinCPLength(Integer minCPLength) {
055                        this.minCPLength = minCPLength;
056                }
057
058                @Override
059                public String toString() {
060                        StringBuilder builder = new StringBuilder();
061                        builder.append("CeCPStartupParams [duplicationHint=")
062                                        .append(duplicationHint).append(", minCPLength=")
063                                        .append(minCPLength).append("]");
064                        return builder.toString();
065                }
066        }
067
068        @Override
069        protected StartupParameters getStartupParametersInstance() {
070                return  new CeCPStartupParams();
071        }
072        @Override
073        public StructureAlignment getAlgorithm() {
074                return new CeCPMain();
075        }
076
077        @Override
078        public Object getParameters() {
079                CECPParameters aligParams = (CECPParameters) super.getParameters();
080                CeCPStartupParams startParams = (CeCPStartupParams) params;
081
082                if ( aligParams == null)
083                        aligParams = new CECPParameters();
084
085                // Copy relevant parameters from the startup parameters
086                aligParams.setDuplicationHint(startParams.getDuplicationHint());
087                aligParams.setMinCPLength(startParams.getMinCPLength());
088                return aligParams;
089        }
090}
091