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; }
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; }
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; }