Esempio n. 1
0
 protected override Tree ShallowCloneInternal(Tree tree)
 {
     Db4objects.Db4o.Internal.TreeInt treeint = (Db4objects.Db4o.Internal.TreeInt)base
                                                .ShallowCloneInternal(tree);
     treeint._key = _key;
     return(treeint);
 }
Esempio n. 2
0
        public override object ShallowClone()
        {
            var treeint = new TreeInt(_key
                                      );

            return(ShallowCloneInternal(treeint));
        }
Esempio n. 3
0
        public virtual bool Delete(ObjectReference @ref, int id, int cascade)
        {
            CheckSynchronization();
            if (@ref != null)
            {
                if (!_container.FlagForDelete(@ref))
                {
                    return(false);
                }
            }
            if (DTrace.enabled)
            {
                DTrace.TransDelete.Log(id);
            }
            DeleteInfo info = (DeleteInfo)TreeInt.Find(_delete, id);

            if (info == null)
            {
                info    = new DeleteInfo(id, @ref, cascade);
                _delete = Tree.Add(_delete, info);
                return(true);
            }
            info._reference = @ref;
            if (cascade > info._cascade)
            {
                info._cascade = cascade;
            }
            return(true);
        }
Esempio n. 4
0
 public static int MarshalledLength(TreeInt a_tree)
 {
     if (a_tree == null)
     {
         return(Const4.IntLength);
     }
     return(a_tree.MarshalledLength());
 }
Esempio n. 5
0
        private bool AlreadyHandled()
        {
            TreeInt newNode = new TreeInt(_id);

            _transaction._writtenUpdateAdjustedIndexes = Tree.Add(_transaction._writtenUpdateAdjustedIndexes
                                                                  , newNode);
            return(!newNode.WasAddedToTree());
        }
Esempio n. 6
0
 public static int MarshalledLength(Db4objects.Db4o.Internal.TreeInt a_tree)
 {
     if (a_tree == null)
     {
         return(Const4.IntLength);
     }
     return(a_tree.MarshalledLength());
 }
Esempio n. 7
0
 public static QCandidate ToQCandidate(TreeInt tree, QCandidates
                                       candidates)
 {
     if (tree == null)
     {
         return(null);
     }
     return(tree.ToQCandidate(candidates));
 }
Esempio n. 8
0
 public static QCandidate ToQCandidate(Db4objects.Db4o.Internal.TreeInt tree, QCandidates
                                       candidates)
 {
     if (tree == null)
     {
         return(null);
     }
     return(tree.ToQCandidate(candidates));
 }
Esempio n. 9
0
 private Tree CreateTree(int[] values)
 {
     Tree tree = new TreeInt(values[0]);
     for (var i = 1; i < values.Length; i++)
     {
         tree = tree.Add(new TreeInt(values[i]));
     }
     return tree;
 }
Esempio n. 10
0
 internal virtual void CreateIDMapping(DefragmentServicesImpl context, int objectID
     , bool isClassID)
 {
     if (BatchFull())
     {
         Flush(context);
     }
     _ids = TreeInt.Add(_ids, (isClassID ? -objectID : objectID));
 }
Esempio n. 11
0
		public static TreeInt AddToTree(TreeInt tree, IIndexedNode node)
		{
			IEnumerator i = node.GetEnumerator();
			while (i.MoveNext())
			{
				IFieldIndexKey composite = (IFieldIndexKey)i.Current;
				tree = (TreeInt)((TreeInt)Tree.Add(tree, new TreeInt(composite.ParentID())));
			}
			return tree;
		}
Esempio n. 12
0
 public static void Write(ByteArrayBuffer buffer, Db4objects.Db4o.Internal.TreeInt
                          tree, int size)
 {
     if (tree == null)
     {
         buffer.WriteInt(0);
         return;
     }
     buffer.WriteInt(size);
     tree.Traverse(new _IVisitor4_97(buffer));
 }
Esempio n. 13
0
 public virtual void DontDelete(int a_id)
 {
     if (DTrace.enabled)
     {
         DTrace.TransDontDelete.Log(a_id);
     }
     if (_delete == null)
     {
         return;
     }
     _delete = TreeInt.RemoveLike((TreeInt)_delete, a_id);
 }
