private void getLinearIntervalDoublePairFromString(String source) { String left = "", right = "", count = ""; int index = 0; parseleftBorder(source, ref left, ref index); parseRightBorder(source, ref right, ref index); parseCount(source, ref count, ref index); double leftBorder = 0; if (!Double.TryParse(left, out leftBorder)) { leftBorder = (double)Int32.Parse(left); } double rightBorder = 0; if (!Double.TryParse(right, out rightBorder)) { rightBorder = (double)Int32.Parse(right); } double countValue = 0; if (!Double.TryParse(count, out countValue)) { countValue = (double)Int32.Parse(count); } lastReadedInterval = new LinearInterval(leftBorder, rightBorder); lastCount = countValue; }
public int CompareTo(object obj) { if (obj == null) { return(0); } LinearInterval b = obj as LinearInterval; return(this.LeftBorder.CompareTo(b.LeftBorder)); }
private void addIntervalsWithValues(int intervalsCount) { double leftBorder = getLeftBorderFromAllSelection(); double rightBorder = leftBorder + deltaInterval; for (int i = 1; i <= intervalsCount; i++) { LinearInterval interval = new LinearInterval(leftBorder, rightBorder); //прошу прощения за непонятную функцию, она как раз считает n* итые для каждого интервала //i там нужно, чтобы правильно посчитать граничные значения у интервалов int value = calculateValueOnIntervalHelpsNumberOfInterval(interval, i); table.Add(interval, value); leftBorder = rightBorder; rightBorder = leftBorder + deltaInterval; } }
private int calculateValueOnIntervalHelpsNumberOfInterval(LinearInterval interval, int intervalIndex) { int value = 0; foreach (KeyValuePair <double, int> pair in varSeries.SeriesTable) { if (intervalIndex == 1 && interval.valueIsBelongsIncludingLeftAndRightBorders(pair.Key)) { value += pair.Value; } else if (intervalIndex != 1 && interval.valueIsBelongsIncludingRightBorders(pair.Key)) { value += pair.Value; } } return(value); }
private void readIntervalsGrid() { SortedDictionary <LinearInterval, double> intervalSeriesTable = new SortedDictionary <LinearInterval, double>(); // Считать ряд из таблицы LinearInterval bufInterval; double leftBorder, rightBorder, freq; for (int i = 0; i < dgvIntervals.Rows.Count; i++) { leftBorder = Convert.ToDouble(dgvIntervals.Rows[i].Cells[0].Value); rightBorder = Convert.ToDouble(dgvIntervals.Rows[i].Cells[1].Value); freq = Convert.ToDouble(dgvIntervals.Rows[i].Cells[2].Value); bufInterval = new LinearInterval(leftBorder, rightBorder); intervalSeriesTable.Add(bufInterval, freq); } // Получить интервальные ряды intSeries = IntervalVariationStatisticSeries.calculateSeriesFromReadySeries(intervalSeriesTable); }
private void calculateDeltaInterval(int intervalsCount) { LinearInterval allSelectionInterval = new LinearInterval(getLeftBorderFromAllSelection(), getRightBorderFromAllSelection()); deltaInterval = allSelectionInterval.Length / (double)intervalsCount; }