Пример #1
0
        internal void Poll(ObjectContainerBase objectContainer) {
            List4 remove = null;
            lock(this){
                System.Collections.IEnumerator i = new Iterator4Impl(_list);
                _list = null;
                while(i.MoveNext()){
					WeakReferenceHandler refHandler = (WeakReferenceHandler)i.Current;
                    if(refHandler.IsAlive){
                        _list = new List4(_list, refHandler);
                    }else{
                        remove = new List4(remove, refHandler.ObjectReference);
                    }
                }
            }
            System.Collections.IEnumerator j = new Iterator4Impl(remove);
            while (j.MoveNext())
            {
                lock (objectContainer.Lock())
                {
                    if (objectContainer.IsClosed())
                    {
                        return;
                    }
                    objectContainer.RemoveFromAllReferenceSystems(j.Current);
                }
            }
        }
Пример #2
0
		public virtual void DoNotInclude()
		{
			Include(false);
			if (_dependants != null)
			{
				IEnumerator i = new Iterator4Impl(_dependants);
				_dependants = null;
				while (i.MoveNext())
				{
					((IInternalCandidate)i.Current).DoNotInclude();
				}
			}
		}
Пример #3
0
		internal void ActivatePending(Transaction ta)
		{
			while (_stillToActivate != null)
			{
				// TODO: Optimize!  A lightweight int array would be faster.
				IEnumerator i = new Iterator4Impl(_stillToActivate);
				_stillToActivate = null;
				while (i.MoveNext())
				{
					ObjectContainerBase.PendingActivation item = (ObjectContainerBase.PendingActivation
						)i.Current;
					ObjectReference @ref = item.@ref;
					object obj = @ref.GetObject();
					if (obj == null)
					{
						ta.RemoveReference(@ref);
					}
					else
					{
						@ref.ActivateInternal(ActivationContextFor(ta, obj, item.depth));
					}
				}
			}
		}
Пример #4
0
		public virtual void CheckStillToSet()
		{
			List4 postponedStillToSet = null;
			while (_stillToSet != null)
			{
				IEnumerator i = new Iterator4Impl(_stillToSet);
				_stillToSet = null;
				while (i.MoveNext())
				{
					ObjectContainerBase.PendingSet item = (ObjectContainerBase.PendingSet)i.Current;
					ObjectReference @ref = item.@ref;
					Transaction trans = item.transaction;
					if ([email protected](trans, item.depth))
					{
						postponedStillToSet = new List4(postponedStillToSet, item);
					}
				}
			}
			_stillToSet = postponedStillToSet;
		}
Пример #5
0
		public virtual int MarshalledLength()
		{
			int length = Length();
			if (_children != null)
			{
				IEnumerator i = new Iterator4Impl(_children);
				while (i.MoveNext())
				{
					length += ((MarshallingBuffer)i.Current).MarshalledLength();
				}
			}
			return length;
		}
Пример #6
0
		public virtual MarshallingBuffer CheckBlockAlignment(MarshallingContext context, 
			MarshallingBuffer precedingBuffer, IntByRef precedingLength)
		{
			_lastOffSet = Offset();
			if (DoBlockAlign())
			{
				precedingBuffer.BlockAlign(context, precedingLength.value);
			}
			if (precedingBuffer != null)
			{
				precedingLength.value += precedingBuffer.Length();
			}
			precedingBuffer = this;
			if (_children != null)
			{
				IEnumerator i = new Iterator4Impl(_children);
				while (i.MoveNext())
				{
					precedingBuffer = ((MarshallingBuffer)i.Current).CheckBlockAlignment(context, precedingBuffer
						, precedingLength);
				}
			}
			return precedingBuffer;
		}
Пример #7
0
		private static void MergeChildren(MarshallingContext context, int masterAddress, 
			MarshallingBuffer writeBuffer, MarshallingBuffer parentBuffer, int linkOffset)
		{
			if (parentBuffer._children == null)
			{
				return;
			}
			IEnumerator i = new Iterator4Impl(parentBuffer._children);
			while (i.MoveNext())
			{
				Merge(context, masterAddress, writeBuffer, parentBuffer, (MarshallingBuffer)i.Current
					, linkOffset);
			}
		}
Пример #8
0
 public virtual IEnumerator ExecuteSnapshot()
 {
     var r = CreateCandidateCollection();
     var executionPath = ExecutionPath(r);
     IEnumerator candidatesIterator = new Iterator4Impl(r.candidateCollection);
     var snapshots = new Collection4();
     while (candidatesIterator.MoveNext())
     {
         var candidates = (QCandidates) candidatesIterator.Current;
         snapshots.Add(candidates.ExecuteSnapshot(executionPath));
     }
     var snapshotsIterator = snapshots.GetEnumerator();
     var resultingIDs = new CompositeIterator4(snapshotsIterator);
     if (!r.checkDuplicates)
     {
         return resultingIDs;
     }
     return CheckDuplicates(resultingIDs);
 }
Пример #9
0
 private void AddConstraintToCandidatesList(List4 candidatesList, QCon qcon)
 {
     if (candidatesList == null)
     {
         return;
     }
     IEnumerator j = new Iterator4Impl(candidatesList);
     while (j.MoveNext())
     {
         var candidates = (QCandidates) j.Current;
         candidates.AddConstraint(qcon);
     }
 }