Esempio n. 14
0
		public virtual void AddKeyCheckDuplicates(int a_key)
		{
			if (_checkDuplicates)
			{
				TreeInt newNode = new TreeInt(a_key);
				_candidates = Tree.Add(_candidates, newNode);
				if (newNode._size == 0)
				{
					return;
				}
			}
			Add(a_key);
		}
Esempio n. 15
0
		public static Tree AddAll(Tree tree, IIntIterator4 iter)
		{
			if (!iter.MoveNext())
			{
				return tree;
			}
			Db4objects.Db4o.Internal.TreeInt firstAdded = new Db4objects.Db4o.Internal.TreeInt
				(iter.CurrentInt());
			tree = Tree.Add(tree, firstAdded);
			while (iter.MoveNext())
			{
				tree = tree.Add(new Db4objects.Db4o.Internal.TreeInt(iter.CurrentInt()));
			}
			return tree;
		}
Esempio n. 16
0
 public static Tree AddAll(Tree tree, IIntIterator4 iter)
 {
     if (!iter.MoveNext())
     {
         return tree;
     }
     var firstAdded = new TreeInt
         (iter.CurrentInt());
     tree = Add(tree, firstAdded);
     while (iter.MoveNext())
     {
         tree = tree.Add(new TreeInt(iter.CurrentInt()));
     }
     return tree;
 }
Esempio n. 17
0
 public static Tree AddAll(Tree tree, IIntIterator4 iter)
 {
     if (!iter.MoveNext())
     {
         return(tree);
     }
     Db4objects.Db4o.Internal.TreeInt firstAdded = new Db4objects.Db4o.Internal.TreeInt
                                                       (iter.CurrentInt());
     tree = Tree.Add(tree, firstAdded);
     while (iter.MoveNext())
     {
         tree = tree.Add(new Db4objects.Db4o.Internal.TreeInt(iter.CurrentInt()));
     }
     return(tree);
 }
Esempio n. 18
0
        public static Tree AddAll(Tree tree, IIntIterator4 iter)
        {
            if (!iter.MoveNext())
            {
                return(tree);
            }
            var firstAdded = new TreeInt
                                 (iter.CurrentInt());

            tree = Add(tree, firstAdded);
            while (iter.MoveNext())
            {
                tree = tree.Add(new TreeInt(iter.CurrentInt()));
            }
            return(tree);
        }
Esempio n. 19
0
        private void DeleteMembers(StatefulBuffer objectBytes)
        {
            ObjectHeader oh   = new ObjectHeader(_clazz, objectBytes);
            DeleteInfo   info = (DeleteInfo)TreeInt.Find(_transaction._delete, _id);

            if (info != null)
            {
                if (info._cascade > _cascade)
                {
                    _cascade = info._cascade;
                }
            }
            objectBytes.SetCascadeDeletes(_cascade);
            DeleteContextImpl context = new DeleteContextImpl(objectBytes, oh, _clazz.ClassReflector
                                                                  (), null);

            _clazz.DeleteMembers(context, _typeInfo, true);
        }
Esempio n. 20
0
 public override void Write(ByteArrayBuffer a_writer)
 {
     a_writer.WriteInt(_key);
     if (_object == null)
     {
         a_writer.WriteInt(0);
     }
     else
     {
         if (_object is TreeInt)
         {
             TreeInt.Write(a_writer, (TreeInt)_object);
         }
         else
         {
             ((IReadWriteable)_object).Write(a_writer);
         }
     }
 }
Esempio n. 21
0
 public virtual void Flush(DefragmentServicesImpl context)
 {
     if (_ids == null)
     {
         return;
     }
     IEnumerator idIter = new TreeKeyIterator(_ids);
     while (idIter.MoveNext())
     {
         var objectID = ((int) idIter.Current);
         var isClassID = false;
         if (objectID < 0)
         {
             objectID = -objectID;
             isClassID = true;
         }
         // seen object ids don't come by here anymore - any other candidates?
         context.MapIDs(objectID, context.TargetNewId(), isClassID);
     }
     context.Mapping().Commit();
     _ids = null;
 }
 protected virtual void AssertTreeInt(int[] expectedValues, TreeInt treeInt)
 {
     var visitor = ExpectingVisitor.CreateExpectingVisitor(expectedValues
         );
     treeInt.Traverse(new _IVisitor4_113(visitor));
     visitor.AssertExpectations();
 }
