in progress
[jalview.git] / forester / java / src / org / forester / surfacing / AdjactantDirectedBinaryDomainCombination.java
1 // $Id:
2 // Exp $
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.BinaryDomainCombination;
30
31 public class AdjactantDirectedBinaryDomainCombination extends BasicBinaryDomainCombination {
32
33     public AdjactantDirectedBinaryDomainCombination( final String n_terminal, final String c_terminal ) {
34         super();
35         if ( ( n_terminal == null ) || ( c_terminal == null ) ) {
36             throw new IllegalArgumentException( "attempt to create binary domain combination using null" );
37         }
38         // _id0 = n_terminal;
39         // _id1 = c_terminal;
40        // _data = n_terminal + SEPARATOR + c_terminal;
41         _id0 = getId( n_terminal );
42         _id1 = getId( c_terminal );
43     }
44
45     public static AdjactantDirectedBinaryDomainCombination createInstance( final String ids ) {
46         if ( ids.indexOf( BinaryDomainCombination.SEPARATOR ) < 1 ) {
47             throw new IllegalArgumentException( "Unexpected format for binary domain combination [" + ids + "]" );
48         }
49         final String[] ids_ary = ids.split( BinaryDomainCombination.SEPARATOR );
50         if ( ids_ary.length != 2 ) {
51             throw new IllegalArgumentException( "Unexpected format for binary domain combination [" + ids + "]" );
52         }
53         return new AdjactantDirectedBinaryDomainCombination( ids_ary[ 0 ], ids_ary[ 1 ] );
54     }
55 }