Example #1
0
 public _Iterator4Impl_82(NonblockingQueue _enclosing, List4 origInsertionPoint, List4
                          origNext, List4 baseArg1) : base(baseArg1)
 {
     this._enclosing         = _enclosing;
     this.origInsertionPoint = origInsertionPoint;
     this.origNext           = origNext;
 }
 internal void Add(WeakReferenceHandler reference)
 {
     lock (this)
     {
         _list = new List4(_list, reference);
     }
 }
Example #3
0
        public virtual object NextMatching(IPredicate4 condition)
        {
            if (null == condition)
            {
                throw new ArgumentNullException();
            }
            List4 current  = _next;
            List4 previous = null;

            while (null != current)
            {
                object element = ((object)current._element);
                if (condition.Match(element))
                {
                    if (previous == null)
                    {
                        RemoveNext();
                    }
                    else
                    {
                        previous._next = ((List4)current._next);
                    }
                    return(element);
                }
                previous = current;
                current  = ((List4)current._next);
            }
            return(null);
        }
        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);
                }
            }
        }
Example #5
0
 public void Clear()
 {
     _first = null;
     _last  = null;
     _size  = 0;
     Changed();
 }
Example #6
0
        public virtual IEnumerator Iterator()
        {
            List4 origInsertionPoint = _insertionPoint;
            List4 origNext           = _next;

            return(new _Iterator4Impl_82(this, origInsertionPoint, origNext, _next));
        }
Example #7
0
		private void RemoveNext()
		{
			_next = ((List4)_next._next);
			if (_next == null)
			{
				_insertionPoint = null;
			}
		}
Example #8
0
 private void RemoveNext()
 {
     _next = ((List4)_next._next);
     if (_next == null)
     {
         _insertionPoint = null;
     }
 }
Example #9
0
 private void RemoveNext()
 {
     _next = _next._next;
     if (_next == null)
     {
         _insertionPoint = null;
     }
 }
Example #10
0
 public void PlayCommandList(List4 commandList)
 {
     while (commandList != null)
     {
         IIoCommand ioCommand = (IIoCommand)commandList._element;
         ioCommand.Replay(_bin);
         commandList = commandList._next;
     }
 }
Example #11
0
        public virtual void ReplaceByIdentity(object oldObject, object newObject)
        {
            List4 list = FindByIdentity(oldObject);

            if (list != null)
            {
                list._element = newObject;
            }
        }
Example #12
0
		public virtual object Pop()
		{
			if (_tail == null)
			{
				throw new InvalidOperationException();
			}
			object res = _tail._element;
			_tail = ((List4)_tail._next);
			return res;
		}
Example #13
0
        public static IEnumerator Revert(IEnumerator iterator)
        {
            iterator.Reset();
            List4 tail = null;

            while (iterator.MoveNext())
            {
                tail = new List4(tail, iterator.Current);
            }
            return(Iterate(tail));
        }
Example #14
0
        /// <summary>makes sure the passed object is in the Collection.</summary>
        /// <remarks>makes sure the passed object is in the Collection. equals() comparison.</remarks>
        public object Ensure(object element)
        {
            List4 list = Find(element);

            if (list == null)
            {
                Add(element);
                return(element);
            }
            return((object)list._element);
        }
Example #15
0
 public virtual bool MoveNext()
 {
     if (_next == null)
     {
         _current = Iterators.NoElement;
         return(false);
     }
     _current = _next._element;
     _next    = _next._next;
     return(true);
 }
Example #16
0
 public virtual bool MoveNext()
 {
     if (_next == null)
     {
         _current = Iterators.NoElement;
         return false;
     }
     _current = _next._element;
     _next = _next._next;
     return true;
 }
Example #17
0
 public virtual bool MoveNext()
 {
     if (_next == null)
     {
         _current = Iterators.NoElement;
         return(false);
     }
     _current = ((object)_next._element);
     _next    = ((List4)_next._next);
     return(true);
 }
Example #18
0
 public static int Size(List4 list)
 {
     var counter = 0;
     var nextList = list;
     while (nextList != null)
     {
         counter++;
         nextList = nextList._next;
     }
     return counter;
 }
Example #19
0
        public virtual object Pop()
        {
            if (_tail == null)
            {
                throw new InvalidOperationException();
            }
            object res = _tail._element;

            _tail = ((List4)_tail._next);
            return(res);
        }
Example #20
0
		public virtual bool MoveNext()
		{
			if (_next == null)
			{
				_current = Iterators.NoElement;
				return false;
			}
			_current = ((object)_next._element);
			_next = ((List4)_next._next);
			return true;
		}
Example #21
0
 private void DoPrepend(object element)
 {
     if (_first == null)
     {
         DoAdd(element);
     }
     else
     {
         _first = new List4(_first, element);
         _size++;
     }
 }
