public static void Encode(XdrDataOutputStream stream, AccountEntry encodedAccountEntry)
        {
            AccountID.Encode(stream, encodedAccountEntry.AccountID);
            Int64.Encode(stream, encodedAccountEntry.Balance);
            SequenceNumber.Encode(stream, encodedAccountEntry.SeqNum);
            Uint32.Encode(stream, encodedAccountEntry.NumSubEntries);

            if (encodedAccountEntry.InflationDest != null)
            {
                stream.WriteInt(1);
                AccountID.Encode(stream, encodedAccountEntry.InflationDest);
            }
            else
            {
                stream.WriteInt(0);
            }

            Uint32.Encode(stream, encodedAccountEntry.Flags);
            String32.Encode(stream, encodedAccountEntry.HomeDomain);
            Thresholds.Encode(stream, encodedAccountEntry.Thresholds);
            int signerssize = encodedAccountEntry.Signers.Length;

            stream.WriteInt(signerssize);

            for (int i = 0; i < signerssize; i++)
            {
                Signer.Encode(stream, encodedAccountEntry.Signers[i]);
            }

            AccountEntryExt.Encode(stream, encodedAccountEntry.Ext);
        }
Example #2
0
        public static async Task ThresholdAsync <T>(T value, IcmThresholds <T> thresholds, Func <int, T, Task> action, IComparer <T>?comparer = null)
            where T : struct
        {
            // Convert to regular thresholds to avoid having duplicate logic

            var convertedThresholds = new Thresholds <T>
            {
                Info    = thresholds.Sev4,
                Warning = thresholds.Sev3,
                Error   = thresholds.Sev2,
                Fatal   = thresholds.Sev1
            };

            await ThresholdAsync(value, convertedThresholds, convertedAction, comparer);

            Task convertedAction(Severity sev, T value)
            {
                var icmSev = sev switch
                {
                    Severity.Info => 4,
                    Severity.Warning => 3,
                    Severity.Error => 2,
                    Severity.Fatal => 1,
                    _ => throw new NotImplementedException()
                };

                return(action(icmSev, value));
            }
        }
 public static Thresholds Decode(IByteReader stream)
 {
     Thresholds decodedThresholds = new Thresholds();
       int Thresholdssize = 4;
       decodedThresholds.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)Thresholdssize);
     return decodedThresholds;
 }
        public void ShouldGet0MutationScore()
        {
            var file = new CsharpFileLeaf()
            {
                RelativePath = "RootFolder/SomeFile.cs",
                FullPath     = "C://RootFolder/SomeFile.cs",
                Mutants      = new Collection <Mutant>()
                {
                    new Mutant()
                    {
                        ResultStatus = MutantStatus.Survived
                    },
                }
            };

            file.GetMutationScore().ShouldBe(0);

            var thresholdsDanger = new Thresholds
            {
                High  = 80,
                Low   = 1,
                Break = 0
            };

            file.CheckHealth(thresholdsDanger).ShouldBe(Health.Danger);
            var thresholdsWarning = new Thresholds
            {
                High  = 80,
                Low   = 0,
                Break = 0
            };

            file.CheckHealth(thresholdsWarning).ShouldBe(Health.Warning);
        }