Esempio n. 23
0
			public void Visit(object a_object)
			{
				QCandidate candidate = (QCandidate)a_object;
				if (candidate.Include())
				{
					TreeInt ids = new TreeInt(candidate._key);
					ByRef idsNew = new ByRef();
					IEnumerator itPath = executionPath.GetEnumerator();
					while (itPath.MoveNext())
					{
						idsNew.value = null;
						string fieldName = (string)(itPath.Current);
						if (ids != null)
						{
							ids.Traverse(new _IVisitor4_385(this, stream, fieldName, idsNew));
						}
						ids = (TreeInt)((TreeInt)idsNew.value);
					}
					if (ids != null)
					{
						ids.Traverse(new _IVisitor4_406(result));
					}
				}
			}
Esempio n. 24
0
		private void AssertComplexItems(int[] expectedFoos, TreeInt found)
		{
			Assert.IsNotNull(found);
			AssertTreeInt(MapToObjectIds(CreateComplexItemQuery(), expectedFoos), found);
		}
Esempio n. 25
0
		private bool AlreadyHandled()
		{
			TreeInt newNode = new TreeInt(_id);
			_transaction._writtenUpdateAdjustedIndexes = Tree.Add(_transaction._writtenUpdateAdjustedIndexes
				, newNode);
			return !newNode.WasAddedToTree();
		}
Esempio n. 26
0
 public virtual Tree Find(int key)
 {
     return(TreeInt.Find(_tree, key));
 }
Esempio n. 27
0
		internal void FreePrefetchedIDs(IIdSystem idSystem)
		{
			if (_prefetchedIDs == null)
			{
				return;
			}
			idSystem.ReturnUnusedIds(_prefetchedIDs);
			_prefetchedIDs = null;
		}
Esempio n. 28
0
 public static QCandidate ToQCandidate(TreeInt tree, QCandidates
     candidates)
 {
     if (tree == null)
     {
         return null;
     }
     return tree.ToQCandidate(candidates);
 }
Esempio n. 29
0
 public static void Write(ByteArrayBuffer buffer, TreeInt
     tree, int size)
 {
     if (tree == null)
     {
         buffer.WriteInt(0);
         return;
     }
     buffer.WriteInt(size);
     tree.Traverse(new _IVisitor4_97(buffer));
 }
Esempio n. 30
0
 public override object ShallowClone()
 {
     Db4objects.Db4o.Internal.TreeInt treeint = new Db4objects.Db4o.Internal.TreeInt(_key
                                                                                     );
     return(ShallowCloneInternal(treeint));
 }
Esempio n. 31
0
 public static Db4objects.Db4o.Internal.TreeInt RemoveLike(Db4objects.Db4o.Internal.TreeInt
                                                           tree, int value)
 {
     return((Db4objects.Db4o.Internal.TreeInt)Tree.RemoveLike(tree, new Db4objects.Db4o.Internal.TreeInt
                                                                  (value)));
 }
Esempio n. 32
0
			public bool Match(object current)
			{
				int id = ((int)current);
				if (this.ids.Find(id) != null)
				{
					return false;
				}
				this.ids = (TreeInt)((TreeInt)this.ids.Add(new TreeInt(id)));
				return true;
			}
Esempio n. 33
0
			public void Visit(int id)
			{
				TreeInt ids = new TreeInt(id);
				ByRef idsNew = new ByRef();
				IEnumerator itPath = _executionPath.GetEnumerator();
				while (itPath.MoveNext())
				{
					idsNew.value = null;
					string fieldName = (string)(itPath.Current);
					ids.Traverse(new _IVisitor4_508(this, fieldName, idsNew));
					ids = (TreeInt)((TreeInt)idsNew.value);
					if (ids == null)
					{
						return;
					}
				}
				ids.Traverse(new _IVisitor4_529(this));
			}
