Subversion Repositories svn.mios

Rev

Rev 709 | Rev 722 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
709 adamjking 1
package org.midibox.mios.xml;
2
 
721 adamjking 3
import java.util.Iterator;
709 adamjking 4
 
721 adamjking 5
import org.midibox.mios.DebugFunction;
6
import org.midibox.mios.DebugFunctionParameters;
7
import org.w3c.dom.Element;
8
import org.w3c.dom.Node;
9
 
10
public class DebugFunctionXML extends MIOSSysexSendReceiveXML {
11
 
12
    protected DebugFunction debugFunction;
13
 
14
    protected String modeAttr = "mode";
15
 
16
    protected String delayTimeAttr = "delayTime";
17
 
18
    protected String sramReadAddressAttr = "sramReadAddress";
19
 
20
    protected String sramReadCounterAttr = "sramReadCounter";
21
 
22
    protected String sramWriteAddressAttr = "sramWriteAddress";
23
 
24
    protected String sramWriteDataAttr = "sramWriteData";
25
 
26
    protected String debugFunctionParametersTag = "debugFunctionParameters";
27
 
28
    protected String debugFunctionParameterTag = "debugFunctionParameter";
29
 
30
    public DebugFunctionXML(DebugFunction debugFunction, String rootElementTag) {
31
 
32
        super(debugFunction, rootElementTag);
33
 
34
        this.debugFunction = debugFunction;
35
    }
36
 
37
    public void saveXML(Node node) {
38
 
39
        super.saveXML(node);
40
 
41
        rootElement.setAttribute(modeAttr, "" + debugFunction.getMode());
42
 
43
        rootElement.setAttribute(delayTimeAttr, ""
44
                + debugFunction.getDelayTime());
45
 
46
        rootElement.setAttribute(sramReadAddressAttr, ""
47
                + debugFunction.getSramReadAddress());
48
 
49
        rootElement.setAttribute(sramReadCounterAttr, ""
50
                + debugFunction.getSramReadCounter());
51
 
52
        rootElement.setAttribute(sramWriteAddressAttr, ""
53
                + debugFunction.getSramWriteAddress());
54
 
55
        rootElement.setAttribute(sramWriteDataAttr, ""
56
                + debugFunction.getSramWriteData());
57
 
58
        Element debugFunctionParametersElement = document
59
                .createElement(debugFunctionParametersTag);
60
 
61
        rootElement.appendChild(debugFunctionParametersElement);
62
 
63
        Iterator it = debugFunction.getDebugFunctionParameters().iterator();
64
 
65
        while (it.hasNext()) {
66
 
67
            DebugFunctionParameters debugFunctionParameters = (DebugFunctionParameters) it
68
                    .next();
69
 
70
            DebugFunctionParametersXML debugFunctionParametersXML = new DebugFunctionParametersXML(
71
                    debugFunctionParameters, debugFunctionParametersTag);
72
 
73
            debugFunctionParametersXML.saveXML(debugFunctionParametersElement);
74
        }
75
    }
709 adamjking 76
}