Example #5
0
        public static AccountEntry Decode(XdrDataInputStream stream)
        {
            var decodedAccountEntry = new AccountEntry();

            decodedAccountEntry.AccountID     = AccountID.Decode(stream);
            decodedAccountEntry.Balance       = Int64.Decode(stream);
            decodedAccountEntry.SeqNum        = SequenceNumber.Decode(stream);
            decodedAccountEntry.NumSubEntries = Uint32.Decode(stream);
            var InflationDestPresent = stream.ReadInt();

            if (InflationDestPresent != 0)
            {
                decodedAccountEntry.InflationDest = AccountID.Decode(stream);
            }
            decodedAccountEntry.Flags      = Uint32.Decode(stream);
            decodedAccountEntry.HomeDomain = String32.Decode(stream);
            decodedAccountEntry.Thresholds = Thresholds.Decode(stream);
            var signerssize = stream.ReadInt();

            decodedAccountEntry.Signers = new Signer[signerssize];
            for (var i = 0; i < signerssize; i++)
            {
                decodedAccountEntry.Signers[i] = Signer.Decode(stream);
            }
            decodedAccountEntry.Ext = AccountEntryExt.Decode(stream);
            return(decodedAccountEntry);
        }
        public void ShouldGet100MutationScore()
        {
            var file = new CsharpFileLeaf()
            {
                RelativePath = "RootFolder/SomeFile.cs",
                FullPath     = "C://RootFolder/SomeFile.cs",
                Mutants      = new Collection <Mutant>()
                {
                    new Mutant()
                    {
                        ResultStatus = MutantStatus.Killed
                    },
                }
            };

            var thresholds = new Thresholds
            {
                High  = 100,
                Low   = 50,
                Break = 0
            };

            file.GetMutationScore().ShouldBe(1);
            file.CheckHealth(thresholds).ShouldBe(Health.Good);
        }
        public Vector3    Acceleration; // The acceleration of the whole Stylus.

        /// <summary>
        /// Check if stylus transform data is outside of the current limits
        /// </summary>
        /// <param name="oldLimit"></param>
        /// <param name="thresholds"></param>
        /// <returns></returns>
        public bool IsOutsideLimits(StylusTransformData oldLimit, Thresholds thresholds)
        {
            bool  lastThresholdIsValid = false;
            float moveDistance         = StylusDataMethods.GetSqrDistance(oldLimit.Position, this.Position);

            // check distance threshold
            if (moveDistance > thresholds.Movement)
            {
                lastThresholdIsValid = true;
            }

            //check rotation threshold
            float rotationDistance = StylusDataMethods.GetSqrDistance(oldLimit.Rotation.eulerAngles, this.Rotation.eulerAngles);

            if (rotationDistance > thresholds.Rotation)
            {
                lastThresholdIsValid = true;
            }

            //check acceleration threshold
            float accelerationDistance = StylusDataMethods.GetSqrDistance(oldLimit.Acceleration, this.Acceleration);

            if (accelerationDistance > thresholds.Acceleration)
            {
                lastThresholdIsValid = true;
            }

            return(lastThresholdIsValid);
        }
Example #8
0
        public WaveTrend_Oscillator()
            : base()
        {
            #region Initialization
            Credentials.ProjectName = "WaveTrend Oscillator";
            #endregion

            Lines.Set("Channel Length");
            Lines["Channel Length"].Color = Color.Red;
            Lines["Channel Length"].Style = LineStyle.Dot;

            Lines.Set("Average Length");
            Lines["Average Length"].Color = Color.LimeGreen;

            Thresholds.Set("Over Bought Level 1");
            Thresholds["Over Bought Level 1"].Level = 60;
            Thresholds["Over Bought Level 1"].Color = Color.Gray;

            Thresholds.Set("Over Bought Level 2");
            Thresholds["Over Bought Level 2"].Level = 53;
            Thresholds["Over Bought Level 2"].Color = Color.Gray;

            Thresholds.Set("Over Sold Level 1");
            Thresholds["Over Sold Level 1"].Level = -60;
            Thresholds["Over Sold Level 1"].Color = Color.Gray;

            Thresholds.Set("Over Sold Level 2");
            Thresholds["Over Sold Level 2"].Level = -53;
            Thresholds["Over Sold Level 2"].Color = Color.Gray;

            Clouds.Set("Cloud", GradientMode.Simple, Color.CadetBlue, Color.CadetBlue);


            SeparateWindow = true;
        }
