/// <summary> /// /// </summary> /// <param name="srcSet"></param> /// <param name="Defn"></param> protected void copyDefinition(TParameterSet srcSet, TParameterDefinition Defn) { int Idx; if ((Defn.bIsScalar()) && (srcSet != null) && (srcSet.bIsDefined(Defn.sFullName))) { switch (Defn.paramType) { case ptyReal: setParam(Defn.sFullName, srcSet.fParam(Defn.sFullName)); break; case ptyInt: setParam(Defn.sFullName, srcSet.iParam(Defn.sFullName)); break; case ptyBool: setParam(Defn.sFullName, srcSet.bParam(Defn.sFullName)); break; case ptyText: setParam(Defn.sFullName, srcSet.sParam(Defn.sFullName)); break; } } else if (Defn.bIsScalar()) setUndefined(Defn.sFullName); else for (Idx = 0; Idx <= Defn.iCount - 1; Idx++) copyDefinition(srcSet, Defn.item(Idx)); }
private void writeParameters(TParameterSet subSet, TParameterDefinition Definition, List<string> Strings, int iIndent) { int iDiffCount; string sLine; int Idx; if (Definition.iDimension() > 1) // Multi-dimensional array of for (Idx = 0; Idx <= Definition.iCount - 1; Idx++) // parameters - recurse writeParameters(subSet, Definition.item(Idx), Strings, iIndent); else if (Definition.bIsScalar() && bDiffers(subSet, Definition)) // Single parameter value { sLine = new string(' ', iIndent) + "<par name=\"" + Definition.sFullName + "\">" + subSet.sParam(Definition.sFullName) + "</par>"; Strings.Add(sLine); } else // List of parameter values (one- { // dimensional) iDiffCount = 0; for (Idx = 0; Idx <= Definition.iCount - 1; Idx++) if (bDiffers(subSet, Definition.item(Idx))) iDiffCount++; if (iDiffCount > 1) // More than one difference - write { // the differing values in a list sLine = new string(' ', iIndent) + "<par name=\"" + Definition.sFullName + "\">"; for (Idx = 0; Idx <= Definition.iCount - 1; Idx++) { if (Idx > 0) sLine += ','; if (bDiffers(subSet, Definition.item(Idx))) sLine += subSet.sParam(Definition.item(Idx).sFullName); } sLine += "</par>"; Strings.Add(sLine); } else if (iDiffCount == 1) // Only one parameter is different - for (Idx = 0; Idx <= Definition.iCount - 1; Idx++) // write it as a scalar if (bDiffers(subSet, Definition.item(Idx))) writeParameters(subSet, Definition.item(Idx), Strings, iIndent); } }