/** * Using specified output (dependent) variable name, look for such a declared variable. If not * found, create appropriate one. * * @param function JDOM function Element */ protected String hookUpOutput(Element function) { // Parse and discover dependent variable ID Element depVar = function.getChild("dependentVarRef", this.ns); if (depVar == null) depVar = function.getChild("dependentVarPts", this.ns); // simple table String depVarID = depVar.getAttributeValue("varID"); Iterator<Signal> sigIterator = this.ourModel.getSignals().iterator(); boolean depVarSignalFound = false; Signal dVsig = null; // Look for existing variable definition (signal) while (sigIterator.hasNext()) { // look for matching explicit signal dVsig = sigIterator.next(); if (depVarID.equals(dVsig.getVarID())) { depVarSignalFound = true; break; } } /* // if not found, make our own if (!depVarSignalFound) { // create and connect to new signal dVsig = new Signal( depVarName, depVarName, "unkn", 10, m ); } */ // if not found, complain if (!depVarSignalFound) { System.err.println( "Unable to locate output signal with ID '" + depVarID + "' for Function block '" + this.getName() + "'."); System.exit(0); } try { this.addOutput(dVsig); // connect to new or existing signal } catch (DAVEException e) { System.err.println( "Unexpected error: new Function block '" + this.getName() + "' is unable to hook up to output signal ID '" + depVarID + "':"); System.err.println(e.getMessage()); System.exit(0); } return dVsig.getName(); }