Example #9
0
        public static void Encode(IByteWriter stream, AccountEntry encodedAccountEntry)
        {
            AccountID.Encode(stream, encodedAccountEntry.AccountID);
            Int64.Encode(stream, encodedAccountEntry.Balance);
            SequenceNumber.Encode(stream, encodedAccountEntry.SeqNum);
            Uint32.Encode(stream, encodedAccountEntry.NumSubEntries);
            if (encodedAccountEntry.InflationDest != null)
            {
                XdrEncoding.EncodeInt32(1, stream);
                AccountID.Encode(stream, encodedAccountEntry.InflationDest);
            }
            else
            {
                XdrEncoding.EncodeInt32(0, stream);
            }
            Uint32.Encode(stream, encodedAccountEntry.Flags);
            String32.Encode(stream, encodedAccountEntry.HomeDomain);
            Thresholds.Encode(stream, encodedAccountEntry.Thresholds);
            int signerssize = encodedAccountEntry.Signers.Length;

            XdrEncoding.EncodeInt32(signerssize, stream);
            for (int i = 0; i < signerssize; i++)
            {
                Signer.Encode(stream, encodedAccountEntry.Signers[i]);
            }
            AccountEntryExt.Encode(stream, encodedAccountEntry.Ext);
        }
        public float Pressure; // The pressed value of the button.

        /// <summary>
        /// Checks if the button pressure is outside of the limits
        /// </summary>
        /// <param name="oldLimit"></param>
        /// <param name="thresholds"></param>
        /// <returns></returns>
        public bool IsOutsideLimits(StylusButtonData oldLimit, Thresholds thresholds)
        {
            float moveDistance  = StylusDataMethods.GetDistance(oldLimit.Pressure, this.Pressure);
            bool  isOutOfLimits = moveDistance > thresholds.ButtonPressureThreshold;

            return(isOutOfLimits);
        }
Example #11
0
        public static AccountEntry Decode(IByteReader stream)
        {
            AccountEntry decodedAccountEntry = new AccountEntry();

            decodedAccountEntry.AccountID     = AccountID.Decode(stream);
            decodedAccountEntry.Balance       = Int64.Decode(stream);
            decodedAccountEntry.SeqNum        = SequenceNumber.Decode(stream);
            decodedAccountEntry.NumSubEntries = Uint32.Decode(stream);
            int inflationDestPresent = XdrEncoding.DecodeInt32(stream);

            if (inflationDestPresent != 0)
            {
                decodedAccountEntry.InflationDest = AccountID.Decode(stream);
            }
            decodedAccountEntry.Flags      = Uint32.Decode(stream);
            decodedAccountEntry.HomeDomain = String32.Decode(stream);
            decodedAccountEntry.Thresholds = Thresholds.Decode(stream);
            int signerssize = XdrEncoding.DecodeInt32(stream);

            decodedAccountEntry.Signers = new Signer[signerssize];
            for (int i = 0; i < signerssize; i++)
            {
                decodedAccountEntry.Signers[i] = Signer.Decode(stream);
            }
            decodedAccountEntry.Ext = AccountEntryExt.Decode(stream);
            return(decodedAccountEntry);
        }
Example #12
0
        /// <summary>
        /// Generate new threshold colorcode values for all intermediate rows
        /// </summary>
        /// <param name="greenColorcode"></param>
        /// <param name="yellowColorcode"></param>
        /// <param name="redColorcode"></param>
        public void GenerateThresholdValues(string greenColorcode, string yellowColorcode, string redColorcode, bool storeMetrics = false)
        {
            Log.WriteLine("generate threshold values...");
            // load threshold config from database
            Thresholds thresholds = new Thresholds(project);

            // generate color values
            Intermediate thValues = thresholds.GenerateThresholdValuesForTransactions(intermediate, greenColorcode, yellowColorcode, redColorcode);

            // merge threshold colortransactions with dataset
            Log.WriteLine(string.Format("adding {0} threshold entries...", thValues.Count));
            intermediate.Add(thValues);

            // count threshold violations (add in separate series) by transactionname patter + red color
            Log.WriteLine("aggregate threshold violations...");
            Intermediate thresholdViolations = thValues.AggregateCount(THRESHOLDVIOLATIONSKEY, @"\d\d_.*_c$", redColorcode); // only evaluate script transactions!

            // store these newly generated metrics back to the database
            if (storeMetrics)
            {
                thresholdViolations.SaveToDatabase(this.project, this.testrun, Category.Transaction, Entity.None);
            }

            Log.WriteLine("adding threshold violations: " + thresholdViolations.GetValue(THRESHOLDVIOLATIONSKEY));
            this.intermediate.Add(thresholdViolations);
        }
