public override Tree OnAttemptToAddDuplicate(Tree oldNode) { _preceding = ((Tree)oldNode._preceding); _subsequent = ((Tree)oldNode._subsequent); _size = oldNode._size; return this; }
protected override Tree ShallowCloneInternal(Tree tree) { Db4objects.Db4o.Foundation.TreeString ts = (Db4objects.Db4o.Foundation.TreeString )base.ShallowCloneInternal(tree); ts._key = _key; return ts; }
private void AddFreeSlotNodes(int address, int length) { FreeSlotNode addressNode = new FreeSlotNode(address); addressNode.CreatePeer(length); _freeByAddress = Tree.Add(_freeByAddress, addressNode); AddToFreeBySize(addressNode._peer); }
protected override Tree ShallowCloneInternal(Tree tree) { var ts = (TreeString ) base.ShallowCloneInternal(tree); ts._key = _key; return ts; }
protected override Tree ShallowCloneInternal(Tree tree) { Db4objects.Db4o.Internal.TreeIntObject tio = (Db4objects.Db4o.Internal.TreeIntObject )base.ShallowCloneInternal(tree); tio._object = _object; return tio; }
protected override Tree ShallowCloneInternal(Tree tree) { var tio = (TreeIntObject ) base.ShallowCloneInternal(tree); tio._object = _object; return tio; }
public static Db4objects.Db4o.Internal.TreeInt Find(Tree a_in, int a_key) { if (a_in == null) { return null; } return ((Db4objects.Db4o.Internal.TreeInt)a_in).Find(a_key); }
private void RemoveObjectReferences() { if (_objectRefrencesToGC != null) { _objectRefrencesToGC.Traverse(new _IVisitor4_39(this)); } _objectRefrencesToGC = null; }
public static Tree Add(Tree oldTree, Tree newTree) { if (oldTree == null) { return newTree; } return (Tree)((Tree)oldTree).Add(newTree); }
public SortedCollection4(IComparison4 comparison) { if (null == comparison) { throw new ArgumentNullException(); } _comparison = comparison; _tree = null; }
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); }
private Tree LinkUp(Tree a_preceding, int a_level) { Tree node = (Tree)i_template.Read(i_bytes); i_current++; node._preceding = a_preceding; node._subsequent = LinkDown(a_level + 1); node.CalculateSize(); if (i_current < i_size) { return LinkUp(node, a_level - 1); } return node; }
public virtual bool Evaluate(QPending pending) { QPending oldPending = (QPending)Tree.Find(_pendingJoins, pending); if (oldPending == null) { pending.ChangeConstraint(); _pendingJoins = Tree.Add(_pendingJoins, pending.InternalClonePayload()); return true; } _pendingJoins = _pendingJoins.RemoveNode(oldPending); oldPending._join.EvaluatePending(this, oldPending, pending._result); return false; }
public QCandidate Add(QCandidate candidate) { i_root = Tree.Add(i_root, candidate); if (candidate._size == 0) { // This means that the candidate was already present // and QCandidate does not allow duplicates. // In this case QCandidate#isDuplicateOf will have // placed the existing QCandidate in the i_root // variable of the new candidate. We return it here: return candidate.GetRoot(); } return candidate; }
public virtual Tree Free(LocalObjectContainer file, Tree treeRoot, Slot slot) { file.Free(_slot.Address(), _slot.Length()); if (RemoveReferenceIsLast()) { if (treeRoot != null) { return treeRoot.RemoveNode(this); } } PointTo(slot); return treeRoot; }
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; }
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; }
/// <summary> /// On adding a node to a tree, if it already exists, and if /// Tree#duplicates() returns false, #isDuplicateOf() will be /// called. /// </summary> /// <remarks> /// On adding a node to a tree, if it already exists, and if /// Tree#duplicates() returns false, #isDuplicateOf() will be /// called. The added node can then be asked for the node that /// prevails in the tree using #duplicateOrThis(). This mechanism /// allows doing find() and add() in one run. /// </remarks> public virtual Tree Add(Tree newNode, int cmp) { if (cmp < 0) { if (_subsequent == null) { _subsequent = newNode; _size++; } else { _subsequent = _subsequent.Add(newNode); if (_preceding == null) { return (Tree)RotateLeft(); } return (Tree)Balance(); } } else { if (cmp > 0 || ((Tree)newNode).Duplicates()) { if (_preceding == null) { _preceding = newNode; _size++; } else { _preceding = _preceding.Add(newNode); if (_subsequent == null) { return (Tree)RotateRight(); } return (Tree)Balance(); } } else { return (Tree)((Tree)newNode).OnAttemptToAddDuplicate(this); } } return (Tree)this; }
private static ReflectConstructorSpec FindConstructor(IReflectClass claxx, Tree sortedConstructors ) { if (sortedConstructors == null) { return ReflectConstructorSpec.InvalidConstructor; } IEnumerator iter = new TreeNodeIterator(sortedConstructors); while (iter.MoveNext()) { var current = iter.Current; var constructor = (IReflectConstructor) ((TreeIntObject) current)._object; var args = NullArgumentsFor(constructor); var res = constructor.NewInstance(args); if (res != null) { return new ReflectConstructorSpec(constructor, args); } } return ReflectConstructorSpec.InvalidConstructor; }
public void SetSizeOwnPlus(Tree tree) { _size = OwnSize() + tree._size; }
public override int Compare(Tree a_to) { return _key - ((Db4objects.Db4o.Internal.TreeInt)a_to)._key; }
protected override Tree ShallowCloneInternal(Tree tree) { Db4objects.Db4o.Internal.TreeInt treeint = (Db4objects.Db4o.Internal.TreeInt)base .ShallowCloneInternal(tree); treeint._key = _key; return treeint; }
// Keep the debug method to debug the depth // public final void debugLeafDepth(int currentDepth){ // currentDepth++; // if(_preceding == null && _subsequent == null){ // System.out.println("" + currentDepth + " tree leaf depth."); // return; // } // if (_preceding != null){ // _preceding.debugLeafDepth(currentDepth); // } // if(_subsequent != null){ // _subsequent.debugLeafDepth(currentDepth); // } // } protected virtual Tree ShallowCloneInternal(Tree tree) { tree._preceding = _preceding; tree._size = _size; tree._subsequent = _subsequent; return tree; }
private bool Traverse(Tree startingNode, ICancellableVisitor4 visitor) { if (startingNode != null) { int cmp = Compare(startingNode); if (cmp < 0) { if (_subsequent != null) { return _subsequent.Traverse(startingNode, visitor); } return true; } else { if (cmp > 0) { if (_preceding != null) { if (!_preceding.Traverse(startingNode, visitor)) { return false; } } } } } else { if (_preceding != null) { if (!_preceding.Traverse(null, visitor)) { return false; } } } if (!visitor.Visit(this)) { return false; } if (_subsequent != null) { if (!_subsequent.Traverse(null, visitor)) { return false; } } return true; }
/// <summary>Traverses a tree with a starting point node.</summary> /// <remarks> /// Traverses a tree with a starting point node. /// If there is no exact match for the starting node, the next higher will be taken. /// </remarks> public static void Traverse(Tree tree, Tree startingNode, ICancellableVisitor4 visitor ) { if (tree == null) { return; } tree.Traverse(startingNode, visitor); }
public static void Traverse(Tree tree, IVisitor4 visitor) { if (tree == null) { return; } tree.Traverse(visitor); }
public static int Size(Tree a_tree) { if (a_tree == null) { return 0; } return a_tree.Size(); }
public void SetSizeOwnPlus(Tree tree1, Tree tree2) { _size = OwnSize() + tree1._size + tree2._size; }
private Tree RotateSmallestUp() { if (_preceding != null) { _preceding = _preceding.RotateSmallestUp(); return RotateRight(); } return this; }
public Tree RotateRight() { Tree tree = _preceding; _preceding = ((Tree)tree._subsequent); CalculateSize(); tree._subsequent = this; if (((Tree)tree._preceding) == null) { tree.SetSizeOwnPlus(this); } else { tree.SetSizeOwnPlus(this, ((Tree)tree._preceding)); } return tree; }