Example #22
0
		private void DoPrepend(object element)
		{
			if (_first == null)
			{
				DoAdd(element);
			}
			else
			{
				_first = new List4(_first, element);
				_size++;
			}
		}
Example #23
0
        public static int Size(List4 list)
        {
            var counter  = 0;
            var nextList = list;

            while (nextList != null)
            {
                counter++;
                nextList = nextList._next;
            }
            return(counter);
        }
Example #24
0
		public void Add(object obj)
		{
			List4 newNode = new List4(null, obj);
			if (_insertionPoint == null)
			{
				_next = newNode;
			}
			else
			{
				_insertionPoint._next = newNode;
			}
			_insertionPoint = newNode;
		}
Example #25
0
		public virtual void DoNotInclude()
		{
			Include(false);
			if (_dependants != null)
			{
				IEnumerator i = new Iterator4Impl(_dependants);
				_dependants = null;
				while (i.MoveNext())
				{
					((IInternalCandidate)i.Current).DoNotInclude();
				}
			}
		}
Example #26
0
        private List4 Find(object obj)
        {
            List4 current = _first;

            while (current != null)
            {
                if (current.Holds(obj))
                {
                    return(current);
                }
                current = ((List4)current._next);
            }
            return(null);
        }
Example #27
0
		private void DoAdd(object element)
		{
			if (_last == null)
			{
				_first = new List4(element);
				_last = _first;
			}
			else
			{
				_last._next = new List4(element);
				_last = ((List4)_last._next);
			}
			_size++;
		}
Example #28
0
        private List4 FindByIdentity(object obj)
        {
            List4 current = _first;

            while (current != null)
            {
                if (((object)current._element) == obj)
                {
                    return(current);
                }
                current = ((List4)current._next);
            }
            return(null);
        }
Example #29
0
        public void Add(object obj)
        {
            List4 newNode = new List4(null, obj);

            if (_insertionPoint == null)
            {
                _next = newNode;
            }
            else
            {
                _insertionPoint._next = newNode;
            }
            _insertionPoint = newNode;
        }
Example #30
0
 private void DoAdd(object element)
 {
     if (_last == null)
     {
         _first = new List4(element);
         _last  = _first;
     }
     else
     {
         _last._next = new List4(element);
         _last       = ((List4)_last._next);
     }
     _size++;
 }
Example #31
0
        public static IEnumerator Iterate(List4 list)
        {
            if (list == null)
            {
                return(EmptyIterator);
            }
            Collection4 collection = new Collection4();

            while (list != null)
            {
                collection.Add(list._element);
                list = ((List4)list._next);
            }
            return(collection.GetEnumerator());
        }
Example #32
0
 private void AdjustOnRemoval(List4 previous, List4 removed)
 {
     if (removed == _first)
     {
         _first = ((List4)removed._next);
     }
     else
     {
         previous._next = ((List4)removed._next);
     }
     if (removed == _last)
     {
         _last = previous;
     }
 }
Example #33
0
 public List4 ReadCommandList()
 {
     List4 list = null;
     StreamReader reader = new StreamReader(_logFilePath);
     String line = null;
     while ((line = reader.ReadLine()) != null)
     {
         IIoCommand ioCommand = ReadLine(line);
         if (ioCommand != null)
         {
             list = new List4(list, ioCommand);
         }
     }
     reader.Close();
     return list;
 }
Example #34
0
        public virtual int IndexOf(object obj)
        {
            int   index   = 0;
            List4 current = _first;

            while (current != null)
            {
                if (current.Holds(obj))
                {
                    return(index);
                }
                index++;
                current = ((List4)current._next);
            }
            return(-1);
        }
Example #35
0
        public virtual object Get(int index)
        {
            if (index < 0)
            {
                throw new ArgumentException();
            }
            List4 cur = _first;

            while (index > 0 && cur != null)
            {
                cur = ((List4)cur._next);
                index--;
            }
            if (cur == null)
            {
                throw new ArgumentException();
            }
            return((object)cur._element);
        }
Example #36
0
        /// <summary>
        /// removes an object from the Collection equals() comparison returns the
        /// removed object or null, if none found
        /// </summary>
        public virtual bool Remove(object a_object)
        {
            List4 previous = null;
            List4 current  = _first;

            while (current != null)
            {
                if (current.Holds(a_object))
                {
                    _size--;
                    AdjustOnRemoval(previous, current);
                    Changed();
                    return(true);
                }
                previous = current;
                current  = ((List4)current._next);
            }
            return(false);
        }
Example #37
0
 public Iterator4Impl(List4 first)
 {
     _first   = first;
     _next    = first;
     _current = Iterators.NoElement;
 }
