use of electric.xml.Element in project blue by kunstmusik.
the class LiveDataTest method testSerialization.
public void testSerialization() {
LiveData liveData = new LiveData();
final LiveObjectBins liveObjectBins = liveData.getLiveObjectBins();
liveObjectBins.setLiveObject(0, 0, new LiveObject(new GenericScore()));
liveObjectBins.setLiveObject(0, 2, new LiveObject(new GenericScore()));
liveObjectBins.setLiveObject(0, 4, new LiveObject(new GenericScore()));
liveObjectBins.setLiveObject(0, 6, new LiveObject(new GenericScore()));
Element elem1 = liveData.saveAsXML(null);
Element elem2;
try {
elem2 = LiveData.loadFromXML(elem1, null).saveAsXML(null);
System.out.println(elem1.toString() + "\n\n" + elem2.toString());
assertEquals(elem1.toString(), elem2.toString());
} catch (Exception ex) {
ex.printStackTrace();
fail("Did not load from xml");
}
}
use of electric.xml.Element in project blue by kunstmusik.
the class XMLUtilities method writeDouble.
public static Element writeDouble(String nodeName, double val) {
Element elem = new Element(nodeName);
elem.setText(Double.toString(val));
return elem;
}
use of electric.xml.Element in project blue by kunstmusik.
the class XMLUtilities method writeBoolean.
public static Element writeBoolean(String nodeName, boolean val) {
Element elem = new Element(nodeName);
elem.setText(Boolean.toString(val));
return elem;
}
use of electric.xml.Element in project blue by kunstmusik.
the class XMLUtilities method writeInt.
public static Element writeInt(String nodeName, int val) {
Element elem = new Element(nodeName);
elem.setText(Integer.toString(val));
return elem;
}
use of electric.xml.Element in project blue by kunstmusik.
the class Random method saveAsXML.
@Override
public Element saveAsXML() {
Element retVal = new Element("generator");
retVal.setAttribute("type", getClass().getName());
retVal.addElement("min").setText(Double.toString(min));
retVal.addElement("max").setText(Double.toString(max));
return retVal;
}
Aggregations