/** * Adds or replaces an element in the tree with the given node. * <p> * <!-- Implementation detail: If the number of cached entries (entries held directly by this * tree) reaches {@link #DEFAULT_NORMALIZATION_THRESHOLD}, this tree will {@link #normalize()} * itself. * * --> * * @param node The {@link org.locationtech.geogig.model.Node Node} to add or replace. * @return a reference to this {@link org.locationtech.geogig.model.impl.RevTreeBuilder * RevTreeBuilder} */ public synchronized boolean put(final Node node) { Preconditions.checkNotNull(node, "node can't be null"); putInternal(node); if (numPendingChanges() >= this.normalizationThreshold) { // hit the split factor modification tolerance, lets normalize normalize(); } return true; }
checkArgument(copy.buckets().isEmpty()); for (Node node : copy.trees()) { putInternal(node); checkArgument(copy.buckets().isEmpty()); for (Node node : copy.features()) { putInternal(node);
/** * @param tree * @return */ private RevTree moveBucketsToChildren(RevTree tree) { checkState(!tree.buckets().isEmpty()); checkState(this.bucketTreesByBucket.isEmpty()); for (Bucket bucket : tree.buckets().values()) { ObjectId id = bucket.getObjectId(); RevTree bucketTree = this.loadTree(id); if (!bucketTree.buckets().isEmpty()) { moveBucketsToChildren(bucketTree); } else { Iterator<Node> children = RevObjects.children(bucketTree, CanonicalNodeOrder.INSTANCE); while (children.hasNext()) { Node next = children.next(); putInternal(next); } } } return normalizeToChildren(); }
/** * Adds or replaces an element in the tree with the given node. * <p> * <!-- Implementation detail: If the number of cached entries (entries held directly by this * tree) reaches {@link #DEFAULT_NORMALIZATION_THRESHOLD}, this tree will {@link #normalize()} * itself. * * --> * * @param node The {@link org.locationtech.geogig.model.Node Node} to add or replace. * @return a reference to this {@link org.locationtech.geogig.model.RevTreeBuilder * RevTreeBuilder} */ public synchronized boolean put(final Node node) { Preconditions.checkNotNull(node, "node can't be null"); putInternal(node); if (numPendingChanges() >= this.normalizationThreshold) { // hit the split factor modification tolerance, lets normalize normalize(); } return true; }
checkArgument(0 == copy.bucketsSize()); for (Node node : copy.trees()) { putInternal(node); checkArgument(0 == copy.bucketsSize()); for (Node node : copy.features()) { putInternal(node);
/** * @param tree * @return */ private RevTree moveBucketsToChildren(RevTree tree) { checkState(!tree.buckets().isEmpty()); checkState(this.bucketTreesByBucket.isEmpty()); for (Bucket bucket : tree.buckets().values()) { ObjectId id = bucket.getObjectId(); RevTree bucketTree = this.loadTree(id); if (!bucketTree.buckets().isEmpty()) { moveBucketsToChildren(bucketTree); } else { Iterator<Node> children = RevObjects.children(bucketTree, CanonicalNodeOrder.INSTANCE); while (children.hasNext()) { Node next = children.next(); putInternal(next); } } } return normalizeToChildren(); }