Esempio n. 34
0
		public virtual void AddPrefetchedID(int id)
		{
			_prefetchedIDs = ((TreeInt)Tree.Add(_prefetchedIDs, new TreeInt(id)));
		}
Esempio n. 35
0
 public override object ShallowClone()
 {
     var treeint = new TreeInt(_key
         );
     return ShallowCloneInternal(treeint);
 }
Esempio n. 36
0
		public virtual void PrefetchedIDConsumed(int id)
		{
			_prefetchedIDs = ((TreeInt)_prefetchedIDs.RemoveLike(new TreeInt(id)));
		}
Esempio n. 37
0
 public static int MarshalledLength(TreeInt a_tree)
 {
     if (a_tree == null)
     {
         return Const4.IntLength;
     }
     return a_tree.MarshalledLength();
 }
Esempio n. 38
0
 public static TreeInt RemoveLike(TreeInt
                                  tree, int value)
 {
     return((TreeInt)RemoveLike(tree, new TreeInt
                                    (value)));
 }
Esempio n. 39
0
 public static TreeInt Add(TreeInt
     tree, int value)
 {
     return (TreeInt) Add(tree, new TreeInt(value));
 }
Esempio n. 40
0
 public static TreeInt Add(TreeInt
                           tree, int value)
 {
     return((TreeInt)Add(tree, new TreeInt(value)));
 }
Esempio n. 41
0
 public static TreeInt RemoveLike(TreeInt
     tree, int value)
 {
     return (TreeInt) RemoveLike(tree, new TreeInt
         (value));
 }
			public void Visit(object obj)
			{
				int id = ((int)obj);
				TreeInt newNode = new TreeInt(id);
				duplicates.value = Tree.Add(((Tree)duplicates.value), newNode);
				if (newNode.Size() != 0)
				{
					this._enclosing.Add(id);
				}
			}
Esempio n. 43
0
 public static Db4objects.Db4o.Internal.TreeInt Add(Db4objects.Db4o.Internal.TreeInt
                                                    tree, int value)
 {
     return((Db4objects.Db4o.Internal.TreeInt)((Db4objects.Db4o.Internal.TreeInt)Tree.
                                               Add(tree, new Db4objects.Db4o.Internal.TreeInt(value))));
 }
Esempio n. 44
0
		public object PeekPersisted(Transaction trans, int id, IActivationDepth depth, bool
			 resetJustPeeked)
		{
			if (resetJustPeeked)
			{
				_justPeeked = null;
			}
			else
			{
				TreeInt ti = new TreeInt(id);
				TreeIntObject tio = (TreeIntObject)Tree.Find(_justPeeked, ti);
				if (tio != null)
				{
					return tio._object;
				}
			}
			ObjectReference @ref = PeekReference(trans, id, depth, resetJustPeeked);
			return @ref.GetObject();
		}
Esempio n. 45
0
 public static void Write(ByteArrayBuffer buffer, Db4objects.Db4o.Internal.TreeInt
                          tree)
 {
     Write(buffer, tree, tree == null ? 0 : tree.Size());
 }
Esempio n. 46
0
			public void Add(TreeInt node)
			{
				tree = (TreeInt)((TreeInt)Tree.Add(tree, node));
			}
Esempio n. 47
0
 public override bool Equals(object obj)
 {
     Db4objects.Db4o.Internal.TreeInt other = (Db4objects.Db4o.Internal.TreeInt)obj;
     return(other._key == _key);
 }
Esempio n. 48
0
		public override object ShallowClone()
		{
			Db4objects.Db4o.Internal.TreeInt treeint = new Db4objects.Db4o.Internal.TreeInt(_key
				);
			return ShallowCloneInternal(treeint);
		}
Esempio n. 49
0
 public static void Write(ByteArrayBuffer buffer, TreeInt
     tree)
 {
     Write(buffer, tree, tree == null ? 0 : tree.Size());
 }
Esempio n. 50
0
		public virtual void AddId(int id)
		{
			_ids = (TreeInt)((TreeInt)Tree.Add(_ids, new TreeInt(id)));
		}
Esempio n. 51
0
 public static void Write(ByteArrayBuffer buffer, TreeInt
                          tree)
 {
     Write(buffer, tree, tree == null ? 0 : tree.Size());
 }