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
023/**
024 * A bridge is formed by two non-overlapping stretches of three residues each
025 * (i-1,i,i+1) and (j-1,j,j+1), where i<j.
026 * <p>
027 * Depending on two basic patterns, a Bridge can be either of type parallel (H
028 * bonds in {(i-1,j) and (j,i+1)} OR {(j-1,i) and (i,j-1)}) or antiparallel (H
029 * bonds in {(i1,j) and (j,i} OR {(i-1,j+1) and (j-1,i+1)})
030 *
031 * @author Andreas Prlic
032 * @author Aleix Lafita
033 *
034 */
035public enum BridgeType {
036
037        parallel("parallel", 'p'),
038        antiparallel("antiparallel", 'a');
039
040        public final Character type;
041        public final String name;
042
043        private BridgeType(String name, Character stype) {
044                this.name = name;
045                this.type = stype;
046        }
047
048        public static BridgeType fromCharacter(Character stype) {
049
050                for (BridgeType c : BridgeType.values()) {
051                        if (c.type.equals(stype))
052                                return c;
053                }
054                return null;
055        }
056
057        @Override
058        public String toString() {
059                return type.toString();
060        }
061
062}