/// <summary> /// Build an array of the list of <c>SelfTestIdentifier_t</c> records associated with each unique <c>SELFTESTID</c> value defined in the <c>SELFTESTIDS</c> /// table of the data dictionary. The array element is mapped to the <c>SELFTESTID</c> field of the table. /// </summary> /// <param name="selfTestIdentifiersDataTable">Reference to the <c>SELFTESTIDS</c> data table of the data dictionary.</param> /// <returns>An array of lists of <c>SelfTestIdentifier_t</c> records associated with each unique <c>SELFTESTID</c> value in the <c>SELFTESTIDS</c> table of the /// data dictionary, if the parameters are valid; otherwise, null.</returns> protected virtual List <SelfTestIdentifier_t>[] BuildSelfTestIdentifierLists(DataDictionary.SELFTESTIDSDataTable selfTestIdentifiersDataTable) { // Local copy of the data table. List <SelfTestIdentifier_t>[] records; if (selfTestIdentifiersDataTable == null) { return(null); } try { // Determine the maximum value of the identifier field in the data table, it cannot be assumed that the table is sorted by identifier. int iDMax = 0; int iDCurrent = 0; for (int recordIndex = 0; recordIndex < selfTestIdentifiersDataTable.Count; recordIndex++) { iDCurrent = selfTestIdentifiersDataTable[recordIndex].SELFTESTID; if (iDCurrent > iDMax) { iDMax = iDCurrent; } } // Instantiate the lookup array. records = new List <SelfTestIdentifier_t> [iDMax + 1]; // Instantiate a generic list for each element of the array. for (int recordIndex = 0; recordIndex < iDMax + 1; recordIndex++) { records[recordIndex] = new List <SelfTestIdentifier_t>(); } // Populate the lookup table; int identifier; DataDictionary.SELFTESTIDSRow row; for (int recordIndex = 0; recordIndex < selfTestIdentifiersDataTable.Count; recordIndex++) { row = selfTestIdentifiersDataTable[recordIndex]; identifier = row.SELFTESTID; // Instantiate a new structure to contain the data and copy the data across. SelfTestIdentifier_t record = new SelfTestIdentifier_t(); record.SelfTestIdentifier = row.SELFTESTID; record.SelfTestNumber = row.SELFTESTNUMBER; record.SelfTestVariableIdentifier = row.SELFTESTVARID; // Add the record to the correct element of the array. records[identifier].Add(record); } } catch (Exception) { return(null); } return(records); }
/// <summary> /// Initialize a new instance of the class. /// </summary> /// <param name="dataTable">>Reference to the <c>SELFTEST</c> table of the data dictionary. This table contains the self test definitions.</param> /// <param name="selfTestIdentifiersDataTable">Reference to the <c>SELFTESTIDS</c> table of the data dictionary. This table defines which self test /// variables are associated with each self test.</param> /// <param name="testMessagesDataTable">Reference to the <c>TESTMESSAGES</c> table of the data dictionary. This table defines the help index of the /// test messages associated with the test case value for each test number.</param> public SelfTestTable(DataDictionary.SELFTESTDataTable dataTable, DataDictionary.SELFTESTIDSDataTable selfTestIdentifiersDataTable, DataDictionary.TESTMESSAGESDataTable testMessagesDataTable) : base(dataTable) { if (selfTestIdentifiersDataTable == null) { return; } m_SelfTestDataTable = dataTable; m_SelfTestIdentifierLists = BuildSelfTestIdentifierLists(selfTestIdentifiersDataTable); AddSelfTestVariableLists(); m_TestMessageLists = BuildTestMessageLists(testMessagesDataTable); }
/// <summary> /// Initialize a new instance of the class. /// </summary> /// <param name="dataTable">>Reference to the <c>SELFTEST</c> table of the data dictionary. This table contains the self test definitions.</param> /// <param name="selfTestIdentifiersDataTable">Reference to the <c>SELFTESTIDS</c> table of the data dictionary. This table defines which self test /// variables are associated with each self test.</param> /// <param name="testMessagesDataTable">Reference to the <c>TESTMESSAGES</c> table of the data dictionary. This table defines the help index of the /// test messages associated with the test case value for each test number.</param> public SelfTestTableBySelfTestNumber(DataDictionary.SELFTESTDataTable dataTable, DataDictionary.SELFTESTIDSDataTable selfTestIdentifiersDataTable, DataDictionary.TESTMESSAGESDataTable testMessagesDataTable) : base(dataTable, selfTestIdentifiersDataTable, testMessagesDataTable) { }