use of electric.xml.Element in project blue by kunstmusik.
the class Beta method loadFromXML.
public static ProbabilityGenerator loadFromXML(Element data) {
Beta retVal = new Beta();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
switch(nodeName) {
case "a":
retVal.a = XMLUtilities.readDouble(node);
break;
case "b":
retVal.b = XMLUtilities.readDouble(node);
break;
case "aTableEnabled":
retVal.aTableEnabled = XMLUtilities.readBoolean(node);
break;
case "bTableEnabled":
retVal.bTableEnabled = XMLUtilities.readBoolean(node);
break;
case "table":
String tableId = node.getAttributeValue("tableId");
switch(tableId) {
case "aTable":
retVal.aTable = Table.loadFromXML(node);
break;
case "bTable":
retVal.bTable = Table.loadFromXML(node);
break;
}
break;
}
}
return retVal;
}
use of electric.xml.Element in project blue by kunstmusik.
the class Gaussian method saveAsXML.
@Override
public Element saveAsXML() {
Element retVal = new Element("probabilityGenerator");
retVal.setAttribute("type", getClass().getName());
retVal.addElement(XMLUtilities.writeDouble("sigma", sigma));
retVal.addElement(XMLUtilities.writeDouble("mu", mu));
retVal.addElement(XMLUtilities.writeBoolean("sigmaTableEnabled", sigmaTableEnabled));
retVal.addElement(XMLUtilities.writeBoolean("muTableEnabled", muTableEnabled));
Element sigmaTableNode = sigmaTable.saveAsXML();
sigmaTableNode.setAttribute("tableId", "sigmaTable");
Element muTableNode = muTable.saveAsXML();
muTableNode.setAttribute("tableId", "muTable");
retVal.addElement(sigmaTableNode);
retVal.addElement(muTableNode);
return retVal;
}
use of electric.xml.Element in project blue by kunstmusik.
the class Uniform method saveAsXML.
@Override
public Element saveAsXML() {
Element retVal = new Element("probabilityGenerator");
retVal.setAttribute("type", getClass().getName());
return retVal;
}
use of electric.xml.Element in project blue by kunstmusik.
the class PianoNote method saveAsXML.
public Element saveAsXML() {
Element retVal = new Element("pianoNote");
retVal.addElement("octave").setText(Integer.toString(octave));
retVal.addElement("scaleDegree").setText(Integer.toString(scaleDegree));
retVal.addElement("start").setText(Double.toString(start));
retVal.addElement("duration").setText(Double.toString(duration));
retVal.addElement("noteTemplate").setText(noteTemplate);
return retVal;
}
use of electric.xml.Element in project blue by kunstmusik.
the class TrackList method saveAsXML.
public Element saveAsXML() {
Element retVal = new Element("trackList");
retVal.addElement(XMLUtilities.writeInt("steps", steps));
for (Track tr : tracks) {
retVal.addElement(tr.saveAsXML());
}
return retVal;
}
Aggregations