Example #13
0
        //interface contains no data
        //public CourseStudentGroup(ICourseStudentGroup ics, Course c, StudentGroup sg)
        //{
        //    Course = c;
        //    StudentGroup = sg;
        //    DO NOT ADD CHILD ENTITIES HERE, ADD IN DB GETCOURSE
        //    Deadlines = new CovariantObservableCollection<Deadline>();
        //    Attempts = new CovariantObservableCollection<Attempt>();
        //    Marks = new CovariantObservableCollection<Mark>();
        //    thresholds = new Thresholds(true);
        //    visibleGrids = 1;
        //}

        public CourseStudentGroup()
        {
            Deadlines    = new CovariantObservableCollection <Deadline>();
            Attempts     = new CovariantObservableCollection <Attempt>();
            Marks        = new CovariantObservableCollection <Mark>();
            thresholds   = new Thresholds(true);
            visibleGrids = 1;
        }
        public static Thresholds Decode(IByteReader stream)
        {
            Thresholds decodedThresholds = new Thresholds();
            int        Thresholdssize    = 4;

            decodedThresholds.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)Thresholdssize);
            return(decodedThresholds);
        }
Example #15
0
 private DataMeterValueCategory GetScoreCategory(int amount)
 {
     return(Thresholds
            .Where(x => amount >= x.MinMeasureUnitThreshold)
            .OrderByDescending(x => x.MinMeasureUnitThreshold)
            .First()
            .Category);
 }
        public void TestRCPTHRLevelDefineLowerLevelThreshold()
        {
            TestCaseID = "CGN-50";


            Thresholds.LoadThresholdsWindow();
            Thresholds.ImportThresholds(ProjectPath + "\\Resources\\Recipe\\Thresholds\\LevelThresholds.txt");
            //Thresholds.ApplyThresholdsSettings();
        }
Example #17
0
        public static Thresholds Decode(XdrDataInputStream stream)
        {
            var decodedThresholds = new Thresholds();
            var Thresholdssize    = 4;

            decodedThresholds.InnerValue = new byte[Thresholdssize];
            stream.Read(decodedThresholds.InnerValue, 0, Thresholdssize);
            return(decodedThresholds);
        }
Example #18
0
        private JsonReport(StrykerOptions options, IReadOnlyInputComponent mutationReport)
        {
            _options = options;

            Thresholds.Add("high", _options.Thresholds.High);
            Thresholds.Add("low", _options.Thresholds.Low);

            Merge(Files, GenerateReportComponents(mutationReport));
        }
