001    package org.jaga.individualRepresentation.proteinLocation;
002    
003    
004    /**
005     * TODO: Complete these comments.
006     *
007     * <p><u>Project:</u> JAGA - Java API for Genetic Algorithms.</p>
008     *
009     * <p><u>Company:</u> University College London and JAGA.Org
010     *    (<a href="http://www.jaga.org" target="_blank">http://www.jaga.org</a>).
011     * </p>
012     *
013     * <p><u>Copyright:</u> (c) 2004 by G. Paperin.<br/>
014     *    This program is free software; you can redistribute it and/or modify
015     *    it under the terms of the GNU General Public License as published by
016     *    the Free Software Foundation, ONLY if you include a note of the original
017     *    author(s) in any redistributed/modified copy.<br/>
018     *    This program is distributed in the hope that it will be useful,
019     *    but WITHOUT ANY WARRANTY; without even the implied warranty of
020     *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
021     *    GNU General Public License for more details.<br/>
022     *    You should have received a copy of the GNU General Public License
023     *    along with this program; if not, write to the Free Software
024     *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
025     *    or see http://www.gnu.org/licenses/gpl.html</p>
026     *
027     * @author Greg Paperin (greg@jaga.org)
028     *
029     * @version JAGA public release 1.0 beta
030     */
031    
032    public class AminoAcid extends PolypeptidePatternItem {
033    
034            private String name = null;
035            private String code = null;
036            private int properties = 0;
037    
038            private AminoAcid() {
039                    throw new UnsupportedOperationException("Use AminoAcid(String name, String code, int properties).");
040            }
041    
042            /*package*/ AminoAcid(String name, String code, int properties) {
043                    super();
044                    this.name = name;
045                    this.code = code;
046                    this.properties = properties;
047            }
048    
049            public boolean doesntMatch(AminoAcid aminoAcid) {
050                    return (this != aminoAcid);
051            }
052    
053            public String getName() {
054                    return this.name;
055            }
056    
057            public String getCode() {
058                    return this.code;
059            }
060    
061            public String toString() {
062                    return this.getCode();
063            }
064    
065            public int getProperties() {
066                    return this.properties;
067            }
068    
069            public boolean isPolar() {
070                    return 0 != (this.properties & AminoAcidProperty.Polar);
071            }
072    
073            public boolean isSmall() {
074                    return 0 != (this.properties & AminoAcidProperty.Small);
075            }
076    
077            public boolean isHydrophobic() {
078                    return 0 != (this.properties & AminoAcidProperty.Hydrophobic);
079            }
080    
081            public boolean isAliphatic() {
082                    return 0 != (this.properties & AminoAcidProperty.Aliphatic);
083            }
084    
085            public boolean isAromatic() {
086                    return 0 != (this.properties & AminoAcidProperty.Aromatic);
087            }
088    
089            public boolean isNegative() {
090                    return 0 != (this.properties & AminoAcidProperty.Negative);
091            }
092    
093            public boolean isPositive() {
094                    return 0 != (this.properties & AminoAcidProperty.Positive);
095            }
096    
097            public boolean isTiny() {
098                    return 0 != (this.properties & AminoAcidProperty.Tiny);
099            }
100    }