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.contact;
022
023import java.io.Serializable;
024
025public class AtomIdentifier implements Serializable {
026
027        private static final long serialVersionUID = 1L;
028
029        private int pdbSerial;
030        private String chainId;
031
032        public AtomIdentifier(int pdbSerial, String chainId) {
033                this.pdbSerial = pdbSerial;
034                this.chainId = chainId;
035        }
036
037        public int getPdbSerial() {
038                return pdbSerial;
039        }
040
041        public void setPdbSerial(int pdbSerial) {
042                this.pdbSerial = pdbSerial;
043        }
044
045        public String getChainId() {
046                return chainId;
047        }
048
049        public void setChainId(String chainId) {
050                this.chainId = chainId;
051        }
052
053        @Override
054        public int hashCode() {
055                final int prime = 31;
056                int result = 1;
057                result = prime * result + ((chainId == null) ? 0 : chainId.hashCode());
058                result = prime * result + pdbSerial;
059                return result;
060        }
061
062        @Override
063        public boolean equals(Object obj) {
064                if (this == obj)
065                        return true;
066                if (obj == null)
067                        return false;
068                if (getClass() != obj.getClass())
069                        return false;
070                AtomIdentifier other = (AtomIdentifier) obj;
071                if (chainId == null) {
072                        if (other.chainId != null)
073                                return false;
074                } else if (!chainId.equals(other.chainId))
075                        return false;
076                if (pdbSerial != other.pdbSerial)
077                        return false;
078                return true;
079        }
080
081        @Override
082        public String toString() {
083                return " [" + pdbSerial + " - "
084                                + chainId + "]";
085        }
086
087
088}