org.jcamp.parser..JCAMPBlock.swp Maven / Gradle / Ivy
b0VIM 7.4 a??J??? ?- fracpete bluster ~fracpete/development/projects/jcamp-parser-clc/src/org/jcamp/parser/JCAMPBlock.java
3210 #"! U tp ^ ????????m _ ????????s ? ????????} ? ????????` ? ????????f W ? ad ? ^ ? ? ? ? } a H +
? ? ? ? ? ? Y + ?
?
?
?
?
{
w
]
$
? ? I - ? ? ? ? U K ?
?
?
?
e
C
? ? ? ? ? k a = ? ? ? u Y O ? ? ? ? b ? ? < ? h b 3 ? ? ? ? c J ? r A ? ? ? X ? ? //filled, no normalization takes place and only the second call to the parser //shk3: it is the constructor of Unit filling the idMap in Unit. Without the map private boolean isValidating=true; private JCAMPVariable[] vars = null; private JCAMPNTuple ntuple; private boolean ntupleBlock = false; private JCAMPBlock[] references = null; private JCAMPDataRecord[] ldrs; // array of data records with duplicate keys private Hashtable dataRecords = new Hashtable(50); // hashtable containing all data records (or list of data records for multiple records with same key) private Hashtable childBlocks = new Hashtable(10); private String data; private int spectrumID; private Type type; private int numDataRecords; private final JCAMPBlock parent; private final String jcamp; private final int end; private final int start; private final static String CRLF = "\r\n"; } private final static List TYPES_LIST = Collections.unmodifiableList(Arrays.asList(TYPES)); private final static Type[] TYPES = new Type[] { LINK, STRUCTURE, FULLSPECTRUM, PEAKTABLE, ASSIGNMENT }; public final static Type ASSIGNMENT = new Type(4, "assignment"); public final static Type PEAKTABLE = new Type(3, "peak table"); public final static Type FULLSPECTRUM = new Type(2, "full spectrum"); public final static Type STRUCTURE = new Type(1, "structure"); public final static Type LINK = new Type(0, "link"); } return false; return true; if (obj instanceof Type && ((Type) obj) == this) public final boolean equals(Object obj) { } return ordinal; public final int hashCode() { } return TYPES[ordinal]; private Object readResolve() throws java.io.ObjectStreamException { } return TYPES_LIST; public Collection types() { } return key; public String toString() { } this.key = key; this.ordinal = ordinal; private Type(int ordinal, String key) { private final int ordinal; private final String key; public final static class Type implements Serializable { private IErrorHandler errorHandler = DEFAULT_ERROR_HANDLER; }; } log.warn(msg); public void warn(String msg) throws JCAMPException { } throw new JCAMPException("ERROR! " + msg); log.error(msg); public void error(String msg) throws JCAMPException { } throw new JCAMPException("FATAL ERROR! " + msg); log.fatal(msg); public void fatal(String msg) throws JCAMPException { private final static IErrorHandler DEFAULT_ERROR_HANDLER = new ErrorHandlerAdapter() { private static Log log = LogFactory.getLog(JCAMPBlock.class); private ASDFDecoder asdfDecoder = new ASDFDecoder(); public class JCAMPBlock { */ * @author Thomas Weber * class for handling JCAMP blocks. /** import org.jcamp.units.Unit; import org.jcamp.units.DerivedUnit; import org.jcamp.spectrum.ISpectrumIdentifier; import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.Log; import java.util.Vector; import java.util.StringTokenizer; import java.util.List; import java.util.Hashtable; import java.util.Enumeration; import java.util.Collections; import java.util.Collection; import java.util.Arrays; import java.util.ArrayList; import java.io.Serializable; import java.io.IOException; import java.io.FileReader; import java.io.File; package org.jcamp.parser; ad * ? W ? ? ? v _ B ? ? ? ? c B $ ?
?
?
?
?
?
W
? ? ? | v u m I 6 . ? ? ? ? ? ? ? ? g a ` X < ) ! ?
?
?
?
?
?
x
p
3
? ? ? ? ? Q ) # " ? ? ? ? z t s R ; 8 7 ? ? ? ? ? } } this.asdfDecoder.enableValidation(useCheckValues); this.isValidating = useCheckValues; public void setValidating(boolean useCheckValues) { } return isValidating; public boolean isValidating() { } spectrumID = newSpectrumID; public void setSpectrumID(int newSpectrumID) { */ * @param newSpectrumID int * sets spectrum identifier. /** } errorHandler = newErrorHandler; public void setErrorHandler(IErrorHandler newErrorHandler) { */ * @param newErrorHandler com.creon.chem.jcamp.IErrorHandler * * sets error handler. /** } asdfDecoder = newAsdfDecoder; public void setASDFDecoder(ASDFDecoder newAsdfDecoder) { */ * @param newAsdfDecoder com.creon.chem.jcamp.ASDFDecoder * * sets ASDFDecoder /** } return vars.length; public int numVariables() { */ * @return int * gets number of LDRs. /** } return numDataRecords; public int numDataRecords() { */ * @return int * gets number of LDRs. /** } return childBlocks.size(); public int numBlocks() { */ * @return int * gets number of child blocks. /** } } e.printStackTrace(); } catch (JCAMPException e) { System.out.println("Child Blocks: " + block.childBlocks.size()); System.out.println("Block Data:\n" + block.data); JCAMPBlock block = new JCAMPBlock(jcamp); try { } e.printStackTrace(); } catch (IOException e) { } jcamp = String.valueOf(data); dxIn.close(); } while (r > 0); read += r; r = dxIn.read(data, read, size - read); do { data = new char[size]; read = 0; size = (int) dxFile.length(); char[] data; int r; int read; int size; if (dxIn != null) { FileReader dxIn = new FileReader(dxFile);