Last update: 2011-06-23

org.proteios.io.mzdata
Class MzDataExpCommon

java.lang.Object
  extended by org.proteios.io.mzdata.MzDataExpCommon
Direct Known Subclasses:
MzDataExpCommonDc

public class MzDataExpCommon
extends Object

This class supports export of mzData files from Proteios. An mzData file contains information on a mass spectrometry experiment. Given a Proteios peakListSet, MzDataExporter fetches stored data related to this peakListSet and stores it in an mzData file.

Version:
2.0
Author:
Olle
Last modified
$Date: 2006-10-31 11:18:51 +0100 (Tue, 31 Oct 2006) $

Field Summary
protected static org.apache.log4j.Logger log
          Logger used.
 
Constructor Summary
MzDataExpCommon()
          Default constructor.
 
Method Summary
 String getBlockTagName()
          Get the blockTagName.
 void setBlockTagName(String blockTagName)
          Set the blockTagName.
 void write(XMLCrudeWriter xmlCrudeWriter)
          Write the current XML block.
 void writeAttribute(XMLCrudeWriter xmlCrudeWriter, String attrName, String attrValue)
          Writes XML attribute for current XML block.
 void writeEndTag(XMLCrudeWriter xmlCrudeWriter)
          Writes XML end tag for current XML block.
 void writeNamespace(XMLCrudeWriter xmlCrudeWriter, String name, String value)
          Writes XML namespace for current XML block.
 void writeSimpleElementPair(XMLCrudeWriter xmlCrudeWriter, String data)
          Convenience method for writing simple element pair for current XML block.
 void writeSimpleElementPair(XMLCrudeWriter xmlCrudeWriter, String elementName, String data)
          Convenience method for writing simple element pair.
 void writeSingleElementEnd(XMLCrudeWriter xmlCrudeWriter)
          Writes XML single element end.
 void writeStartElement(XMLCrudeWriter xmlCrudeWriter)
          Writes XML start element for current XML block.
 void writeStartElementEnd(XMLCrudeWriter xmlCrudeWriter)
          Writes XML start element end.
 void writeStartListTag(XMLCrudeWriter xmlCrudeWriter, int count)
          Writes XML start list tag for current XML block.
 void writeStartTag(XMLCrudeWriter xmlCrudeWriter)
          Writes XML start tag for current XML block.
 String zeroPad(double doubleNum, int minNumDecimals)
          Pad double number string with zeros if necessary
 String zeroPad(float floatNum, int minNumDecimals)
          Pad float number string with zeros if necessary
 String zeroPad(String numAsString, int minNumDecimals)
          Pad number string with zeros if necessary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log
Logger used. Used to log specific events.

Constructor Detail

MzDataExpCommon

public MzDataExpCommon()
Default constructor.

Method Detail

getBlockTagName

public String getBlockTagName()
Get the blockTagName.

Returns:
blockName String the XML block tag name

setBlockTagName

public void setBlockTagName(String blockTagName)
Set the blockTagName.

Parameters:
blockTagName - String the XML block tag name to set.

writeStartElement

public void writeStartElement(XMLCrudeWriter xmlCrudeWriter)
                       throws javax.xml.stream.XMLStreamException
Writes XML start element for current XML block.

Parameters:
xmlCrudeWriter - XMLCrudeWriter instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeAttribute

public void writeAttribute(XMLCrudeWriter xmlCrudeWriter,
                           String attrName,
                           String attrValue)
                    throws javax.xml.stream.XMLStreamException
Writes XML attribute for current XML block.

Parameters:
xmlCrudeWriter - XMLCrudeWriter instance.
attrName - String the name of the attribute..
attrValue - String the value of the attribute..
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeNamespace

public void writeNamespace(XMLCrudeWriter xmlCrudeWriter,
                           String name,
                           String value)
                    throws javax.xml.stream.XMLStreamException
Writes XML namespace for current XML block.

Parameters:
xmlCrudeWriter - XMLCrudeWriter instance.
name - String with namespace name.
value - String with namespace value.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeStartElementEnd

public void writeStartElementEnd(XMLCrudeWriter xmlCrudeWriter)
                          throws javax.xml.stream.XMLStreamException
Writes XML start element end.

Parameters:
xmlCrudeWriter - XMLCrudeWriter instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeStartTag

public void writeStartTag(XMLCrudeWriter xmlCrudeWriter)
                   throws javax.xml.stream.XMLStreamException
Writes XML start tag for current XML block.

Parameters:
xmlCrudeWriter - XMLCrudeWriter instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeStartListTag

public void writeStartListTag(XMLCrudeWriter xmlCrudeWriter,
                              int count)
                       throws javax.xml.stream.XMLStreamException
Writes XML start list tag for current XML block.

Parameters:
xmlCrudeWriter - XMLCrudeWriter instance.
count - int the number of XML blocks in the list.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeEndTag

public void writeEndTag(XMLCrudeWriter xmlCrudeWriter)
                 throws javax.xml.stream.XMLStreamException
Writes XML end tag for current XML block.

Parameters:
xmlCrudeWriter - XMLCrudeWriter instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeSingleElementEnd

public void writeSingleElementEnd(XMLCrudeWriter xmlCrudeWriter)
                           throws javax.xml.stream.XMLStreamException
Writes XML single element end.

Parameters:
xmlCrudeWriter - XMLCrudeWriter instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeSimpleElementPair

public void writeSimpleElementPair(XMLCrudeWriter xmlCrudeWriter,
                                   String elementName,
                                   String data)
                            throws javax.xml.stream.XMLStreamException
Convenience method for writing simple element pair. Writes XMl expression like: data

Parameters:
xmlCrudeWriter - XMLCrudeWriter instance.
elementName - String with element name.
data - String with element data.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

writeSimpleElementPair

public void writeSimpleElementPair(XMLCrudeWriter xmlCrudeWriter,
                                   String data)
                            throws javax.xml.stream.XMLStreamException
Convenience method for writing simple element pair for current XML block. Writes XMl expression like: data

Parameters:
xmlCrudeWriter - XMLCrudeWriter instance.
data - String with element data.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

zeroPad

public String zeroPad(float floatNum,
                      int minNumDecimals)
Pad float number string with zeros if necessary

Parameters:
floatNum - float Value to format
minNumDecimals - int Minimum number of decimals in output
Returns:
String with value formatted to minimum number of decimals

zeroPad

public String zeroPad(double doubleNum,
                      int minNumDecimals)
Pad double number string with zeros if necessary

Parameters:
doubleNum - double Value to format
minNumDecimals - int Minimum number of decimals in output
Returns:
String with value formatted to minimum number of decimals

zeroPad

public String zeroPad(String numAsString,
                      int minNumDecimals)
Pad number string with zeros if necessary

Parameters:
numAsString - String with number value to format
minNumDecimals - int Minimum number of decimals in output
Returns:
String value formatted to minimum number of decimals

write

public void write(XMLCrudeWriter xmlCrudeWriter)
           throws javax.xml.stream.XMLStreamException
Write the current XML block. The XMLCrudeWriter writer is updated to the current level of indentation of the XML data.

Parameters:
xmlCrudeWriter - XMLCrudeWriter instance.
Throws:
javax.xml.stream.XMLStreamException - If there is an XML Stream related error

Last update: 2011-06-23