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 */
021package org.biojava.nbio.structure.secstruc;
022
023import org.biojava.nbio.structure.Group;
024
025/**
026 * Container for the secondary structure information of a single residue. This
027 * class is designed to be stored inside an Amino Acid object. It can also
028 * contain a back-reference to its parent AA.
029 *
030 * @author Aleix Lafita
031 * @since 4.1.1
032 *
033 */
034public class SecStrucInfo {
035
036        /** Secondary strucuture assigned by the PDB author */
037        public static final String PDB_AUTHOR_ASSIGNMENT = "PDB_AUTHOR_ASSIGNMENT";
038
039        /** Secondary strucuture parsed from a DSSP output file */
040        public static final String DSSP_ASSIGNMENT = "DSSP_ASSIGNMENT";
041
042        /** Secondary strucuture calculated and assigned by DSSP of BioJava */
043        public static final String BIOJAVA_ASSIGNMENT = "BIOJAVA_ASSIGNMENT";
044
045        protected SecStrucType type;
046        protected String assignment;
047        protected Group parent;
048
049        public SecStrucInfo(Group g, String ass, SecStrucType t) {
050                type = t;
051                assignment = ass;
052                parent = g;
053        }
054
055        public SecStrucType getType() {
056                return type;
057        }
058
059        public void setType(SecStrucType t) {
060                type = t;
061        }
062
063        public String getAssignment() {
064                return assignment;
065        }
066
067        public Group getGroup() {
068                return parent;
069        }
070
071        @Override
072        public String toString() {
073                return assignment + ": " + type;
074        }
075
076        @Override
077        public boolean equals(Object o) {
078                if (!(o instanceof SecStrucInfo))
079                        return false;
080                else {
081                        SecStrucInfo ss = (SecStrucInfo) o;
082                        if (type == ss.type)
083                                return true;
084                        else
085                                return false;
086                }
087        }
088
089}