Example #19
0
        public override double GetThresholds(string category)
        {
            if (!Thresholds.ContainsKey(category))
            {
                return(0);
            }

            return(Thresholds[category]);
        }
        /************************************************************************************************************************/

        /// <summary>Sorts all states so that their thresholds go from lowest to highest.</summary>
        /// <remarks>This method uses Bubble Sort which is inefficient for large numbers of states.</remarks>
        public void SortByThresholds()
        {
            var thresholdCount = Thresholds.Length;

            if (thresholdCount <= 1)
            {
                return;
            }

            var speedCount = Speeds.Length;
            var syncCount  = SynchronizeChildren.Length;

            var previousThreshold = Thresholds[0];

            for (int i = 1; i < thresholdCount; i++)
            {
                var threshold = Thresholds[i];
                if (threshold >= previousThreshold)
                {
                    previousThreshold = threshold;
                    continue;
                }

                Thresholds.Swap(i, i - 1);
                Animations.Swap(i, i - 1);

                if (i < speedCount)
                {
                    Speeds.Swap(i, i - 1);
                }

                if (i == syncCount && !SynchronizeChildren[i - 1])
                {
                    var sync = SynchronizeChildren;
                    Array.Resize(ref sync, ++syncCount);
                    sync[i - 1]         = true;
                    sync[i]             = false;
                    SynchronizeChildren = sync;
                }
                else if (i < syncCount)
                {
                    SynchronizeChildren.Swap(i, i - 1);
                }

                if (i == 1)
                {
                    i = 0;
                    previousThreshold = float.NegativeInfinity;
                }
                else
                {
                    i -= 2;
                    previousThreshold = Thresholds[i];
                }
            }
        }
 /// <summary>
 /// Gets the table file names.
 /// </summary>
 /// <returns>The table file names.</returns>
 /// <param name="tissue">Cell line.</param>
 public string[][] GetTableFileNames(string tissue)
 {
     return(RnaSources.Select(source =>
                              Thresholds.Select(threshold =>
                                                tissueTag.Replace(ThresholdTag.Replace(RnaSourceTag.Replace(
                                                                                           OutFileFormat,
                                                                                           source),
                                                                                       threshold),
                                                                  tissue)).ToArray()).ToArray());
 }
Example #22
0
 private void ClearData()
 {
     topColours      = null;
     previousCluster = null;
     currentCluster  = null;
     Histogram       = null;
     Thresholds.Clear();
     clusterArr.Clear();
     converged = false;
 }
Example #23
0
        public static void Threshold <T>(T value, Thresholds <T> thresholds, Action <Severity, T> action, IComparer <T>?comparer = null)
            where T : struct
        {
            Func <Severity, T, Task> func = (sev, threshold) =>
            {
                action(sev, threshold);
                return(Task.FromResult(1));
            };

            ThresholdAsync(value, thresholds, func, comparer).GetAwaiter().GetResult();
        }
Example #24
0
        private JsonReport(IStrykerOptions options, IReadOnlyProjectComponent mutationReport)
        {
            _options = options;

            Thresholds.Add("high", _options.Thresholds.High);
            Thresholds.Add("low", _options.Thresholds.Low);

            ProjectRoot = mutationReport.FullPath;

            Merge(Files, GenerateReportComponents(mutationReport));
        }
 /// <summary>
 /// Gets the map file names for cell line and all rna sources
 /// </summary>
 /// <returns>The map file names.</returns>
 /// <param name="tissue">Cell line.</param>
 public string[][] GetMapFileNamesWithThreshold(string tissue)
 {
     return(RnaSources.Select(rnaSource =>
                              Thresholds.Select(threshhold =>
                                                TissueTag.Replace(
                                                    RnaSourceTag.Replace(
                                                        ThresholdTag.Replace(MapFileFormat, threshhold),
                                                        rnaSource),
                                                    tissue))
                              .ToArray())
            .ToArray());
 }
        public override Boolean Load(Int64 forId)
        {
            Boolean success = false;

            StringBuilder selectStatement = new StringBuilder();

            System.Data.DataTable dataTable;


            if (application.EnvironmentDatabase == null)
            {
                return(false);
            }

            selectStatement.Append("SELECT * FROM dbo.CareLevelActivity WHERE CareLevelActivityId = " + forId.ToString());

            dataTable = application.EnvironmentDatabase.SelectDataTable(selectStatement.ToString(), 0);

            if (dataTable.Rows.Count == 1)
            {
                MapDataFields(dataTable.Rows[0]);

                success = true;
            }

            else
            {
                success = false;
            }


            if (success)
            {
                // LOAD CHILD OBJECTS

                String selectActivities = "SELECT * FROM dbo.CareLevelActivityThreshold WHERE CareLevelActivityId = " + forId.ToString();

                dataTable = application.EnvironmentDatabase.SelectDataTable(selectActivities.ToString(), 0);

                foreach (System.Data.DataRow currentRow in dataTable.Rows)
                {
                    Activity.ActivityThreshold threshold = new Activity.ActivityThreshold(application);

                    threshold.MapDataFields(currentRow);

                    Thresholds.Add(threshold);
                }
            }

            return(success);
        }
