001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021package org.biojava.nbio.structure.io.mmcif.model;
022
023
024import org.biojava.nbio.structure.jama.Matrix;
025
026import javax.xml.bind.annotation.XmlAccessType;
027import javax.xml.bind.annotation.XmlAccessorType;
028import javax.xml.bind.annotation.XmlAttribute;
029import javax.xml.bind.annotation.XmlElement;
030import java.io.Serializable;
031import java.util.Arrays;
032
033/**
034 * The bean for pdbx_struct_oper_list category
035 * <pre>
036 * _pdbx_struct_oper_list.id 
037 * _pdbx_struct_oper_list.type 
038 * _pdbx_struct_oper_list.symmetry_operation
039 * _pdbx_struct_oper_list.matrix[1][1] 
040 * _pdbx_struct_oper_list.matrix[1][2] 
041 * _pdbx_struct_oper_list.matrix[1][3] 
042 * _pdbx_struct_oper_list.vector[1] 
043 * _pdbx_struct_oper_list.matrix[2][1] 
044 * _pdbx_struct_oper_list.matrix[2][2] 
045 * _pdbx_struct_oper_list.matrix[2][3] 
046 * _pdbx_struct_oper_list.vector[2] 
047 * _pdbx_struct_oper_list.matrix[3][1] 
048 * _pdbx_struct_oper_list.matrix[3][2] 
049 * _pdbx_struct_oper_list.matrix[3][3] 
050 * _pdbx_struct_oper_list.vector[3] 
051 * _pdbx_struct_oper_list.name 
052 * </pre>
053 */
054@XmlAccessorType(XmlAccessType.PROPERTY)
055public class PdbxStructOperList implements Serializable{
056
057        
058        private static final long serialVersionUID = 8933552854747969787L;
059
060        @Override
061        public String toString() {
062                return "PdbxStructOperList [id=" + id + ", type=" + type + ", matrix="
063                                + matrix + ", vector=" + Arrays.toString(vector) + "]";
064        }
065
066
067        private String id;
068
069        private String type;
070        
071        private String symmetry_operation;
072        
073        @CIFLabel(label="matrix[1][1]")
074        String matrix11;
075        @CIFLabel(label="matrix[1][2]")
076        String matrix12;
077        @CIFLabel(label="matrix[1][3]")
078        String matrix13;
079        
080        @CIFLabel(label="vector[1]")
081        String vector1;
082
083        @CIFLabel(label="matrix[2][1]")
084        String matrix21;
085        @CIFLabel(label="matrix[2][2]")
086        String matrix22;
087        @CIFLabel(label="matrix[2][3]")
088        String matrix23;
089        
090        @CIFLabel(label="vector[2]")
091        String vector2;
092        
093        @CIFLabel(label="matrix[3][1]")
094        String matrix31;
095        @CIFLabel(label="matrix[3][2]")
096        String matrix32;
097        @CIFLabel(label="matrix[3][3]")
098        String matrix33;
099        
100        @CIFLabel(label="vector[3]")
101        String vector3;
102
103        String name;
104        
105        
106        // from here fields that are not in the cif category
107        
108        @IgnoreField
109        private Matrix matrix;
110
111        @IgnoreField
112        private double[] vector;
113
114        public PdbxStructOperList(){
115                matrix =  Matrix.identity(3,3);
116                vector = new double[3];
117
118        }
119        @XmlAttribute
120        public String getType() {
121                return type;
122        }
123
124        public void setType(String type) {
125                this.type = type;
126        }
127
128        public Matrix getMatrix() {
129                return matrix;
130        }
131
132        public void setMatrix(Matrix matrix) {
133                this.matrix = matrix;
134        }
135        @XmlAttribute
136        public double[] getVector() {
137                return vector;
138        }
139
140        public void setVector(double[] vector) {
141                this.vector = vector;
142        }
143        @XmlAttribute
144        public String getId() {
145                return id;
146        }
147
148        public void setId(String id) {
149                this.id = id;
150        }
151
152        public void setMatrix11(String val){
153                matrix.set(0,0,Double.parseDouble(val));
154        }
155        public void setMatrix21(String val){
156                matrix.set(1,0,Double.parseDouble(val));
157        }
158        public void setMatrix31(String val){
159                matrix.set(2,0,Double.parseDouble(val));
160        }
161
162        public void setMatrix12(String val){
163                matrix.set(0,1,Double.parseDouble(val));
164        }
165        public void setMatrix22(String val){
166                matrix.set(1,1,Double.parseDouble(val));
167        }
168        public void setMatrix32(String val){
169                matrix.set(2,1,Double.parseDouble(val));
170        }
171        public void setMatrix13(String val){
172                matrix.set(0,2,Double.parseDouble(val));
173        }
174        public void setMatrix23(String val){
175                matrix.set(1,2,Double.parseDouble(val));
176        }
177        public void setMatrix33(String val){
178                matrix.set(2,2,Double.parseDouble(val));
179        }
180        
181        public void setName(String name) {
182                this.name = name;
183        }
184
185        public String getVector1() {
186                return vector1;
187        }
188        public void setVector1(String vector1) {
189                vector[0] = Double.parseDouble(vector1);
190        }
191        public String getVector2() {
192                return vector2;
193        }
194        public void setVector2(String vector2) {
195                vector[1] = Double.parseDouble(vector2);
196        }
197        public String getVector3() {
198                return vector3;
199        }
200        public void setVector3(String vector3) {
201                vector[2] = Double.parseDouble(vector3);
202        }
203        public String getName() {
204                return name;
205        }
206        public String getSymmetry_operation() {
207                return symmetry_operation;
208        }
209        public void setSymmetry_operation(String symmetry_operation) {
210                this.symmetry_operation = symmetry_operation;
211        }
212        @XmlElement
213        public double getMatrix11(){
214                return matrix.get(0,0);
215        }
216        @XmlElement
217        public double getMatrix21(){
218                return matrix.get(1,0);
219        }
220        @XmlElement
221        public double getMatrix31(){
222                return matrix.get(2,0);
223        }
224        @XmlElement
225        public double getMatrix12(){
226                return matrix.get(0,1);
227        }
228        @XmlElement
229        public double getMatrix22(){
230                return matrix.get(1,1);
231        }
232        @XmlElement
233        public double getMatrix32(){
234                return matrix.get(2,1);
235        }
236        @XmlElement
237        public double getMatrix13(){
238                return matrix.get(0,2);
239        }
240        @XmlElement
241        public double getMatrix23(){
242                return matrix.get(1,2);
243        }
244        @XmlElement
245        public double getMatrix33(){
246                return matrix.get(2,2);
247        }
248}