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 01-21-2010 021 */ 022package org.biojava.nbio.core.sequence.compound; 023 024import org.biojava.nbio.core.sequence.template.AbstractCompound; 025import org.biojava.nbio.core.sequence.template.Compound; 026/** 027 * Define a codon 028 * @author Andy Yates 029 */ 030public class CodonCompound extends AbstractCompound { 031 032 private final NucleotideCompound one; 033 private final NucleotideCompound two; 034 private final NucleotideCompound three; 035 private final boolean start; 036 037 public CodonCompound(NucleotideCompound one, NucleotideCompound two, 038 NucleotideCompound three, boolean start) { 039 super(one.toString()+two.toString()+three.toString()); 040 this.one = one; 041 this.two = two; 042 this.three = three; 043 this.start = start; 044 } 045 046 @Override 047public boolean equalsIgnoreCase(Compound compound) { 048 if (compound == null) { 049 return false; 050 } 051 if (!(compound instanceof CodonCompound)) { 052 return false; 053 } 054 CodonCompound them = (CodonCompound) compound; 055 return toString().equalsIgnoreCase(them.toString()); 056 } 057 058 @Override 059public boolean equals(Object obj) { 060 if (obj == null) { 061 return false; 062 } 063 if (!(obj instanceof CodonCompound)) { 064 return false; 065 } 066 CodonCompound them = (CodonCompound)obj; 067 return toString().equals(them.toString()); 068 } 069 070 @Override 071public int hashCode() { 072 return toString().hashCode(); 073 } 074 075 public NucleotideCompound getOne() { 076 return one; 077 } 078 079 public NucleotideCompound getTwo() { 080 return two; 081 } 082 083 public NucleotideCompound getThree() { 084 return three; 085 } 086 087 public boolean isStart() { 088 return start; 089 } 090 091 @Override 092public String getDescription() { 093 // TODO Auto-generated method stub 094 return null; 095 } 096 097 @Override 098public String getLongName() { 099 // TODO Auto-generated method stub 100 return null; 101 } 102 103 @Override 104public Float getMolecularWeight() { 105 // TODO Auto-generated method stub 106 return null; 107 } 108 109 @Override 110public String getShortName() { 111 // TODO Auto-generated method stub 112 return null; 113 } 114 115 @Override 116public void setDescription(String description) { 117 // TODO Auto-generated method stub 118 119 } 120 121 @Override 122public void setLongName(String longName) { 123 // TODO Auto-generated method stub 124 125 } 126 127 @Override 128public void setMolecularWeight(Float molecularWeight) { 129 // TODO Auto-generated method stub 130 131 } 132 133 @Override 134public void setShortName(String shortName) { 135 // TODO Auto-generated method stub 136 137 } 138 139}