示例#1
0
        internal void MakeOutOfDate()
        {
            bool wasUpToDate = false;

            lock (this)
            {
                if (_status == StatusType.UP_TO_DATE ||
                    _status == StatusType.UPDATING)
                {
                    wasUpToDate = true;

                    // Tell all precedents to forget about me.
                    for (PrecedentNode current = _firstPrecedent; current != null; current = current.Next)
                    {
                        current.Precedent.RemoveDependent(this);
                    }

                    _firstPrecedent = null;

                    if (_status == StatusType.UP_TO_DATE)
                    {
                        _status = StatusType.OUT_OF_DATE;
                    }
                    else if (_status == StatusType.UPDATING)
                    {
                        _status = StatusType.UPDATING_AND_OUT_OF_DATE;
                    }

                    if (Invalidated != null)
                    {
                        Invalidated();
                    }
                }
            }

            if (wasUpToDate)
            {
                // Make all indirect dependents out-of-date, too.
                MakeDependentsOutOfDate();
            }
        }
示例#2
0
		internal bool AddPrecedent( Precedent precedent )
		{
			lock ( this )
			{
				if ( _status == StatusType.UPDATING )
				{
                    _firstPrecedent = new PrecedentNode { Precedent = precedent, Next = _firstPrecedent };
                    return true;
				}
				else if ( _status != StatusType.UPDATING_AND_OUT_OF_DATE )
					Debug.Assert( false, "Unexpected state in AddPrecedent" );
                return false;
			}
		}
示例#3
0
		internal void MakeOutOfDate()
		{
            bool wasUpToDate = false;
			lock ( this )
			{
				if ( _status == StatusType.UP_TO_DATE ||
					_status == StatusType.UPDATING )
				{
                    wasUpToDate = true;

                    // Tell all precedents to forget about me.
                    for (PrecedentNode current = _firstPrecedent; current != null; current = current.Next)
                        current.Precedent.RemoveDependent(this);

                    _firstPrecedent = null;

					if ( _status == StatusType.UP_TO_DATE )
						_status = StatusType.OUT_OF_DATE;
					else if ( _status == StatusType.UPDATING )
						_status = StatusType.UPDATING_AND_OUT_OF_DATE;

                    if (Invalidated != null)
                        Invalidated();
				}
			}

            if (wasUpToDate)
                // Make all indirect dependents out-of-date, too.
                MakeDependentsOutOfDate();
        }