1 /* $RCSfile$
2  * $Author: hansonr $
3  * $Date: 2018-02-22 12:04:47 -0600 (Thu, 22 Feb 2018) $
4  * $Revision: 21841 $
5  *
6  * Copyright (C) 2003-2005  Miguel, Jmol Development, www.jmol.org
7  *
8  * Contact: jmol-developers@lists.sf.net
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 St, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24 
25 package org.jmol.adapter.smarter;
26 
27 import org.jmol.c.STR;
28 import javajs.util.BS;
29 
30 public class Structure {
31   public STR structureType;
32   public STR substructureType;
33   public String structureID;
34   public int serialID;
35   public int strandCount;
36 
37   public int startSequenceNumber;
38   public int startChainID;
39   public String startChainStr;
40   public char startInsertionCode = '\0';
41 
42   public int endSequenceNumber;
43   public int endChainID;
44   public String endChainStr;
45   public char endInsertionCode = '\0';
46 
47   public int[] atomStartEnd = new int[2];
48   public int[] modelStartEnd = new int[] {-1, -1};
49   public BS[] bsAll;
50 
51 
getHelixType(int type)52   public static STR getHelixType(int type) {
53     switch (type) {
54     case 1:
55       return STR.HELIXALPHA;
56     case 3:
57       return STR.HELIXPI;
58     case 5:
59       return STR.HELIX310;
60     }
61     return STR.HELIX;
62   }
63 
Structure(int modelIndex, STR structureType, STR substructureType, String structureID, int serialID, int strandCount, BS[] bsAll)64   public Structure(int modelIndex, STR structureType,
65       STR substructureType, String structureID, int serialID,
66       int strandCount, BS[] bsAll) {
67     if (bsAll != null) {
68       this.modelStartEnd = new int[] {0, modelIndex};
69       this.bsAll = bsAll;
70       return;
71     }
72     this.structureType = structureType;
73     this.substructureType = substructureType;
74     if (structureID == null)
75       return;
76     modelStartEnd[0] = modelStartEnd[1] = modelIndex;
77     this.structureID = structureID;
78     this.strandCount = strandCount; // 1 for sheet initially; 0 for helix or turn
79     this.serialID = serialID;
80   }
81 
set(int startChainID, int startSequenceNumber, char startInsertionCode, int endChainID, int endSequenceNumber, char endInsertionCode, int istart, int iend)82   public void set(int startChainID, int startSequenceNumber,
83                   char startInsertionCode, int endChainID,
84                   int endSequenceNumber, char endInsertionCode, int istart,
85                   int iend) {
86     this.startChainID = startChainID;
87     this.startSequenceNumber = startSequenceNumber;
88     this.startInsertionCode = startInsertionCode;
89     this.endChainID = endChainID;
90     this.endSequenceNumber = endSequenceNumber;
91     this.endInsertionCode = endInsertionCode;
92     atomStartEnd[0] = istart;
93     atomStartEnd[1] = iend;
94   }
95 
96 }
97