예제 #1
0
  public static Generator loadFromXML(Element data) {
    ItemList retVal = new ItemList();

    Elements nodes = data.getElements();

    while (nodes.hasMoreElements()) {
      Element node = nodes.next();
      String nodeName = node.getName();
      switch (nodeName) {
        case "listType":
          retVal.setListType(Integer.parseInt(node.getTextString()));
          break;
        case "listItems":
          Elements items = node.getElements();
          while (items.hasMoreElements()) {
            Element itemNode = items.next();
            String itemNodeName = itemNode.getName();

            if (itemNodeName.equals("item")) {
              retVal.listItems.add(Double.valueOf(itemNode.getTextString()));
            }
          }
          break;
        case "index":
          retVal.index = Integer.parseInt(node.getTextString());
          break;
        case "direction":
          retVal.direction = Integer.parseInt(node.getTextString());
          break;
      }
    }

    return retVal;
  }
예제 #2
0
  public static UserDefinedOpcode loadFromXML(Element data) {
    UserDefinedOpcode retVal = new UserDefinedOpcode();

    Elements nodes = data.getElements();

    while (nodes.hasMoreElements()) {
      Element node = nodes.next();

      String val = node.getTextString();

      if (val == null) {
        val = "";
      }
      switch (node.getName()) {
        case "opcodeName":
          retVal.opcodeName = val;
          break;
        case "outTypes":
          retVal.outTypes = val;
          break;
        case "inTypes":
          retVal.inTypes = val;
          break;
        case "codeBody":
          retVal.codeBody = val;
          break;
        case "comments":
          retVal.comments = val;
          break;
      }
    }

    return retVal;
  }
예제 #3
0
  /*
   * (non-Javadoc)
   *
   * @see blue.orchestra.blueSynthBuilder.BlueSynthBuilderObject#saveAsXML()
   */
  public Element saveAsXML() {
    Element retVal = getBasicXML(this);

    retVal.addElement("label").setText(label);

    return retVal;
  }
예제 #4
0
  public Element saveAsXML(Map<Object, String> objRefMap) {
    Element retVal = SoundObjectUtilities.getBasicXML(this);

    for (Iterator iter = lines.iterator(); iter.hasNext(); ) {
      Line line = (Line) iter.next();
      retVal.addElement(line.saveAsXML());
    }

    return retVal;
  }
예제 #5
0
  public electric.xml.Element saveAsXML() {
    Element retVal = new Element("udo");

    retVal.addElement("opcodeName").setText(opcodeName);
    retVal.addElement("outTypes").setText(outTypes);
    retVal.addElement("inTypes").setText(inTypes);
    retVal.addElement("codeBody").setText(codeBody);
    retVal.addElement("comments").setText(comments);

    return retVal;
  }
예제 #6
0
  public static BSBObject loadFromXML(Element data) {
    BSBLabel label = new BSBLabel();
    initBasicFromXML(data, label);

    label.setLabel(data.getTextString("label"));

    return label;
  }
예제 #7
0
  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();

      if (nodeName.equals("direction")) {
        retVal.direction = XMLUtilities.readInt(node);
      } else if (nodeName.equals("lambda")) {
        retVal.lambda = XMLUtilities.readDouble(node);
      } else if (nodeName.equals("lambdaTableEnabled")) {
        retVal.lambdaTableEnabled = XMLUtilities.readBoolean(node);
      } else if (nodeName.equals("table")) {
        retVal.lambdaTable = Table.loadFromXML(node);
      }
    }

    return retVal;
  }
예제 #8
0
  public Element saveAsXML() {
    Element retVal = new Element("probabilityGenerator");
    retVal.setAttribute("type", getClass().getName());

    retVal.addElement(XMLUtilities.writeInt("direction", direction));
    retVal.addElement(XMLUtilities.writeDouble("lambda", lambda));
    retVal.addElement(XMLUtilities.writeBoolean("lambdaTableEnabled", lambdaTableEnabled));
    retVal.addElement(lambdaTable.saveAsXML());

    return retVal;
  }
  @Override
  public BlueDataObject loadFromXML(Element element) {

    String bdoType = element.getAttributeValue("bdoType");

    if (bdoType == null) {
      throw new BlueDataObjectLoadException("Invalid XML found: Could not find bdoType attribute.");
    }

    BlueDataObjectLoader loader = loaders.get(bdoType);
    if (loader == null) {
      throw new BlueDataObjectLoadException(
          "Unable to find loader for BlueDataObject of type: " + bdoType);
    }

    return loader.loadFromXML(element);
  }
예제 #10
0
  @Override
  public Element saveAsXML() {
    Element retVal = new Element("generator");
    retVal.setAttribute("type", getClass().getName());

    retVal.addElement(XMLUtilities.writeInt("listType", getListType()));
    retVal.addElement(XMLUtilities.writeInt("index", index));
    retVal.addElement(XMLUtilities.writeInt("direction", direction));

    Element items = new Element("listItems");

    for (Iterator it = listItems.iterator(); it.hasNext(); ) {
      Double item = (Double) it.next();

      items.addElement("item").setText(item.toString());
    }

    retVal.addElement(items);

    return retVal;
  }
예제 #11
0
  /*
   * (non-Javadoc)
   *
   * @see blue.noteProcessor.NoteProcessor#saveAsXML()
   */
  public Element saveAsXML() {
    Element retVal = new Element("noteProcessor");
    retVal.setAttribute("type", this.getClass().getName());

    return retVal;
  }
예제 #12
0
  public Element saveAsXML() {
    Element retVal = new Element("udoLibrary");
    retVal.addElement(rootUDOCategory.saveAsXML());

    return retVal;
  }
예제 #13
0
  public static UDOLibrary loadFromXML(Element data) throws Exception {
    UDOLibrary iLibrary = new UDOLibrary();
    iLibrary.setRootUDOCategory(UDOCategory.loadFromXML(data.getElement("udoCategory")));

    return iLibrary;
  }