001package com.hfg.bio.seq; 002 003//------------------------------------------------------------------------------ 004/** 005 Sequence clone name container. 006 <div> 007 @author J. Alex Taylor, hairyfatguy.com 008 </div> 009 */ 010//------------------------------------------------------------------------------ 011// com.hfg Library 012// 013// This library is free software; you can redistribute it and/or 014// modify it under the terms of the GNU Lesser General Public 015// License as published by the Free Software Foundation; either 016// version 2.1 of the License, or (at your option) any later version. 017// 018// This library 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 GNU 021// Lesser General Public License for more details. 022// 023// You should have received a copy of the GNU Lesser General Public 024// License along with this library; if not, write to the Free Software 025// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026// 027// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 028// jataylor@hairyfatguy.com 029//------------------------------------------------------------------------------ 030 031public class Clone implements Comparable<Clone> 032{ 033 private String mName; 034 private String mSubcloneName; 035 036 037 //########################################################################### 038 // CONSTRUCTORS 039 //########################################################################### 040 041 //--------------------------------------------------------------------------- 042 public Clone(String inName) 043 { 044 mName = inName; 045 } 046 047 //########################################################################### 048 // CONSTRUCTORS 049 //########################################################################### 050 051 //--------------------------------------------------------------------------- 052 @Override 053 public String toString() 054 { 055 return name() + (getSubcloneName() != null ? " (" + getSubcloneName() + ")" : ""); 056 } 057 058 //--------------------------------------------------------------------------- 059 public String name() 060 { 061 return mName; 062 } 063 064 //--------------------------------------------------------------------------- 065 public Clone setSubcloneName(String inValue) 066 { 067 mSubcloneName = inValue; 068 return this; 069 } 070 071 //--------------------------------------------------------------------------- 072 public String getSubcloneName() 073 { 074 return mSubcloneName; 075 } 076 077 //--------------------------------------------------------------------------- 078 @Override 079 public int hashCode() 080 { 081 return toString().hashCode(); 082 } 083 084 //--------------------------------------------------------------------------- 085 @Override 086 public boolean equals(Object inObj2) 087 { 088 boolean result = false; 089 if (inObj2 != null 090 && inObj2 instanceof Clone) 091 { 092 result = (0 == compareTo((Clone) inObj2)); 093 } 094 095 return result; 096 } 097 098 //--------------------------------------------------------------------------- 099 @Override 100 public int compareTo(Clone inObj2) 101 { 102 return toString().compareTo(inObj2.toString()); 103 } 104}