use of electric.xml.Element in project blue by kunstmusik.
the class Table method saveAsXML.
public Element saveAsXML() {
Element retVal = new Element("table");
retVal.addElement(XMLUtilities.writeDouble("min", getMin()));
retVal.addElement(XMLUtilities.writeDouble("max", getMax()));
retVal.addElement(XMLUtilities.writeInt("interpolationType", getInterpolationType()));
retVal.addElement(XMLUtilities.writeDouble("interpolation", interpolation));
Element pointsNode = new Element("points");
for (Iterator it = points.iterator(); it.hasNext(); ) {
TablePoint tPoint = (TablePoint) it.next();
pointsNode.addElement(tPoint.saveAsXML());
}
retVal.addElement(pointsNode);
return retVal;
}
use of electric.xml.Element in project blue by kunstmusik.
the class Table method loadFromXML.
public static Table loadFromXML(Element data) {
Table retVal = new Table(false);
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
switch(nodeName) {
case "min":
retVal.min = Double.parseDouble(node.getTextString());
break;
case "max":
retVal.max = Double.parseDouble(node.getTextString());
break;
case "interpolationType":
retVal.setInterpolationType(Integer.parseInt(node.getTextString()));
break;
case "interpolation":
retVal.interpolation = Double.parseDouble(node.getTextString());
break;
case "points":
Elements pointNodes = node.getElements();
while (pointNodes.hasMoreElements()) {
Element pointNode = pointNodes.next();
String pointNodeName = pointNode.getName();
if (pointNodeName.equals("point")) {
retVal.points.add(TablePoint.loadFromXML(pointNode));
}
}
break;
}
}
return retVal;
}
use of electric.xml.Element in project blue by kunstmusik.
the class Exponential method loadFromXML.
public static ProbabilityGenerator loadFromXML(Element data) {
Exponential retVal = new Exponential();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
switch(nodeName) {
case "direction":
retVal.direction = XMLUtilities.readInt(node);
break;
case "lambda":
retVal.lambda = XMLUtilities.readDouble(node);
break;
case "lambdaTableEnabled":
retVal.lambdaTableEnabled = XMLUtilities.readBoolean(node);
break;
case "table":
retVal.lambdaTable = Table.loadFromXML(node);
break;
}
}
return retVal;
}
use of electric.xml.Element in project blue by kunstmusik.
the class Linear method loadFromXML.
public static ProbabilityGenerator loadFromXML(Element data) {
Linear retVal = new Linear();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
if (nodeName.equals("direction")) {
retVal.direction = XMLUtilities.readInt(node);
}
}
return retVal;
}
use of electric.xml.Element in project blue by kunstmusik.
the class Linear method saveAsXML.
@Override
public Element saveAsXML() {
Element retVal = new Element("probabilityGenerator");
retVal.setAttribute("type", getClass().getName());
retVal.addElement(XMLUtilities.writeInt("direction", getDirection()));
return retVal;
}
Aggregations