View Javadoc

1   /*
2    * Copyright 2006-2010 Sam Adams <sea36 at users.sourceforge.net>
3    *
4    * This file is part of JNI-InChI.
5    *
6    * JNI-InChI is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Lesser General Public License as published
8    * by the Free Software Foundation, either version 3 of the License, or
9    * (at your option) any later version.
10   *
11   * JNI-InChI is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Lesser General Public License for more details.
15   *
16   * You should have received a copy of the GNU Lesser General Public License
17   * along with JNI-InChI.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  package net.sf.jniinchi;
20  
21  /**
22   * Encapsulates output from InChI to structure conversion.
23   * @author Sam Adams
24   */
25  public class JniInchiOutputStructure extends JniInchiStructure {
26  
27      /**
28       * Return status from conversion.
29       */
30      private INCHI_RET retStatus;
31  
32      /**
33       * Error/warning messages generated.
34       */
35      private String message;
36  
37      /**
38       * Log generated.
39       */
40      private String log;
41  
42      /**
43       * <p>Warning flags, see INCHIDIFF in inchicmp.h.
44       *
45       * <p>[x][y]:
46       * <br>x=0 => Reconnected if present in InChI otherwise Disconnected/Normal
47       * <br>x=1 => Disconnected layer if Reconnected layer is present
48       * <br>y=1 => Main layer or Mobile-H
49       * <br>y=0 => Fixed-H layer
50       */
51      private long[][] warningFlags = new long[2][2];
52  
53      
54      public JniInchiOutputStructure(int ret, String message, String log, long w00, long w01, long w10, long w11) {
55      	this(INCHI_RET.getValue(ret));
56      	setMessage(message);
57      	setLog(log);
58      	setWarningFlags(w00, w01, w10, w11);
59      }
60      
61  
62      public JniInchiOutputStructure(INCHI_RET value) {
63  		this.retStatus = value;
64  	}
65  
66  
67  	/**
68       * Gets return status from InChI process.  OKAY and WARNING indicate
69       * InChI has been generated, in all other cases InChI generation
70       * has failed.
71       */
72      public INCHI_RET getReturnStatus() {
73          return retStatus;
74      }
75  
76      /**
77       * Gets generated (error/warning) messages.
78       */
79      public String getMessage() {
80          return message;
81      }
82  
83      /**
84       * Gets generated log.
85       */
86      public String getLog() {
87          return log;
88      }
89  
90      /**
91       * <p>Returns warning flags, see INCHIDIFF in inchicmp.h.
92       *
93       * <p>[x][y]:
94       * <br>x=0 => Reconnected if present in InChI otherwise Disconnected/Normal
95       * <br>x=1 => Disconnected layer if Reconnected layer is present
96       * <br>y=1 => Main layer or Mobile-H
97       * <br>y=0 => Fixed-H layer
98       */
99      public long[][] getWarningFlags() {
100         return warningFlags;
101     }
102 
103     protected void setLog(final String log) {
104         this.log = log;
105     }
106 
107     protected void setMessage(final String message) {
108         this.message = message;
109     }
110 
111     protected void setRetStatus(final INCHI_RET retStatus) {
112         this.retStatus = retStatus;
113     }
114 
115     protected void setWarningFlags(final long[][] warningFlags) {
116         this.warningFlags = warningFlags;
117     }
118     
119     protected void setWarningFlags(long f00, long f01, long f10, long f11) {
120     	this.warningFlags = new long[][] {{f00, f01}, {f10, f11}};
121     }
122 
123 
124 }