public static CCMRow resolveConflictRow(List <CCMRow> rows, CCMRow row2) { Boolean isConflict = false; CCMRow row1 = rows[rows.Count - 2]; for (int i = 0; i < rows.Count - 1; i++) { CCMRow tempRow = rows[i]; if (tempRow.startTime <= row2.startTime && tempRow.endTime >= row2.startTime) { isConflict = true; break; } } if (isConflict) { CCMRow newRow = (CCMRow)row2.Clone(); newRow.startTime = row1.endTime.AddMinutes(1); return(newRow); } else { return(null); } return(null); }
public static CCMRow mergeRow(CCMRow row1, CCMRow row2) { double direction1 = row1.endPt - row1.startPt; double direction2 = row2.endPt - row2.startPt; Boolean isConflict = false; if (row1.startTime <= row2.startTime && row1.endTime >= row2.startTime) { isConflict = true; } if (direction1 * direction2 > 0 && row1.isMomentumDetected && row2.isMomentumDetected && isConflict) { CCMRow newRow = (CCMRow)row2.Clone(); newRow.startPt = row1.startPt; newRow.startTime = row1.startTime; newRow.endPt = row2.endPt; newRow.endTime = row2.endTime; newRow.deltaPt = Math.Abs(newRow.endPt - newRow.startPt); newRow.isMomentumDetected = true; return(newRow); } else { return(null); } return(null); }
public static CCMRow resolveConflictRow(CCMRow row1, CCMRow row2) { Boolean isConflict = false; if (row1.startTime <= row2.startTime && row1.endTime >= row2.startTime) { isConflict = true; } if (isConflict) { CCMRow newRow = (CCMRow)row2.Clone(); newRow.startTime = row1.endTime.AddMinutes(1); return(newRow); } else { return(null); } return(null); }