1
package jspecview.source;
3
import javajs.util.Lst;
6
* could be a spectrum or a source
11
public class JDXHeader {
13
public String title = "";
14
public String jcampdx = "5.01";
15
public String dataType = "";
16
public String dataClass = "";
17
public String origin = "";
18
public String owner = "PUBLIC DOMAIN";
19
public String longDate = "";
20
public String date = "";
21
public String time = "";
25
* Sets the title of the spectrum
30
public void setTitle(String title) {
35
* Sets the JCAMP-DX version number
38
* the JCAMP-DX version number
40
public void setJcampdx(String versionNum) {
41
this.jcampdx = versionNum;
50
public void setDataType(String dataType) {
51
this.dataType = dataType;
60
public void setDataClass(String dataClass) {
61
this.dataClass = dataClass;
65
* Sets the origin of the JCAMP-DX spectrum
70
public void setOrigin(String origin) {
80
public void setOwner(String owner) {
85
* Sets the long date of when the file was created
90
public void setLongDate(String longDate) {
91
this.longDate = longDate;
95
* Sets the date the file was created
100
public void setDate(String date) {
105
* Sets the time the file was created
110
public void setTime(String time) {
116
* Getter for property title.
118
* @return Value of property title.
120
public String getTitle() {
124
final static String[] typeNames = {
125
"ND NMR SPECTRUM NMR",
127
"INFRARED SPECTRUM IR",
129
"RAMAN SPECTRUM RAMAN",
130
"GAS CHROMATOGRAM GC",
131
"UV/VIS SPECTRUM UV/VIS"
134
private String qualifiedType;
136
static String getTypeName(String type) {
137
type = type.toUpperCase();
138
for (int i = 0; i < typeNames.length; i++)
139
if (typeNames[i].startsWith(type)) {
140
return typeNames[i].substring(18);
145
public String getQualifiedDataType() {
146
return (qualifiedType == null ? (qualifiedType = getTypeName(dataType)) : qualifiedType);
149
* Getter for property jcampdx.
151
* @return Value of property jcampdx.
153
public String getJcampdx() {
158
* Getter for property dataType.
160
* @return Value of property dataType.
162
public String getDataType() {
167
* Getter for property origin.
169
* @return Value of property origin.
171
public String getOrigin() {
176
* Getter for property owner.
178
* @return Value of property owner.
180
public String getOwner() {
185
* Getter for property longDate.
187
* @return Value of property longDate.
189
public String getLongDate() {
194
* Getter for property date.
196
* @return Value of property date.
198
public String getDate() {
203
* Getter for property time.
205
* @return Value of property time.
207
public String getTime() {
212
* Returns the data class
214
* @return the data class
216
public String getDataClass() {
220
// Table of header variables specific to the jdx source or spectrum
221
protected Lst<String[]> headerTable = new Lst<String[]>();
224
* Sets the headerTable for this Source or spectrum
229
public void setHeaderTable(Lst<String[]> table) {
234
* Returns the table of headers
236
* @return the table of headers
238
public Lst<String[]> getHeaderTable() {
242
public String[][] getHeaderRowDataAsArray(boolean addDataClass, int nMore) {
244
String[][] rowData = new String[(addDataClass ? 6 : 5) + headerTable.size() + nMore][];
247
rowData[i++] = new String[] { "##TITLE", title };
248
rowData[i++] = new String[] { "##JCAMP-DX", jcampdx };
249
rowData[i++] = new String[] { "##DATA TYPE", dataType };
251
rowData[i++] = new String[] { "##DATA CLASS", dataClass };
252
rowData[i++] = new String[] { "##ORIGIN", origin };
253
rowData[i++] = new String[] { "##OWNER", owner };
255
for(int j = 0; j < headerTable.size(); j++)
256
rowData[i++] = getRow(j);
261
private String[] getRow(int j) {
262
String[] s = headerTable.get(j);
266
* return [s[0], javajs.util.PT.rep(s[1], "<", "<")];