Beispiel #1
0
        /// <summary>
        /// merged boundaries of another object into this object
        /// </summary>
        /// <param name="b">another physical boundary object of the same type as this</param>
        public virtual void Add(NumericalBoundaries b)
        {
            if (this.GetType() == b.GetType())
            {
                if (b._numberOfItems > 0)
                {
                    bool bLower = false, bUpper = false;
                    _numberOfItems += b._numberOfItems;
                    if (b._minValue < _minValue)
                    {
                        _minValue = b._minValue;
                        bLower    = true;
                    }
                    if (b._maxValue > _maxValue)
                    {
                        _maxValue = b._maxValue;
                        bUpper    = true;
                    }

                    if (EventsEnabled)
                    {
                        OnNumberOfItemsChanged(); // fire item number event
                        if (bLower || bUpper)
                        {
                            OnBoundaryChanged(bLower, bUpper);
                        }
                    }
                }
            }
            else
            {
                throw new ArgumentException("Argument has not the same type as this, argument type: " + b.GetType().ToString() + ", this type: " + this.GetType().ToString());
            }
        }
Beispiel #2
0
        /// <summary>
        /// merged boundaries of another object into this object
        /// </summary>
        /// <param name="b">another physical boundary object of the same type as this</param>
        public virtual void Add(NumericalBoundaries b)
        {
            if (GetType() == b.GetType())
            {
                if (b._numberOfItems > 0)
                {
                    BoundariesChangedData data = BoundariesChangedData.NumberOfItemsChanged;

                    _numberOfItems += b._numberOfItems;
                    if (b._minValue < _minValue)
                    {
                        _minValue = b._minValue;
                        data     |= BoundariesChangedData.LowerBoundChanged;
                    }
                    if (b._maxValue > _maxValue)
                    {
                        _maxValue = b._maxValue;
                        data     |= BoundariesChangedData.UpperBoundChanged;
                    }

                    if (!IsSuspended) // performance tweak, see overrides OnSuspended and OnResume for details (if suspended, we have saved the state of the instance for comparison when we resume).
                    {
                        EhSelfChanged(new BoundariesChangedEventArgs(data));
                    }
                }
            }
            else
            {
                throw new ArgumentException("Argument has not the same type as this, argument type: " + b.GetType().ToString() + ", this type: " + GetType().ToString());
            }
        }
    /// <summary>
    /// merged boundaries of another object into this object
    /// </summary>
    /// <param name="b">another physical boundary object of the same type as this</param>
    public virtual void Add(NumericalBoundaries b)
    {
      if(this.GetType()==b.GetType())
      {
        if(b._numberOfItems>0)
        {
          bool bLower=false,bUpper=false;
          _numberOfItems += b._numberOfItems;
          if(b._minValue < _minValue) 
          {
            _minValue = b._minValue;
            bLower=true;
          }
          if(b._maxValue > _maxValue)
          {
            _maxValue = b._maxValue;
            bUpper=true;
          }
          
          if(EventsEnabled)
          {
            OnNumberOfItemsChanged(); // fire item number event
            if(bLower||bUpper)
              OnBoundaryChanged(bLower,bUpper);
          }

        }
      }
      else
      {
        throw new ArgumentException("Argument has not the same type as this, argument type: " + b.GetType().ToString() + ", this type: " +this.GetType().ToString());
      }
    }