public void Update() { IEnumerable <CoefficientDisplayModel> coefficientDisplayModels = facade.GetAll(); Coefficients.Clear(); foreach (CoefficientDisplayModel coefficientDisplayModel in coefficientDisplayModels) { Coefficients.Add(coefficientDisplayModel); } }
public void ConvertByteArrayToCoefficients(BitArray array) { Coefficients.Clear(); for (int i = 0; i < _degree + 1; i++) { byte[] coefficientArr = array.ToByteArray().Skip(i * sizeof(double)).Take(sizeof(double)).ToArray(); double value = BitConverter.ToDouble(array.ToByteArray(), i * sizeof(double)); while (double.IsNaN(value)) { // Console.WriteLine(string.Concat(array.Cast<bool>().Select(Convert.ToByte))); //Console.WriteLine(coefficientArr.ToBinaryString()); array.Set((i + 1) * sizeof(double) * 8 - _randomProvider.Next(17) - 1, false); coefficientArr = array.ToByteArray().Skip(i * sizeof(double)).Take(sizeof(double)).ToArray(); value = BitConverter.ToDouble(array.ToByteArray(), i * sizeof(double)); } Coefficients.Add(value); } }