ATMLModelLibrary.model.ErrorLimit.LeastRestrictiveLimit C# (CSharp) Method

LeastRestrictiveLimit() public static method

public static LeastRestrictiveLimit ( ErrorLimit e1, ErrorLimit e2 ) : ErrorLimit
e1 ErrorLimit
e2 ErrorLimit
return ErrorLimit
        public static ErrorLimit LeastRestrictiveLimit(ErrorLimit e1, ErrorLimit e2)
        {
            ErrorLimit newLimit = new ErrorLimit();
            newLimit.MinusQuantity = Quantity.Min(e1.MinusQuantity, e2.MinusQuantity);
            newLimit.PlusQuantity = Quantity.Max(e1.PlusQuantity, e2.PlusQuantity);
            newLimit.Confidence = Quantity.Min(e1.Confidence, e2.Confidence);
            newLimit.Resolution = Quantity.Max(e1.Resolution, e2.Resolution);
            return newLimit;
        }

Usage Example

Example #1
0
        public RangingInformation GetMergedRange()
        {
            RangingInformation newRange = new RangingInformation();

            foreach (RangingInformation rangingInformation in _ranges)
            {
                Quantity from = rangingInformation.FromQuantity;
                Quantity to   = rangingInformation.ToQuantity;
                if (newRange.FromQuantity == null || from < newRange.FromQuantity)
                {
                    newRange.FromQuantity = from;
                }
                if (newRange.ToQuantity == null || to > newRange.ToQuantity)
                {
                    newRange.ToQuantity = to;
                }
                if (rangingInformation.ErrorLimit != null)
                {
                    newRange.ErrorLimit = newRange.ErrorLimit == null
                                              ? rangingInformation.ErrorLimit
                                              : ErrorLimit.LeastRestrictiveLimit(rangingInformation.ErrorLimit,
                                                                                 newRange.ErrorLimit);
                }
            }
            return(newRange);
        }