Example #1
0
 public void FindClosestValueTest()
 {
     CompositeRange compositeRange = new CompositeRange(new List <Range <float> >()
     {
         range1, range2
     });
     float closestValue = compositeRange.FindClosestValue(905.5f);
 }
        private MetricUnitScale()
        {
            MetricEnumType = null;

            _unitScale = CompositeRange <double, MetricUnit> .Empty;

            _unitsByEnumValue = new Dictionary <Enum, MetricUnit>();
            _unitsByName      = new Dictionary <string, MetricUnit>();
        }
Example #3
0
 public virtual VScrollbar CreateVScrollbar(CompositeRange ViewRange)
 {
     VScrollbar NewScrollbar = new VScrollbar(ViewRange);
     NewScrollbar.SuspendLayout = true;
     NewScrollbar.Background = CreateRectangle();
     NewScrollbar.ButtonUp = CreateButtonUp();
     NewScrollbar.ButtonDown = CreateButtonDown();
     NewScrollbar.Thumb = CreateThumb();
     NewScrollbar.SuspendLayout = false;
     return NewScrollbar;
 }
        private MetricUnitScale([NotNull] Type metricEnumType)
        {
            Code.NotNull(metricEnumType, nameof(metricEnumType));

            var metricUnits = GetMetricUnits(metricEnumType);

            MetricEnumType = metricEnumType;

            _unitScale = metricUnits
                         .ToCompositeRangeFrom(s => s.AppliesFrom)
                         .ExtendFrom(0);        // Support for values less than first enum value.

            _unitsByEnumValue = metricUnits.ToDictionary(u => u.EnumValue);
            _unitsByName      = metricUnits.ToDictionary(u => u.DisplayName, StringComparer.InvariantCultureIgnoreCase);
        }
Example #5
0
        /// <summary>Initializes a new instance of the <see cref="SourceAnnotationInfo"/> class.</summary>
        /// <param name="path">The path to the source file.</param>
        /// <param name="methodLinesMap">Range that stores start/end lines for each method in the document.</param>
        /// <param name="sourceLanguage">Language of the source.</param>
        /// <param name="checksumAlgorithm">The checksum algorithm.</param>
        /// <param name="checksum">The checksum.</param>
        public SourceAnnotationInfo(
            string path,
            CompositeRange <int, MethodBase> methodLinesMap,
            SourceLanguage sourceLanguage,
            PdbChecksumAlgorithm checksumAlgorithm,
            byte[] checksum)
        {
            Code.NotNullNorEmpty(path, nameof(path));
            Code.NotNull(checksum, nameof(checksum));

            Path              = path;
            MethodLinesMap    = methodLinesMap;
            SourceLanguage    = sourceLanguage;
            ChecksumAlgorithm = checksumAlgorithm;
            Checksum          = checksum;
        }
Example #6
0
        public Scrollbar(CompositeRange ExistingViewRange)
            : base()
        {
            #region Scrollbar()

            this.ViewRange = ExistingViewRange;

            Etalon.Pos = 0;
            Etalon.Size = 1000;
            Etalon.Span.Pos = 0;
            Etalon.Span.Size = Etalon.Size;

            ButtonPushTimer.Interval = TimeIntervalLong;
            ButtonPushTimer.Tick += ButtonPushTimer_Tick;

            #endregion
        }
Example #7
0
        /// <summary>Fills attribute lines.</summary>
        /// <param name="candidateLines">The candidate lines.</param>
        /// <param name="sourceLines">The source lines.</param>
        /// <param name="sourcePath">The source path.</param>
        /// <param name="messageLogger">The message logger.</param>
        /// <returns>Filled attribute lines.</returns>
        public static TargetSourceLines[] FillAttributeLines(
            CompositeRange <int, MethodBase> candidateLines,
            string[] sourceLines,
            string sourcePath,
            IMessageLogger messageLogger)
        {
            // TODO: same method => multiple ranges.
            var result = new List <TargetSourceLines>();

            foreach (var candidateRange in candidateLines.SubRanges)
            {
                var benchmarkMethodInfo = TryParseBenchmarkMethodInfo(
                    candidateRange,
                    sourceLines, sourcePath,
                    messageLogger);
                if (benchmarkMethodInfo != null)
                {
                    result.Add(benchmarkMethodInfo);
                }
            }
            return(result.ToArray());
        }
Example #8
0
 public VScrollbar(CompositeRange ViewRange)
     : base(ViewRange)
 {
     Bounds.Size.X = InitialSize;
 }
Example #9
0
 /// <summary>
 /// Initialize instance.
 /// </summary>
 /// <param name="source">Range to create tree from.</param>
 public IntervalTree(CompositeRange <T, TKey> source)
 {
     _sortedRanges = source.SubRanges.ToArray();
     _treeIndexes  = new int[_sortedRanges.Length];
     ResetIndexes();
 }
Example #10
0
 public VScrollbar(CompositeRange ViewRange)
     : base(ViewRange)
 {
     Bounds.Size.X = InitialSize;
 }