コード例 #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(FiniteDateTimeBoundaries b)
        {
            if (GetType() == b.GetType())
            {
                BoundariesChangedData data = 0;
                if (b._numberOfItems > 0)
                {
                    _numberOfItems += b._numberOfItems;

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

                if (!IsSuspended && 0 != data) // 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());
            }
        }
コード例 #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(FiniteDateTimeBoundaries 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());
            }
        }
コード例 #3
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                FiniteDateTimeBoundaries s = (FiniteDateTimeBoundaries)obj;

                info.AddValue("NumberOfItems", s._numberOfItems);
                info.AddValue("MinValue", s._minValue);
                info.AddValue("MaxValue", s._maxValue);
            }
コード例 #4
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                FiniteDateTimeBoundaries s = null != o ? (FiniteDateTimeBoundaries)o : new FiniteDateTimeBoundaries();

                s._numberOfItems = info.GetInt32("NumberOfItems");
                s._minValue      = info.GetDateTime("MinValue");
                s._maxValue      = info.GetDateTime("MaxValue");

                return(s);
            }
コード例 #5
0
 public FiniteDateTimeBoundaries(FiniteDateTimeBoundaries x)
     : base(x)
 {
     _minValue = x._minValue;
     _maxValue = x._maxValue;
 }
コード例 #6
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(FiniteDateTimeBoundaries b)
		{
			if (this.GetType() == b.GetType())
			{
				BoundariesChangedData data = 0;
				if (b._numberOfItems > 0)
				{
					_numberOfItems += b._numberOfItems;

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

				if (!IsSuspended && 0 != data) // 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: " + this.GetType().ToString());
			}
		}
コード例 #7
0
		public FiniteDateTimeBoundaries(FiniteDateTimeBoundaries x)
			: base(x)
		{
			_minValue = x._minValue;
			_maxValue = x._maxValue;
		}
コード例 #8
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(FiniteDateTimeBoundaries 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());
      }
    }