001    package org.biojava3.core.sequence;
002    
003    /**
004     * Provides a way of representing the strand of a sequence, location
005     * hit or feature.
006     *
007     * @author ayates
008     */
009    public enum Strand {
010    
011        POSITIVE("+", 1), NEGATIVE("-", -1), UNDEFINED(".", 0);
012        private final String stringRepresentation;
013        private final int numericRepresentation;
014    
015        private Strand(String stringRepresentation, int numericRepresentation) {
016            this.stringRepresentation = stringRepresentation;
017            this.numericRepresentation = numericRepresentation;
018        }
019    
020        public int getNumericRepresentation() {
021            return numericRepresentation;
022        }
023    
024        public String getStringRepresentation() {
025            return stringRepresentation;
026        }
027    
028        public Strand getReverse() {
029            switch (this) {
030                case POSITIVE:
031                    return NEGATIVE;
032                case NEGATIVE:
033                    return POSITIVE;
034                default:
035                    return UNDEFINED;
036            }
037        }
038    }