Exemplo n.º 1
0
 public _Iterator4Impl_82(NonblockingQueue _enclosing, List4 origInsertionPoint, List4
                          origNext, List4 baseArg1) : base(baseArg1)
 {
     this._enclosing         = _enclosing;
     this.origInsertionPoint = origInsertionPoint;
     this.origNext           = origNext;
 }
Exemplo n.º 2
0
 internal void Add(WeakReferenceHandler reference)
 {
     lock (this)
     {
         _list = new List4(_list, reference);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 4
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);
                }
            }
        }
Exemplo n.º 5
0
 public void Clear()
 {
     _first = null;
     _last  = null;
     _size  = 0;
     Changed();
 }
Exemplo n.º 6
0
        public virtual IEnumerator Iterator()
        {
            List4 origInsertionPoint = _insertionPoint;
            List4 origNext           = _next;

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

            if (list != null)
            {
                list._element = newObject;
            }
        }
Exemplo n.º 12
0
		public virtual object Pop()
		{
			if (_tail == null)
			{
				throw new InvalidOperationException();
			}
			object res = _tail._element;
			_tail = ((List4)_tail._next);
			return res;
		}
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 15
0
 public virtual bool MoveNext()
 {
     if (_next == null)
     {
         _current = Iterators.NoElement;
         return(false);
     }
     _current = _next._element;
     _next    = _next._next;
     return(true);
 }
Exemplo n.º 16
0
 public virtual bool MoveNext()
 {
     if (_next == null)
     {
         _current = Iterators.NoElement;
         return false;
     }
     _current = _next._element;
     _next = _next._next;
     return true;
 }
Exemplo n.º 17
0
 public virtual bool MoveNext()
 {
     if (_next == null)
     {
         _current = Iterators.NoElement;
         return(false);
     }
     _current = ((object)_next._element);
     _next    = ((List4)_next._next);
     return(true);
 }
Exemplo n.º 18
0
 public static int Size(List4 list)
 {
     var counter = 0;
     var nextList = list;
     while (nextList != null)
     {
         counter++;
         nextList = nextList._next;
     }
     return counter;
 }
Exemplo n.º 19
0
        public virtual object Pop()
        {
            if (_tail == null)
            {
                throw new InvalidOperationException();
            }
            object res = _tail._element;

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

            while (nextList != null)
            {
                counter++;
                nextList = nextList._next;
            }
            return(counter);
        }
Exemplo n.º 24
0
		public void Add(object obj)
		{
			List4 newNode = new List4(null, obj);
			if (_insertionPoint == null)
			{
				_next = newNode;
			}
			else
			{
				_insertionPoint._next = newNode;
			}
			_insertionPoint = newNode;
		}
Exemplo n.º 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();
				}
			}
		}
Exemplo n.º 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);
        }
Exemplo n.º 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++;
		}
Exemplo n.º 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);
        }
Exemplo n.º 29
0
        public void Add(object obj)
        {
            List4 newNode = new List4(null, obj);

            if (_insertionPoint == null)
            {
                _next = newNode;
            }
            else
            {
                _insertionPoint._next = newNode;
            }
            _insertionPoint = newNode;
        }
Exemplo n.º 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++;
 }
Exemplo n.º 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());
        }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 37
0
 public Iterator4Impl(List4 first)
 {
     _first   = first;
     _next    = first;
     _current = Iterators.NoElement;
 }
Exemplo n.º 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());
		}
Exemplo n.º 39
0
		public void StillToDeactivate(Transaction trans, object a_object, IActivationDepth
			 a_depth, bool a_forceUnknownDeactivate)
		{
			_stillToDeactivate = StillTo1(trans, _stillToDeactivate, a_object, a_depth);
		}
Exemplo n.º 40
0
 public virtual void Reset()
 {
     _next    = _first;
     _current = Iterators.NoElement;
 }
Exemplo n.º 41
0
		public Iterator4Impl(List4 first)
		{
			_first = first;
			_next = first;
			_current = Iterators.NoElement;
		}
Exemplo n.º 42
0
		public virtual void Reset()
		{
			_next = _first;
			_current = Iterators.NoElement;
		}
 public Collection4Iterator(Collection4 collection, List4 first) : base(first)
 {
     _collection     = collection;
     _initialVersion = CurrentVersion();
 }
Exemplo n.º 44
0
 public virtual void Push(object obj)
 {
     _tail = new List4(_tail, obj);
 }
Exemplo n.º 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);
		}
Exemplo n.º 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();
		}
Exemplo n.º 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;
		}
Exemplo n.º 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);
		}
Exemplo n.º 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;
		}
Exemplo n.º 50
0
 public List4(List4 next, object element)
 {
     _next    = next;
     _element = element;
 }
Exemplo n.º 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));
					}
				}
			}
		}
Exemplo n.º 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));
        }
Exemplo n.º 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));
		}
Exemplo n.º 54
0
		public Collection4Iterator(Collection4 collection, List4 first) : base(first)
		{
			_collection = collection;
			_initialVersion = CurrentVersion();
		}
Exemplo n.º 55
0
			public _Iterator4Impl_82(NonblockingQueue _enclosing, List4 origInsertionPoint, List4
				 origNext, List4 baseArg1) : base(baseArg1)
			{
				this._enclosing = _enclosing;
				this.origInsertionPoint = origInsertionPoint;
				this.origNext = origNext;
			}
Exemplo n.º 56
0
 internal virtual void AddDependant(QCandidate
     a_candidate)
 {
     _dependants = new List4(_dependants, a_candidate);
 }
Exemplo n.º 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);
				}
			}
		}
Exemplo n.º 58
0
		public virtual void Add(object obj)
		{
			_objects = new List4(_objects, obj);
		}
Exemplo n.º 59
0
		internal void AddConstraint(QCon a_constraint)
		{
			_constraints = new List4(_constraints, a_constraint);
		}