/// <summary> /// Sets up the data lists to display the reservoir collection data in the GUI. /// </summary> private void setupData() { int[] years = null; int yearArrayLen = 0; int nwell = _data.size(); int nParts = 0; int nIdTypes = 0; StateMod_Well well = null; string colType = null; string id = null; string partType = null; System.Collections.IList ids = null; System.Collections.IList idTypes = null; string idType = null; __data = new System.Collections.IList[__COLUMNS]; for (int i = 0; i < __COLUMNS; i++) { __data[i] = new List <object>(); } int rows = 0; for (int i = 0; i < nwell; i++) { well = (StateMod_Well)_data.get(i); id = well.getID(); years = well.getCollectionYears(); colType = well.getCollectionType(); partType = well.getCollectionPartType(); if (years == null) { yearArrayLen = 1; // Cause the loop below to go through once } else { yearArrayLen = years.Length; } for (int j = 0; j < yearArrayLen; j++) { // Part IDs for the year if ((years == null) || (years.Length == 0)) { ids = well.getCollectionPartIDs(0); } else { ids = well.getCollectionPartIDs(years[j]); } if (ids == null) { nParts = 0; } else { nParts = ids.Count; } // Part ID types for the year. idTypes = well.getCollectionPartIDTypes(); if (idTypes == null) { nIdTypes = 0; } else { nIdTypes = idTypes.Count; } for (int k = 0; k < nParts; k++) { __data[__COL_ID].Add(id); __data[__COL_YEAR].Add(new int?(years[j])); __data[__COL_COL_TYPE].Add(colType); __data[__COL_PART_TYPE].Add(partType); __data[__COL_PART_ID].Add(ids[k]); idType = ""; if (nIdTypes != 0) { idType = (string)idTypes[k]; // Should align with ids.get(k) } __data[__COL_PART_ID_TYPE].Add(idType); rows++; } } } _rows = rows; }