Search in sources :

Example 71 with Element

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;
}
Also used : Element(electric.xml.Element) Iterator(java.util.Iterator)

Example 72 with Element

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;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 73 with Element

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;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 74 with Element

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;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 75 with Element

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;
}
Also used : Element(electric.xml.Element)

Aggregations

Element (electric.xml.Element)310 Elements (electric.xml.Elements)120 Document (electric.xml.Document)22 Vector (java.util.Vector)14 Iterator (java.util.Iterator)12 File (java.io.File)10 BigDecimal (java.math.BigDecimal)10 IOException (java.io.IOException)8 SoundObject (blue.soundObject.SoundObject)7 ParseException (electric.xml.ParseException)7 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)4 EffectOption (blue.tools.blueShare.effects.EffectOption)3 InstrumentOption (blue.tools.blueShare.instruments.InstrumentOption)3 SoundObjectOption (blue.tools.blueShare.soundObjects.SoundObjectOption)3 OpcodeList (blue.udo.OpcodeList)3 Test (org.junit.Test)3 ParameterList (blue.automation.ParameterList)2 LiveObject (blue.blueLive.LiveObject)2 LiveObjectBins (blue.blueLive.LiveObjectBins)2 Line (blue.components.lines.Line)2