public Range <T> CombineNarrow(Range <T> other)
        {
            var lo = Lo.CompareTo(other.Lo) >= 0 ? Lo : other.Lo;
            var hi = Hi.CompareTo(other.Hi) <= 0 ? Hi : other.Hi;

            return(new Range <T>(lo, hi));
        }
Beispiel #2
0
        private void OnTimer(object source, ElapsedEventArgs e)
        {
            int r;

            if (_Pid == 0)
            {
                _Pid = Lo.Process();

                if (_Pid == 0)
                {
                    return;
                }

                r = Lo.Initialize(_Pid);
                if (r == 0)
                {
                    _Pid = 0;
                    return;
                }
            }

            r = Lo.Check();
            if (r == 0)
            {
                _Pid = 0;
                return;
            }

            ReadLog();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Здравствуйте вы зашли в программу нахождения минимума функции");
            Console.WriteLine(@"Что вы хотите сделать введите свой выбор где:
              1) Сохранить данные
              2) Загрузить данные
              3) Либо просто подсчитать?
                ");
            int  vb = Convert.ToInt32(Console.ReadLine());
            SF   sf = SaveFunc;
            Lo   l  = Load;
            Func fu = F;

            switch (vb)
            {
            case 1:
                Console.WriteLine("Сначало введите файл после этого нажмите enter и введите поочередно три числа");
                string f  = Console.ReadLine();
                double n1 = Convert.ToDouble(Console.ReadLine());
                double n2 = Convert.ToDouble(Console.ReadLine());
                double n3 = Convert.ToDouble(Console.ReadLine());

                sf(f, n1, n2, n3);
                break;

            case 2:
                Console.WriteLine("Введите название файла с которого долны считать числа ");

                string f2 = Console.ReadLine();

                l(f2);
                break;

            case 3:
                Console.WriteLine("Введите число");

                double num    = Convert.ToDouble(Console.ReadLine());
                double result = fu(num);
                Console.WriteLine("результат" + result);
                break;

            default:
                Console.WriteLine("Ввывели неверное значение!");
                break;
            }
            Console.WriteLine("");
            ArrayList d = new ArrayList(3);

            d.Add(sf);
            d.Add(l);
            d.Add(fu);
            d.Sort();

            //SaveFunc
            //Console.WriteLine(Load("data.bin"));
            Console.ReadKey();
        }
Beispiel #4
0
 public void merge(AxisAlignedBox a)
 {
     if (isEmpty())
     {
         _lo = a.Lo;
         _hi = a.Hi;
     }
     else if (!a.isEmpty())
     {
         _lo = Lo.Min(a.Lo);
         _hi = Hi.Max(a.Hi);
     }
 }
Beispiel #5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (lo_ != null)
            {
                hash ^= Lo.GetHashCode();
            }
            if (hi_ != null)
            {
                hash ^= Hi.GetHashCode();
            }
            return(hash);
        }
Beispiel #6
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Lo != 0UL)
            {
                hash ^= Lo.GetHashCode();
            }
            if (Hi != 0UL)
            {
                hash ^= Hi.GetHashCode();
            }
            return(hash);
        }
Beispiel #7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Lo != 0UL)
            {
                hash ^= Lo.GetHashCode();
            }
            if (Hi != 0UL)
            {
                hash ^= Hi.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #8
0
        /// <summary>
        /// Determines if the given configurable feature is available in the specified firmware revision.
        /// </summary>
        /// <param name="currentFirmwareVersion">Current firmware version.</param>
        /// <returns><c>true</c> if the configurable feature is available for the specified firmware version; otherwise, <c>false</c>.</returns>
        /// <exception cref="ArgumentOutOfRangeException">Thrown if <paramref name="feature"/> has multiple configurable features specified.</exception>
        public bool IsConfigurableFeatureAvailable(int currentFirmwareVersion)
        {
            if ((Lo != DeviceStatusFlagsLo.None) && (Hi != DeviceStatusFlagsHi.None))
            {
                throw new ArgumentOutOfRangeException();
            }
            var featureAvailable = currentFirmwareVersion > 0;

            if (Lo != DeviceStatusFlagsLo.None)
            {
                featureAvailable = Lo.IsConfigurableFeatureAvailable(currentFirmwareVersion);
            }
            else if (Hi != DeviceStatusFlagsHi.None)
            {
                featureAvailable = Hi.IsConfigurableFeatureAvailable(currentFirmwareVersion);
            }
            return(featureAvailable);
        }
Beispiel #9
0
        /// <summary>
        /// Gets the minimum required firmware version for the given configurable feature.
        /// </summary>
        /// <returns>The minimum firmware version required for the feature; or <c>0</c> if the feature is available in all firmware versions.</returns>
        /// <exception cref="System.ArgumentOutOfRangeException">Thrown if <paramref name="feature"/> specified more than one configurable feature, or hardware status.</exception>
        public int GetMinimumRequiredFirmareVersionForFeature()
        {
            if ((Lo != DeviceStatusFlagsLo.None) && (Hi != DeviceStatusFlagsHi.None))
            {
                throw new ArgumentOutOfRangeException();
            }
            var minimumRequireFirmwareVersion = 0;

            if (Lo != DeviceStatusFlagsLo.None)
            {
                minimumRequireFirmwareVersion = Lo.GetMinimumRequiredFirmareVersionForFeature();
            }
            else if (Hi != DeviceStatusFlagsHi.None)
            {
                minimumRequireFirmwareVersion = Hi.GetMinimumRequiredFirmareVersionForFeature();
            }
            return(minimumRequireFirmwareVersion);
        }
        private void btnThemHoaDon_Click(object sender, EventArgs e)
        {
            Lo lo = new Lo(txtMaLo.Text, dtNSX.Value.ToString(), dtHSD.Value.ToString());

            lo.SaveToDatabase();
            int        idPX       = listPhanXuong.Where(x => x.Key == cbPhanXuong.Text).SingleOrDefault().Value;
            HoaDonNhap hoaDonNhap = new HoaDonNhap(txtMaHoaDonNhap.Text, DateTime.Now.ToString(), txtMaNhanVien.Text, "ghi", idPX.ToString());

            hoaDonNhap.SaveToDatabase();
            foreach (ListViewItem item in lsvChiTiet.Items)
            {
                ChiTietHoaDonNhap chiTietHoaDonNhap = new ChiTietHoaDonNhap(txtMaHoaDonNhap.Text, item.SubItems[0].Text, item.SubItems[3].Text, txtMaLo.Text, item.SubItems[2].Text);
                chiTietHoaDonNhap.SaveToDatabase();
                HangHoa.UpdateAmount(Convert.ToInt32(item.SubItems[0].Text), Convert.ToInt32(item.SubItems[2].Text));
            }
            this.Close();
            mainForm.LoadToDataGridView();
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Lo != 0)
            {
                hash ^= Lo.GetHashCode();
            }
            if (Mid != 0)
            {
                hash ^= Mid.GetHashCode();
            }
            if (Hi != 0)
            {
                hash ^= Hi.GetHashCode();
            }
            if (SignScale != 0)
            {
                hash ^= SignScale.GetHashCode();
            }
            return(hash);
        }
