Exemplo n.º 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());
            }
        }
        /// <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());
            }
        }
            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);
            }
Exemplo n.º 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);
            }
Exemplo n.º 5
0
 public FiniteDateTimeBoundaries(FiniteDateTimeBoundaries x)
     : base(x)
 {
     _minValue = x._minValue;
     _maxValue = x._maxValue;
 }
Exemplo n.º 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());
			}
		}
Exemplo n.º 7
0
		public FiniteDateTimeBoundaries(FiniteDateTimeBoundaries x)
			: base(x)
		{
			_minValue = x._minValue;
			_maxValue = x._maxValue;
		}
    /// <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());
      }
    }