Example #27
0
        public EmployeeManager(ILedControl ledControl, IParamConfig paramConfig, ILogService logService)
        {
            _ledControl  = ledControl;
            _paramConfig = paramConfig;
            _logService  = logService;
            Thresholds thresholds = _paramConfig.ReadThresholds();

            ManagerSensors.Add(ESensorType.PressureSensor, new SensorStatus(thresholds.PsLow, thresholds.PsHigh));
            ManagerSensors.Add(ESensorType.DistanceMeter1, new SensorStatus(thresholds.Dm1Low, thresholds.Dm1High));
            ManagerSensors.Add(ESensorType.DistanceMeter2, new SensorStatus(thresholds.Dm2Low, thresholds.Dm2High));
            ManagerSensors.Add(ESensorType.EmployeeCardReader, new SensorStatus(0, 0));
            _lastExitTime = lastEntryTime = lastWashTime = DateTime.Now; // init time references
            //  _logService.SerializeObjectAndSendToDb(new ManInTheRoom());
        }
Example #28
0
        /// <summary>
        /// Perform baselining and generate extra baseline tags
        /// ${Appbeheer_01_Inloggen_br // reference (baseline value)
        /// ${Appbeheer_01_Inloggen_be // evaluated value (difference from baseline in %)
        /// ${Appbeheer_01_Inloggen_be_c // colorcode, mark when current value exceeds threshold th1, green when diff > -15%, red when diff > +15%
        /// </summary>
        /// <param name="currentTestrun"></param>
        /// <param name="baselineTestrun"></param>
        /// <param name="colorcodeBetter"></param>
        /// <param name="colorcodeWorse"></param>
        public void GenerateBaselineValues(string currentTestrun, string baselineTestrun, string colorcodeBetter, string colorcodeWorse, bool storeMetrics = false)
        {
            Thresholds thresholds = new Thresholds(this.project);

            // First, collect current and baseline run info and threshold violations:

            // lees baseline data, kies alternatief als baseline run niet gezet
            Log.WriteLine("read baseline values...");
            Intermediate baselineValues = ReadBaselineData(currentTestrun, baselineTestrun);

            Log.WriteLine("generate threshold evaluation on baseline run...");
            Intermediate baselineThresholdValues = thresholds.GenerateThresholdValuesForTransactions(baselineValues, Baselining.belowLowThreshold, "y", "r");

            // baseline: merge values with threshold colorcodes
            baselineThresholdValues.Add(baselineValues);

            Log.WriteLine("generate threshold evaluation on current run...");
            Intermediate currentThresholdValues = thresholds.GenerateThresholdValuesForTransactions(this.intermediate, Baselining.belowLowThreshold, "y", "r");

            // current testrun: merge values (this.intermediate) with threshold colorcodes
            currentThresholdValues.Add(this.intermediate);

            // Second, compare current run with baseline run:

            Log.WriteLine("generate baseline evaluation values...");
            Baselining   baselining         = new Baselining();
            Intermediate baselineEvaluation = baselining.GenerateBaselineEvaluationValues(currentThresholdValues, baselineThresholdValues, baselineValues, colorcodeBetter, colorcodeWorse);

            this.intermediate.Add(baselineEvaluation);
            Log.WriteLine("entries: " + baselineEvaluation.Count);

            // Third: generate aggregated metrics

            // Count baseline violations (add in separate series)
            Log.WriteLine("aggregate baseline warnings...");
            Intermediate baselineWarnings = baselineEvaluation.AggregateCount(BASELINEWARNINGSKEY, @"\d\d_.*_be_c", colorcodeWorse); // only evaluate script transactions!

            Log.WriteLine("adding baseline warnings: " + baselineWarnings.GetValue(BASELINEWARNINGSKEY));
            this.intermediate.Add(baselineWarnings);

            // store generated high-level stats
            if (storeMetrics)
            {
                // store baseline warning variables
                baselineWarnings.SaveToDatabase(this.project, this.testrun, Category.Transaction, Entity.None);

                // store calculated baseline reference chosen
                this.intermediate.SaveOneToDatabase(this.project, this.testrun, Category.Variable, Entity.Generic, BASELINEREFVARNAME);
            }
        }