Example #38
0
		public void StillToActivate(IActivationContext context)
		{
			// TODO: We don't want the simple classes to search the hc_tree
			// Kick them out here.
			//		if (a_object != null) {
			//			Class clazz = a_object.getClass();
			//			if(! clazz.isPrimitive()){
			if (ProcessedByImmediateActivation(context))
			{
				return;
			}
			_stillToActivate = StillTo1(context.Transaction(), _stillToActivate, context.TargetObject
				(), context.Depth());
		}
Example #39
0
		public void StillToDeactivate(Transaction trans, object a_object, IActivationDepth
			 a_depth, bool a_forceUnknownDeactivate)
		{
			_stillToDeactivate = StillTo1(trans, _stillToDeactivate, a_object, a_depth);
		}
Example #40
0
 public virtual void Reset()
 {
     _next    = _first;
     _current = Iterators.NoElement;
 }
Example #41
0
		public Iterator4Impl(List4 first)
		{
			_first = first;
			_next = first;
			_current = Iterators.NoElement;
		}
Example #42
0
		public virtual void Reset()
		{
			_next = _first;
			_current = Iterators.NoElement;
		}
 public Collection4Iterator(Collection4 collection, List4 first) : base(first)
 {
     _collection     = collection;
     _initialVersion = CurrentVersion();
 }
Example #44
0
 public virtual void Push(object obj)
 {
     _tail = new List4(_tail, obj);
 }
Example #45
0
		public static IEnumerator Revert(IEnumerator iterator)
		{
			iterator.Reset();
			List4 tail = null;
			while (iterator.MoveNext())
			{
				tail = new List4(tail, iterator.Current);
			}
			return Iterate(tail);
		}
Example #46
0
		public static IEnumerator Iterate(List4 list)
		{
			if (list == null)
			{
				return EmptyIterator;
			}
			Collection4 collection = new Collection4();
			while (list != null)
			{
				collection.Add(list._element);
				list = ((List4)list._next);
			}
			return collection.GetEnumerator();
		}
Example #47
0
		internal virtual Db4objects.Db4o.Internal.Query.Processor.QCon AddConstraint(Db4objects.Db4o.Internal.Query.Processor.QCon
			 a_child)
		{
			_children = new List4(_children, a_child);
			return a_child;
		}
Example #48
0
		// virtual
		internal virtual void ExchangeConstraint(Db4objects.Db4o.Internal.Query.Processor.QCon
			 a_exchange, Db4objects.Db4o.Internal.Query.Processor.QCon a_with)
		{
			List4 previous = null;
			List4 current = _children;
			while (current != null)
			{
				if (current._element == a_exchange)
				{
					if (previous == null)
					{
						_children = ((List4)current._next);
					}
					else
					{
						previous._next = ((List4)current._next);
					}
				}
				previous = current;
				current = ((List4)current._next);
			}
			_children = new List4(_children, a_with);
		}
Example #49
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;
		}
Example #50
0
 public List4(List4 next, object element)
 {
     _next    = next;
     _element = element;
 }
Example #51
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));
					}
				}
			}
		}
Example #52
0
        /// <summary>
        /// returns the first object found in the Collections that equals() the
        /// passed object
        /// </summary>
        public object Get(object element)
        {
            List4 holder = Find(element);

            return(holder == null ? null : ((object)holder._element));
        }
Example #53
0
		internal virtual void StillToSet(Transaction transaction, ObjectReference @ref, IUpdateDepth
			 updateDepth)
		{
			if (StackIsSmall())
			{
				if (@ref.ContinueSet(transaction, updateDepth))
				{
					return;
				}
			}
			_stillToSet = new List4(_stillToSet, new ObjectContainerBase.PendingSet(transaction
				, @ref, updateDepth));
		}
Example #54
0
		public Collection4Iterator(Collection4 collection, List4 first) : base(first)
		{
			_collection = collection;
			_initialVersion = CurrentVersion();
		}
Example #55
0
			public _Iterator4Impl_82(NonblockingQueue _enclosing, List4 origInsertionPoint, List4
				 origNext, List4 baseArg1) : base(baseArg1)
			{
				this._enclosing = _enclosing;
				this.origInsertionPoint = origInsertionPoint;
				this.origNext = origNext;
			}
Example #56
0
 internal virtual void AddDependant(QCandidate
     a_candidate)
 {
     _dependants = new List4(_dependants, a_candidate);
 }
Example #57
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);
				}
			}
		}
Example #58
0
		public virtual void Add(object obj)
		{
			_objects = new List4(_objects, obj);
		}
Example #59
0
		internal void AddConstraint(QCon a_constraint)
		{
			_constraints = new List4(_constraints, a_constraint);
		}