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