public void addChild(InputElement input) { if (childElements == null) { childElements = new ArrayList<InputElement>(1); } else if (childElements.size() > 0) { InputElement last = childElements.get(childElements.size() - 1); last.nextElement = input; } childElements.add(input); input.parentElement = this; }
public void addNext(InputElement input) { if (parentElement != null) { int index = parentElement.childElements.indexOf(this); parentElement.childElements.add(index + 1, input); InputElement next = nextElement; nextElement = input; input.nextElement = next; } input.parentElement = this.parentElement; }
@Override public NumberStatistics newInstance( final Class<NumberStatistics> type, final InputElement xml) throws XMLStreamException { final Statistics stats = Statistics.XML.newInstance(Statistics.class, xml); final Float64 fitnessMean = xml.get(FITNESS_MEAN); final Float64 fitnessVariance = xml.get(FITNESS_VARIANCE); final Float64 errorOfMean = xml.get(ERROR_OF_MEAN); final Builder builder = new Builder().statistics(stats); builder.fitnessMean(fitnessMean.doubleValue()); builder.fitnessVariance(fitnessVariance.doubleValue()); builder.standardError(errorOfMean.doubleValue()); return builder.build(); }
private static InputElement extractInputElement(Element inputElementElement) { InputElement inputElement = new InputElement(); inputElement.elementName = inputElementElement.getAttribute(NAME_ATTRIBUTE); inputElement.logEntry = (Boolean.toString(true).equals(inputElementElement.getAttribute(LOG_ENTRY_ATTRIBUTE))) ? true : false; NodeList nodeList = inputElementElement.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); String nodeName = node.getNodeName(); if (nodeName.equals(INPUT_DATA_ELEMENT)) { Element inputDataElement = (Element) node; inputElement.inputName = inputDataElement.getAttribute(NAME_ATTRIBUTE); inputElement.inputAction = Integer.parseInt(inputDataElement.getAttribute(ACTION_ATTRIBUTE)); inputElement.inputFormat = inputDataElement.getAttribute(FORMAT_ATTRIBUTE); } else if (nodeName.equals(ATTRIBUTE_ELEMENT)) { Element attributeElement = (Element) node; InputAttribute attribute = new InputAttribute(); attribute.attributeName = attributeElement.getAttribute(NAME_ATTRIBUTE); NodeList attributeNodeList = attributeElement.getChildNodes(); for (int j = 0; j < attributeNodeList.getLength(); j++) { Node attributeNode = attributeNodeList.item(j); String attributeNodeName = attributeNode.getNodeName(); if (attributeNodeName.equals(INPUT_DATA_ELEMENT)) { Element inputDataElement = (Element) attributeNode; attribute.inputName = inputDataElement.getAttribute(NAME_ATTRIBUTE); attribute.inputAction = Integer.parseInt(inputDataElement.getAttribute(ACTION_ATTRIBUTE)); attribute.inputFormat = inputDataElement.getAttribute(FORMAT_ATTRIBUTE); } } inputElement.addAttribute(attribute); } else if (nodeName.equals(INPUT_ELEMENT_ELEMENT)) { Element childInputElementElement = (Element) node; InputElement childInputElement = extractInputElement(childInputElementElement); if (childInputElement != null) { inputElement.addChild(childInputElement); } } } return inputElement; }
public void read(InputElement xml, RemoteSignalingPointCodeImpl ai) throws XMLStreamException { ai.remoteSpc = xml.getAttribute(REMOTE_SPC).toInt(); ai.remoteSpcFlag = xml.getAttribute(REMOTE_SPC_FLAG).toInt(); ai.mask = xml.getAttribute(MASK).toInt(); }
@Override public void read(InputElement ie, Rank r) throws XMLStreamException { r.rank = ie.getAttribute("rank").toInt(); }
public void read(InputElement xml, TestCapSsfConfigurationData srv) throws XMLStreamException { String cpv = (String) xml.get(CAP_APPLICATION_CONTEXT, String.class); srv.capApplicationContext = CapApplicationContextSsf.createInstance(cpv); }
@Override public Rank newInstance(Class<Rank> cls, InputElement ie) throws XMLStreamException { return new Rank(ie.getAttribute("rank").toInt()); }
@Override public void read(InputElement ie, Point2D pt) throws XMLStreamException { pt.x = ie.getAttribute("x", 0.0); pt.y = ie.getAttribute("y", 0.0); }
@Override public Point2D newInstance(Class<Point2D> cls, InputElement ie) throws XMLStreamException { return new Point2D(ie.getAttribute("x", 0.0), ie.getAttribute("y", 0.0)); }
@Override public void read(InputElement ie, Alternative alt) throws XMLStreamException { alt.name = ie.getAttribute("name", ""); }
@Override public Alternative newInstance(Class<Alternative> cls, InputElement ie) throws XMLStreamException { return new Alternative(ie.getAttribute("name", "")); }