Beispiel #12
0
        private void ReadLog()
        {
            if (_Pid == 0)
            {
                return;
            }

            int c = Lo.ReadW(p);

            if (c < 2)
            {
                return;
            }

            if (_First)
            {
                _First = false;
                return;
            }

            string s = Marshal.PtrToStringUni(p);

            string [] lines;
            lines = s.Split('\n');
            foreach (string line in lines)
            {
                string [] t;
                t = line.Split('\t');
                if (t.Length > 7)
                {
                    string name = t[5];
                    string chat = t[7];
                    if (name != "")
                    {
                        Talk(name, chat);
                    }
                }
            }
        }
Beispiel #13
0
 public void MergeFrom(Rectangle other)
 {
     if (other == null)
     {
         return;
     }
     if (other.lo_ != null)
     {
         if (lo_ == null)
         {
             lo_ = new global::Routeguide.Point();
         }
         Lo.MergeFrom(other.Lo);
     }
     if (other.hi_ != null)
     {
         if (hi_ == null)
         {
             hi_ = new global::Routeguide.Point();
         }
         Hi.MergeFrom(other.Hi);
     }
 }
Beispiel #14
0
 public void MergeFrom(Rectangle other)
 {
     if (other == null)
     {
         return;
     }
     if (other.lo_ != null)
     {
         if (lo_ == null)
         {
             Lo = new global::Routeguide.Point();
         }
         Lo.MergeFrom(other.Lo);
     }
     if (other.hi_ != null)
     {
         if (hi_ == null)
         {
             Hi = new global::Routeguide.Point();
         }
         Hi.MergeFrom(other.Hi);
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Beispiel #15
0
 public void MergeFrom(Rectangle other)
 {
     if (other == null)
     {
         return;
     }
     if (other.lo_ != null)
     {
         if (lo_ == null)
         {
             lo_ = new global::GRPC.Playground.Messages.Point();
         }
         Lo.MergeFrom(other.Lo);
     }
     if (other.hi_ != null)
     {
         if (hi_ == null)
         {
             hi_ = new global::GRPC.Playground.Messages.Point();
         }
         Hi.MergeFrom(other.Hi);
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
 public bool Equals(Range <T> other)
 {
     return(Lo.CompareTo(other.Lo) == 0 && Hi.CompareTo(other.Hi) == 0);
 }
 public bool Contains(T value)
 {
     return(Lo.CompareTo(value) <= 0 && value.CompareTo(Hi) <= 0);
 }
Beispiel #18
0
 public bool isEmpty()
 {
     return(Lo.isNaN());
 }
Beispiel #19
0
 /// <summary>
 /// Determines whether one or more bit fields are set in the current instance.
 /// </summary>
 /// <param name="loFlags">Flags to check.</param>
 /// <returns><c>true</c> if the bit field or bit fields that are set in <paramref name="loFlags"/> are also set in the current instance; otherwise, <c>false</c>.</returns>
 public bool HasFlag(DeviceStatusFlagsLo loFlags)
 {
     return(Lo.HasFlag(loFlags));
 }
Beispiel #20
0
        public bool isFinite()
        {
            var b = isEmpty() || (Lo.isFinite() && Hi.isFinite());

            return(b);
        }
Beispiel #21
0
        /// <inheritdoc />
        public override string ToString()
        {
            var flagsString = "Lo: " + Lo.ToString() + "; Hi: " + Hi.ToString();

            return(flagsString);
        }
Beispiel #22
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     return(CombineHashCodes(Lo.GetHashCode(), Hi.GetHashCode()));
 }
 public override int GetHashCode()
 {
     unchecked
     { return((Lo.GetHashCode() * 397) ^ Hi.GetHashCode()); }
 }
Beispiel #24
0
 public void merge(AxisAlignedBox a)
 {
     Lo = Lo.Min(a.Lo);
     Hi = Hi.Max(a.Hi);
 }