コード例 #1
0
 void CalculateClick(object sender, RoutedEventArgs e)
 {
     var analyzer = new FloatAnalyzer();
     var values = analyzer.Enumerate(CreateFloatDescription()).ToArray();
     Array.Sort(values);
     output.Clear();
     var lcount = int.Parse(perLine.SelectionBoxItem.ToString());
     var i = 1;
     foreach (var v in values) {
         output.AppendText(v.ToString().PadRight(15));
         output.AppendText(_delimiter);
         if (_delimiter != "\n" && i % lcount == 0) {
             output.AppendText("\r\n");
         }
         i++;
     }
     output.ScrollToEnd();
 }
コード例 #2
0
        void GeneratePatternsClick(object sender, RoutedEventArgs e)
        {
            var minValue = min.Value.Value;
            var maxValue = max.Value.Value;
            var stepValue = increment.Value.Value;
            var sumValue = sum.Value.Value;
            var range = new Range {
                Min = minValue,
                Max = maxValue,
                Step = stepValue
            };
            var pgen = new PatternGen {
                Range = range,
                Sum = sumValue,
            };
            var desc = CreateFloatDescription();
            var analyzer = new FloatAnalyzer();

            output.Clear();

            //var patterns = pgen.Generate().OrderBy(v => analyzer.FromIntegerValue(desc,v.GetBytes()));
            var patterns = pgen.Generate();
            foreach (var p in patterns) {
                var bcount = desc.BitCount / 8;
                if (desc.BitCount % 8 != 0) {
                    bcount += 1;
                }
                var floatValue = analyzer.FromBytes(desc, p.GetBytes().Take(bcount).ToArray());
                output.AppendText(string.Format("{0} {1}", p, floatValue));
                output.AppendText("\n");
            }
        }