in progress (special coloring is still true)
[jalview.git] / forester / java / src / org / forester / surfacing / SimpleDomain.java
1 // $Id:
2 //
3 // FORESTER -- software libraries and applications
4 // for evolutionary biology research and applications.
5 //
6 // Copyright (C) 2008-2009 Christian M. Zmasek
7 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
8 // All rights reserved
9 //
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.
14 //
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.
19 //
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
23 //
24 // Contact: phylosoft @ gmail . com
25 // WWW: https://sites.google.com/site/cmzmasek/home/software/forester
26
27 package org.forester.surfacing;
28
29 import org.forester.protein.BasicDomain;
30 import org.forester.protein.Domain;
31 import org.forester.util.ForesterUtil;
32
33 /*
34  * A limited implementation of Domain. Its intended use is for when only a
35  * domain identifier is needed. Note intended for general use.
36  */
37 public class SimpleDomain implements Domain {
38
39     final private short _id;
40
41     public SimpleDomain( final String id ) {
42         if ( ForesterUtil.isEmpty( id ) ) {
43             throw new IllegalArgumentException( "attempt to create protein domain with null or empty id" );
44         }
45         _id = BasicDomain.obtainIdAsShort( id );
46     }
47
48     @Override
49     public int compareTo( final Domain domain ) {
50         if ( this == domain ) {
51             return 0;
52         }
53         return getDomainId().compareTo( domain.getDomainId() );
54     }
55
56     @Override
57     public String getDomainId() {
58         return BasicDomain.obtainIdFromShort( _id );
59     }
60
61     @Override
62     public int getFrom() {
63         throw new RuntimeException( "method not implemented" );
64     }
65
66     @Override
67     public int getLength() {
68         throw new RuntimeException( "method not implemented" );
69     }
70
71     @Override
72     public short getNumber() {
73         throw new RuntimeException( "method not implemented" );
74     }
75
76     @Override
77     public double getPerDomainEvalue() {
78         throw new RuntimeException( "method not implemented" );
79     }
80
81     @Override
82     public double getPerDomainScore() {
83         throw new RuntimeException( "method not implemented" );
84     }
85
86     @Override
87     public int getTo() {
88         throw new RuntimeException( "method not implemented" );
89     }
90
91     @Override
92     public short getTotalCount() {
93         throw new RuntimeException( "method not implemented" );
94     }
95 }