use of electric.xml.Elements 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.Elements in project blue by kunstmusik.
the class Weibull method loadFromXML.
public static ProbabilityGenerator loadFromXML(Element data) {
Weibull retVal = new Weibull();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
switch(nodeName) {
case "s":
retVal.s = XMLUtilities.readDouble(node);
break;
case "t":
retVal.t = XMLUtilities.readDouble(node);
break;
case "sTableEnabled":
retVal.sTableEnabled = XMLUtilities.readBoolean(node);
break;
case "tTableEnabled":
retVal.tTableEnabled = XMLUtilities.readBoolean(node);
break;
case "table":
String tableId = node.getAttributeValue("tableId");
switch(tableId) {
case "sTable":
retVal.sTable = Table.loadFromXML(node);
break;
case "tTable":
retVal.tTable = Table.loadFromXML(node);
break;
}
break;
}
}
return retVal;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class JMask method loadFromXML.
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
JMask jmask = new JMask();
SoundObjectUtilities.initBasicFromXML(data, jmask);
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
switch(nodeName) {
case "field":
jmask.setField(Field.loadFromXML(node));
break;
case "seed":
jmask.setSeed(Long.parseLong(node.getTextString()));
break;
case "seedUsed":
jmask.setSeedUsed(Boolean.parseBoolean(node.getTextString()));
break;
}
}
return jmask;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class LineObject method loadFromXML.
/* SERIALIZATION */
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
LineObject lObj = new LineObject();
SoundObjectUtilities.initBasicFromXML(data, lObj);
Elements lines = data.getElements();
int counter = 0;
while (lines.hasMoreElements()) {
Element node = lines.next();
if (node.getName().equals("line")) {
Line l = Line.loadFromXML(node);
lObj.getLines().add(l);
if (l.getColor() == null) {
l.setColor(LineColors.getColor(counter));
}
counter++;
}
}
return lObj;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class PatternObject method loadFromXML.
/* SERIALIZATION */
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
PatternObject pattern = new PatternObject();
SoundObjectUtilities.initBasicFromXML(data, pattern);
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
switch(nodeName) {
case "beats":
pattern.setBeats(Integer.parseInt(node.getTextString()));
break;
case "subDivisions":
pattern.setSubDivisions(Integer.parseInt(node.getTextString()));
break;
case "patterns":
Elements patternNodes = node.getElements();
while (patternNodes.hasMoreElements()) {
Pattern p = Pattern.loadFromXML(patternNodes.next());
pattern.addPattern(p);
}
break;
}
}
return pattern;
}
Aggregations