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 * Created on July 27, 2010
021 *
022 */
023
024package org.biojava.nbio.structure;
025
026/**
027 * ElementType is an enumeration of the types of elements found in the periodic table.
028 * Each element type is further classified into Metal, Metalloid, and Non-Metal.
029 *
030 * Element types based on definition at http://www.ptable.com/
031 *
032 * @author Peter Rose
033 * @version %I% %G%
034 * @since 3.0
035 */
036
037public enum ElementType {
038
039        METALLOID(false),
040        OTHER_NONMETAL(false),
041        HALOGEN(false),
042        NOBLE_GAS(false),
043        ALKALI_METAL(true),
044        ALKALINE_EARTH_METAL(true),
045        LANTHANOID(true),
046        ACTINOID(true),
047        TRANSITION_METAL(true),
048        POST_TRANSITION_METAL(true),
049        UNKNOWN(false);
050
051        private boolean metal;
052
053        private ElementType(boolean metal) {
054                this.metal = metal;
055        }
056
057        /**
058         * Returns <CODE>true</CODE> if ElementType is a metal.
059         * @return <CODE>true</CODE> if ElementType is a metal.
060         */
061        public boolean isMetal() {
062                return metal;
063        }
064
065        /**
066         * Returns <CODE>true</CODE> if ElementType is a metalloid.
067         * @return <CODE>true</CODE> if ElementType is a metalloid.
068         */
069        public boolean isMetalloid() {
070                return this.equals(METALLOID);
071        }
072
073        /**
074         * Returns <CODE>true</CODE> if ElementType is a non-metal.
075         * @return <CODE>true</CODE> if ElementType is a non-metal.
076         */
077        public boolean isNonMetal() {
078                return this.equals(OTHER_NONMETAL) || this.equals(HALOGEN) || this.equals(NOBLE_GAS);
079        }
080}