3 // FORESTER -- software libraries and applications
4 // for evolutionary biology research and applications.
6 // Copyright (C) 2008-2009 Christian M. Zmasek
7 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 // Contact: phylosoft @ gmail . com
25 // WWW: www.phylosoft.org/forester
27 package org.forester.surfacing;
29 import org.forester.util.ForesterUtil;
31 public class ProteinId implements Comparable<ProteinId> {
33 final private String _id;
35 public ProteinId( final String id ) {
36 if ( ForesterUtil.isEmpty( id ) ) {
37 throw new IllegalArgumentException( "attempt to create new protein id from empty or null string" );
43 public int compareTo( final ProteinId protein_id ) {
44 if ( this == protein_id ) {
47 return getId().toLowerCase().compareTo( protein_id.getId().toLowerCase() );
51 public boolean equals( final Object o ) {
55 else if ( o == null ) {
56 throw new IllegalArgumentException( "attempt to check protein id equality to null" );
58 else if ( o.getClass() != this.getClass() ) {
59 throw new IllegalArgumentException( "attempt to check protein id equality to " + o + " [" + o.getClass()
63 return getId().equals( ( ( ProteinId ) o ).getId() );
67 public String getId() {
72 public int hashCode() {
73 return getId().hashCode();
77 public String toString() {