package com.engineous.component.plate; import com.engineous.sdk.exception.IException; import com.engineous.sdk.model.exceptions.DtModelException; import com.engineous.sdk.resmgr.ResMgr; import com.engineous.sdk.runtime.PostProcessor; import com.engineous.sdk.runtime.RunResultData; import com.engineous.sdk.model.*; import com.engineous.sdk.vars.*; import java.util.*; //=============================================================== ========== /** * Title: PlatePostProcessor <br> * Description: Post processor class for plate component<br> * Copyright: Copyright (c) 2004<br> * Company: Engineous Software Inc.<br> * @author Engineous Software Inc.<br> */ //=============================================================== ========== public class PlatePostProcessor extends AbstractSystemExtension implements PostProcessor { private transient static final Class CLASS = PlatePostProcessor.class; //============================================================= /** * Method getSummary * This method returns the summary for plate execution * @param rrData * @return String * @throws VariableException * @throws DtModelException */ //============================================================= == public String getSummary(RunResultData rrData) throws IException { DtComponent component = rrData.getComponent(); StringBuffer buffer = new StringBuffer(); buffer.append(ResMgr.getMessage(CLASS, 0, "\nExecution summary for component ")).append(component.getName()); String shape = ((DtScalarVariable)component.getProperty("Shape")). getValueObj().getAsString(); buffer.append("\n\nShape: "+shape); String material = ((DtScalarVariable)component.getProperty("Material")). getValueObj().getAsString(); buffer.append("\nMaterial: "+material); double thickness = rrData.getValue(0, component.getParameter ("Thickness")).getAsReal(); buffer.append("\nThickness: "+Double.toString(thickness)); AggregateVariable dimensionsVar = (AggregateVariable)component. getParameter("Dimensions");buffer.append("\nDimensions:") ; Iterator dimIter = dimensionsVar.getMemberList().iterator(); while (dimIter.hasNext()) { ScalarVariable nextDim = (ScalarVariable)dimIter.next(); String dimName = nextDim.getName(); String dimVal = nextDim.getValueObj().getAsString(); buffer.append("\n\t"+dimName+": "+dimVal); } buffer.append("\n\n************* Results **************"); String area = rrData.getValue(0, component.getParameter ("Area")).getAsString(); String volume = rrData.getValue(0, component.getParameter ("Volume")).getAsString(); String weight = rrData.getValue(0, component.getParameter ("Weight")).getAsString(); buffer.append("\nArea: "+area); buffer.append("\nVolume: "+volume); buffer.append("\nWeight: "); return buffer.toString(); } //============================================================= ========= /** * Returns a list of the variables *(com.engineous.sdk.vars.VariableReference * objects) whose values are needed following execution to create a *summary * for this component that is created and returned by the getSummary() * method. * * @param component * @return List of com.engineous.sdk.vars.VariableReference objects * @throws DtModelException, VariableException * @throws VariableException */ //============================================================= ========= public List getVariablesForDataView(DtComponent component) throws DtModelException, VariableException { // Need all parameters for this component ArrayList varRefList = new ArrayList(); Iterator parmIter = component.getParameterList().iterator(); while (parmIter.hasNext()) { Variable nextVar = (Variable)parmIter.next(); varRefList.add(new VariableReference(nextVar)); } return varRefList; } } |