Пример #10
0
 public virtual void ExecuteLocal(IdListQueryResult result)
 {
     CheckConstraintsEvaluationMode();
     var r = CreateCandidateCollection();
     var checkDuplicates = r.checkDuplicates;
     var topLevel = r.topLevel;
     var candidateCollection = r.candidateCollection;
     if (candidateCollection != null)
     {
         var executionPath = topLevel ? null : FieldPathFromTop();
         IEnumerator i = new Iterator4Impl(candidateCollection);
         while (i.MoveNext())
         {
             ((QCandidates) i.Current).Execute();
         }
         if (candidateCollection._next != null)
         {
             checkDuplicates = true;
         }
         if (checkDuplicates)
         {
             result.CheckDuplicates();
         }
         var stream = Stream();
         i = new Iterator4Impl(candidateCollection);
         while (i.MoveNext())
         {
             var candidates = (QCandidates) i.Current;
             if (topLevel)
             {
                 candidates.Traverse(result);
             }
             else
             {
                 candidates.Traverse(new _IVisitor4_374(this, executionPath, stream, result));
             }
         }
     }
     Sort(result);
 }
Пример #11
0
 public virtual IEnumerator ExecuteLazy()
 {
     CheckConstraintsEvaluationMode();
     var r = CreateCandidateCollection();
     var executionPath = ExecutionPath(r);
     IEnumerator candidateCollection = new Iterator4Impl(r.candidateCollection);
     MappingIterator executeCandidates = new _MappingIterator_438(executionPath, candidateCollection
         );
     var resultingIDs = new CompositeIterator4(executeCandidates);
     if (!r.checkDuplicates)
     {
         return resultingIDs;
     }
     return CheckDuplicates(resultingIDs);
 }
Пример #12
0
		public virtual void ExecuteLocal(IdListQueryResult result)
		{
			CheckConstraintsEvaluationMode();
			QQueryBase.CreateCandidateCollectionResult r = CreateCandidateCollection();
			bool checkDuplicates = r.checkDuplicates;
			bool topLevel = r.topLevel;
			List4 candidateCollection = r.candidateCollection;
			if (candidateCollection != null)
			{
				Collection4 executionPath = topLevel ? null : FieldPathFromTop();
				IEnumerator i = new Iterator4Impl(candidateCollection);
				while (i.MoveNext())
				{
					((QCandidates)i.Current).Execute();
				}
				if (((List4)candidateCollection._next) != null)
				{
					checkDuplicates = true;
				}
				if (checkDuplicates)
				{
					result.CheckDuplicates();
				}
				i = new Iterator4Impl(candidateCollection);
				while (i.MoveNext())
				{
					QCandidates candidates = (QCandidates)i.Current;
					if (topLevel)
					{
						candidates.TraverseIds(result);
					}
					else
					{
						candidates.TraverseIds(new QQueryBase.AscendingQueryExecutor(_trans, result, executionPath
							));
					}
				}
			}
			Sort(result);
		}
Пример #13
0
		internal virtual void DoNotInclude()
		{
			Include(false);
			if (_dependants != null)
			{
				IEnumerator i = new Iterator4Impl(_dependants);
				_dependants = null;
				while (i.MoveNext())
				{
					((Db4objects.Db4o.Internal.Query.Processor.QCandidate)i.Current).DoNotInclude();
				}
			}
		}
Пример #14
0
 protected virtual void RollBackTransactionListeners()
 {
     CheckSynchronization();
     if (_transactionListeners != null)
     {
         IEnumerator i = new Iterator4Impl(_transactionListeners);
         while (i.MoveNext())
         {
             ((ITransactionListener) i.Current).PostRollback();
         }
         _transactionListeners = null;
     }
 }
Пример #15
0
		internal void ProcessPendingClassUpdates()
		{
			if (_pendingClassUpdates == null)
			{
				return;
			}
			IEnumerator i = new Iterator4Impl(_pendingClassUpdates);
			while (i.MoveNext())
			{
				ClassMetadata classMetadata = (ClassMetadata)i.Current;
				classMetadata.SetStateDirty();
				classMetadata.Write(_systemTransaction);
			}
			_pendingClassUpdates = null;
		}
Пример #16
0
 private bool ConstraintCanBeAddedToExisting(List4 candidatesList, QCon constraint
     )
 {
     IEnumerator j = new Iterator4Impl(candidatesList);
     while (j.MoveNext())
     {
         var candidates = (QCandidates) j.Current;
         if (candidates.FitsIntoExistingConstraintHierarchy(constraint))
         {
             return true;
         }
     }
     return false;
 }
Пример #17
0
		private void DeactivatePending(Transaction trans)
		{
			while (_stillToDeactivate != null)
			{
				IEnumerator i = new Iterator4Impl(_stillToDeactivate);
				_stillToDeactivate = null;
				while (i.MoveNext())
				{
					ObjectContainerBase.PendingActivation item = (ObjectContainerBase.PendingActivation
						)i.Current;
					[email protected](trans, item.depth);
				}
			}
		}
Пример #18
0
 public virtual void CheckStillToSet()
 {
     List4 postponedStillToSet = null;
     while (_stillToSet != null)
     {
         IEnumerator i = new Iterator4Impl(_stillToSet);
         _stillToSet = null;
         while (i.MoveNext())
         {
             var item = (PendingSet) i.Current;
             var @ref = item.@ref;
             var trans = item.transaction;
             if ([email protected](trans, item.depth))
             {
                 postponedStillToSet = new List4(postponedStillToSet, item);
             }
         }
     }
     _stillToSet = postponedStillToSet;
 }