Example #29
0
        public RoomWashManager2ProxSensors(ILedControl ledControl, IParamConfig paramConfig)
        {
            _ledControl  = ledControl;
            _paramConfig = paramConfig;
            _ledControl.Connect();
            _ledControl.TurnOn();
            _ledControl.ChangeColor(69, 69, 69);
            Thresholds thresholds = _paramConfig.ReadThresholds();

            ManagerSensors.Add(ESensorType.PressureSensor, new SensorStatus(thresholds.PsLow, thresholds.PsHigh));
            ManagerSensors.Add(ESensorType.DistanceMeter1, new SensorStatus(thresholds.Dm1Low, thresholds.Dm1High));
            ManagerSensors.Add(ESensorType.DistanceMeter2, new SensorStatus(thresholds.Dm2Low, thresholds.Dm2High));
            ManagerSensors.Add(ESensorType.EmployeeCardReader, new SensorStatus(0, 0));
            _lastExitTime = lastEntryTime = lastWashTime = DateTime.Now; // init time references
        }
Example #30
0
        public static void BiThreshold <T, Y>(T left, Y right, Thresholds <T> leftThresholds, Thresholds <Y> rightThresholds, Action <Severity, T?, Y?> action, IComparer <T>?leftComparer = null, IComparer <Y>?rightComparer = null, Func <Severity?, Severity?, Severity?>?merge = null)
            where T : struct
            where Y : struct
        {
            if (merge == null)
            {
                merge = (s1, s2) =>
                {
                    if (s1 == null)
                    {
                        return(s2);
                    }

                    if (s2 == null)
                    {
                        return(s1);
                    }

                    return((Severity)Math.Max((int)s1, (int)s2));
                };
            }

            Severity?leftSeverity  = null;
            T?       leftThreshold = null;

            Threshold(left, leftThresholds, (severity, threshold) =>
            {
                leftSeverity  = severity;
                leftThreshold = threshold;
            }, leftComparer);

            Severity?rightSeverity  = null;
            Y?       rightThreshold = null;

            Threshold(right, rightThresholds, (severity, threshold) =>
            {
                rightSeverity  = severity;
                rightThreshold = threshold;
            }, rightComparer);

            var finalSeverity = merge(leftSeverity, rightSeverity);

            if (finalSeverity != null)
            {
                action(finalSeverity.Value, leftThreshold, rightThreshold);
            }
        }
Example #31
0
        public string GetCalibrationResult()
        {
            StringBuilder ret = new StringBuilder();

            ret.Append(((int)(LowestSlotPosition / 0.001)).ToString("D8"));
            ret.Append(',');
            ret.Append(((int)(HighestSlotPosition / 0.001)).ToString("D8"));
            ret.Append(',');
            ret.Append(((int)(WaferWidth / 0.001)).ToString("D8"));
            ret.Append(',');
            ret.Append(((int)Thresholds.Find(t => t.Type == MappingCalibrationThresholdType.DoubleInsertion).Value).ToString("D8"));
            ret.Append(',');
            ret.Append(((int)Thresholds.Find(t => t.Type == MappingCalibrationThresholdType.SlantingInsertion1).Value).ToString("D8"));
            ret.Append(',');
            ret.Append(((int)Thresholds.Find(t => t.Type == MappingCalibrationThresholdType.SlantingInsertion2).Value).ToString("D8"));
            return(ret.ToString());
        }
 public static void Encode(IByteWriter stream, Thresholds  encodedThresholds) {
 int ThresholdsSize = encodedThresholds.InnerValue.Length;
 XdrEncoding.WriteFixOpaque(stream, (uint)ThresholdsSize, encodedThresholds.InnerValue);
 }