1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2016 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.taxeditor.molecular.io;
|
11
|
|
12
|
|
13
|
import info.bioinfweb.commons.io.XMLUtils;
|
14
|
import info.bioinfweb.jphyloio.ReaderStreamDataProvider;
|
15
|
import info.bioinfweb.jphyloio.WriterStreamDataProvider;
|
16
|
import info.bioinfweb.jphyloio.objecttranslation.InvalidObjectSourceDataException;
|
17
|
import info.bioinfweb.jphyloio.objecttranslation.implementations.AbstractXMLObjectTranslator;
|
18
|
|
19
|
import java.io.IOException;
|
20
|
|
21
|
import javax.xml.stream.XMLEventReader;
|
22
|
import javax.xml.stream.XMLStreamException;
|
23
|
import javax.xml.stream.XMLStreamWriter;
|
24
|
|
25
|
import eu.etaxonomy.cdm.model.molecular.SingleReadAlignment;
|
26
|
|
27
|
|
28
|
|
29
|
/**
|
30
|
* <i>JPhyloIO</i> object translator to read and write a shift list of a {@link SingleReadAlignment} object from and
|
31
|
* to <i>XML</i>.
|
32
|
*
|
33
|
* @author Ben Stöver
|
34
|
* @date 28.10.2016
|
35
|
*/
|
36
|
public class CDMPherogramAlignmentObjectTranslator extends AbstractXMLObjectTranslator<SingleReadAlignment.Shift[]>
|
37
|
implements SingleReadAlignmentRDFXMLConstants {
|
38
|
|
39
|
@Override
|
40
|
public Class<SingleReadAlignment.Shift[]> getObjectClass() {
|
41
|
return SingleReadAlignment.Shift[].class;
|
42
|
}
|
43
|
|
44
|
|
45
|
@Override
|
46
|
public SingleReadAlignment.Shift[] readXMLRepresentation(XMLEventReader reader, ReaderStreamDataProvider<?> streamDataProvider)
|
47
|
throws IOException, XMLStreamException, InvalidObjectSourceDataException {
|
48
|
|
49
|
// TODO implement
|
50
|
throw new InternalError("Not implemented.");
|
51
|
}
|
52
|
|
53
|
|
54
|
@Override
|
55
|
public void writeXMLRepresentation(XMLStreamWriter writer, Object object, WriterStreamDataProvider<?> streamDataProvider)
|
56
|
throws IOException, XMLStreamException, ClassCastException {
|
57
|
|
58
|
SingleReadAlignment.Shift[] shifts = (SingleReadAlignment.Shift[])object;
|
59
|
XMLUtils.writeStartElement(writer, TAG_SHIFTS);
|
60
|
for (SingleReadAlignment.Shift shift : shifts) {
|
61
|
XMLUtils.writeStartElement(writer, TAG_SHIFT);
|
62
|
XMLUtils.writeAttribute(writer, ATTR_POSITION, Integer.toString(shift.position));
|
63
|
XMLUtils.writeAttribute(writer, ATTR_SHIFT, Integer.toString(shift.shift));
|
64
|
writer.writeEndElement();
|
65
|
}
|
66
|
writer.writeEndElement();
|
67
|
}
|
68
|
}
|