//update DCompMatrix by index public void add(int depth, DCompRow row, GasMix gasMix) { if (!m_AirTable.ContainsKey(depth)) { m_AirTable.Add(depth, new DCompMatrix()); } if (!m_AirO2Table.ContainsKey(depth)) { m_AirO2Table.Add(depth, new DCompMatrix()); } switch (gasMix) { case GasMix.AIR: m_AirTable[depth].addDComp(row); break; case GasMix.AIRO2: m_AirO2Table[depth].addDComp(row); break; case GasMix.NONE: default: Console.Write("failed to add element on DCompTable"); break; } //implemented in updateBTLUT //g_depthList.Add(depth); }
public void addDComp(DCompRow newDComp) { this.m_DComps[newDComp.m_BottomTime] = newDComp; this.m_bottomTimesLUT.Add(newDComp.m_BottomTime); }
//Update result and calls UI //UpdateGasMix is called inside //if ( depth, BT, gasMix ) { search_DCompRow(); show(); } void UpdateResult() { UpdateGasMix(); //if not ready, return if (!isResultReady()) { return; } //show result int tableDepth = 0, tableBT = 0; g_curDCompRow = searchDComp(g_MaxDepth, g_BottomTime, g_GasMix, ref tableDepth, ref tableBT); var row = g_curDCompRow; //update GUI if (row.isInitialized) { TB_DCompTable.Text = "[ FSW: " + tableDepth.ToString() + ", BT: " + tableBT.ToString() + " ]"; TB_Time_To_R1st_Planned.Text = colonizeTime(row.m_TimeToFirstStop, ColonType.SEC4DIGITS); UpdateTimeTo1stStop(); TB_Repeat_Group.Text = ((row.m_RepeatGroup.ToString()) == "0") ? scr.alias["WORD_No_Repeat_Group"] : row.m_RepeatGroup.ToString(); foreach (var elem in g_TB_FSW_Results) { elem.Text = "-"; } foreach (var stop in row.m_DCompStops) { //specialize for No decompression if (stop.Key == 20 && stop.Value == 0) { TB_DCompTable.Text = "[ " + scr.alias["WORD_No_Decomp"] + " ]"; CORNER_LB.Text = "-"; break; } g_FSW2Interval[stop.Key].Text = colonizeTime(stop.Value); } //update pause time first var reversed = row.m_DCompStops_including_pause_time.OrderByDescending(i => i.Key); HSYS lastLeave = hTimes.g_R1st_Stop; int R1stMinute = lastLeave.TotalMinutes(); hTimes.g_DCompStop_Leave = new SortedDictionary <int, HSYS>(); hTimes.g_DCompStop_Reach = new SortedDictionary <int, HSYS>(); foreach (var stop in reversed) { int depth = stop.Key; int min = stop.Value; //init hTimes.g_DCompStop_Leave.Add(depth, new HSYS()); hTimes.g_DCompStop_Reach.Add(depth, new HSYS()); HSYS toStop = new HSYS(0, 0); toStop.addMin(min); // add 1 minute if not first stop //if (lastLeave.TotalMinutes() != R1stMinute) //{ // lastLeave.addMin(1); //} hTimes.g_DCompStop_Reach[depth] = lastLeave; hTimes.g_DCompStop_Leave[depth] = lastLeave + toStop; lastLeave = hTimes.g_DCompStop_Reach[depth] + toStop; } if ((hTimes.g_DCompStop_Leave).Count > 0) { //gets called by reference... //hTimes.g_RS = hTimes.g_DCompStop_Leave[20]; hTimes.g_RS = lastLeave; //up to surface hTimes.g_RS.addMin(1); hTimes.g_TTD = hTimes.g_RS - hTimes.g_LS; } { TB_RS.Text = hTimes.g_RS.ToString(); TB_TTD.Text = colonizeTime(hTimes.g_TTD); } //pauses related UI update // interval foreach (var stop in row.m_DComp_pauses_data) { int dataLength = stop.Value.Count; //for AIR/O2 Decompression if (stop.Value.Count != 1) { var t = g_FSW2Interval[stop.Key].Text; g_FSW2Interval[stop.Key].Text = t + " { "; //decltype(stop.Value) = List<int> foreach (var min in stop.Value) { g_FSW2Interval[stop.Key].Text = g_FSW2Interval[stop.Key].Text + colonizeTime(min) + " "; } g_FSW2Interval[stop.Key].Text = g_FSW2Interval[stop.Key].Text + "}"; } } // Clocktime foreach (var stop in row.m_DCompStops_including_pause_time) { int depth = stop.Key; string filler = ":"; g_FSW2Time[depth].Text = hTimes.g_DCompStop_Reach[depth].ToString(filler) + " ~ " + hTimes.g_DCompStop_Leave[depth].ToString(filler); } //TDT hTimes.g_TDT = hTimes.g_RS - hTimes.g_LB; CORNER_LB.Text = colonizeTime(hTimes.g_TDT); } else { string noData = scr.alias["WORD_No_Data"]; TB_DCompTable.Text = noData; TB_Time_To_R1st_Planned.Text = noData; TB_Repeat_Group.Text = noData; TB_DCompTable.Text = noData; TB_Time_To_R1st_Actual.Text = noData; } }