@Override public SimpleFeature apply(SimpleFeature input) { progressListener .setProgress((count.incrementAndGet() * 100.f) / typeTree.size()); return input; } });
private long sizeOfTree(ObjectId treeId) { if (treeId.isNull()) { return 0L; } RevTree tree = loadTree(treeId); return tree.size(); }
public static void encode(DataOutput out, RevTree tree) throws IOException { // object type out.write(RevObject.TYPE.TREE.ordinal()); final long totalSize = tree.size(); final int totalSubtrees = tree.numTrees(); Varint.writeUnsignedVarLong(totalSize, out); Varint.writeUnsignedVarInt(totalSubtrees, out); }
private long sumTreeSizes(Iterable<Node> trees) { long size = 0; for (Node n : trees) { RevTree tree = state.getTree(n.getObjectId()); if (state.isCancelled()) { return -1L; } size += tree.size(); } return size; } }
public static void encode(DataOutput out, RevTree tree) throws IOException { // object type out.write(RevObject.TYPE.TREE.ordinal()); final long totalSize = tree.size(); final int totalSubtrees = tree.numTrees(); Varint.writeUnsignedVarLong(totalSize, out); Varint.writeUnsignedVarInt(totalSubtrees, out); }
private long sizeOfTree(ObjectId treeId) { if (treeId.isNull()) { return 0L; } RevTree tree = loadTree(treeId); return tree.size(); }
@Override protected void print(RevTree revTree, Writer w) throws IOException { println(w, "size\t", Long.toString(revTree.size())); println(w, "numtrees\t", Integer.toString(revTree.numTrees())); writeChildren(w, revTree.trees()); writeChildren(w, revTree.features()); writeBuckets(w, revTree.getBuckets()); }
public @Test void testRemoveWorldPoints() { List<Node> nodes = IndexTestSupport.createWorldPointsNodes(5); final RevTreeBuilder builder = createBuiler(); nodes.forEach((n) -> assertTrue(builder.put(n))); RevTree tree = builder.build(); assertEquals(nodes.size(), tree.size()); List<Node> removes = nodes.subList(0, nodes.size() / 2); final RevTreeBuilder builder2 = createBuiler(tree); removes.forEach((n) -> assertTrue(builder2.remove(n))); RevTree tree2 = builder2.build(); assertEquals(nodes.size() - removes.size(), tree2.size()); }
@Test public void testFeaturesBucketsTree() { int numEntries = 2 * CanonicalNodeNameOrder.normalizedSizeLimit(0); RevTree tree = RevObjectTestSupport.INSTANCE.createFeaturesTree(source, "feature.", numEntries); assertEquals(numEntries, list(tree, Strategy.FEATURES_ONLY).size()); assertEquals(featuresBucketsTree.size(), list(featuresBucketsTree, Strategy.FEATURES_ONLY).size()); }
@Test public void testCreatesIndex() { indexInfo = createIndex(); final RevTree oldCanonicalTree = RevTree.EMPTY; final RevTree newCanonicalTree = worldPointsTree; RevTree indexTree = updateIndex(oldCanonicalTree, newCanonicalTree); assertNotEquals(RevTree.EMPTY, indexTree); assertEquals(newCanonicalTree.size(), indexTree.size()); IndexTestSupport.verifyIndex(geogig, indexTree.getId(), newCanonicalTree.getId()); }
@Test public void testCreatesMaterializedIndex() { indexInfo = createIndex("x", "y", "xystr"); final RevTree oldCanonicalTree = RevTree.EMPTY; final RevTree newCanonicalTree = worldPointsTree; RevTree indexTree = updateIndex(oldCanonicalTree, newCanonicalTree); assertNotEquals(RevTree.EMPTY, indexTree); assertEquals(newCanonicalTree.size(), indexTree.size()); IndexTestSupport.verifyIndex(geogig, indexTree.getId(), newCanonicalTree.getId(), "x", "y", "xystr"); }
private int writeNodeTree(RevTree tree, FlatBufferBuilder builder) { final int bucketsOffset = tree.bucketsSize() == 0 ? 0 : NodeTree.createBucketsVector(builder, writeBuckets(tree, builder)); NodeTree.startNodeTree(builder); NodeTree.addSize(builder, tree.size()); NodeTree.addNumTreesRecursive(builder, tree.numTrees()); if (bucketsOffset > 0) { NodeTree.addBuckets(builder, bucketsOffset); } return NodeTree.endNodeTree(builder); }
private void assertEqualsFully(RevTree o1, RevTree o2) { assertEquals(o1.size(), o2.size()); assertEquals(o1.numTrees(), o2.numTrees()); assertNodesEqual(o1.features(), o2.features()); assertNodesEqual(o1.trees(), o2.trees()); assertEquals(Lists.newArrayList(o1.getBuckets()), Lists.newArrayList(o2.getBuckets())); }
public static void assertEqualsFully(RevTree o1, RevTree o2) { assertEquals(o1.size(), o2.size()); assertEquals(o1.numTrees(), o2.numTrees()); assertEqualsFully(o1.features(), o2.features()); assertEqualsFully(o1.trees(), o2.trees()); assertEquals(Lists.newArrayList(o1.getBuckets()), Lists.newArrayList(o2.getBuckets())); }
private RevTree forceTreeId(RevTreeBuilder b, ObjectId treeId) { RevTree tree = b.build(); long size = tree.size(); int childTreeCount = tree.numTrees(); ImmutableList<Node> trees = tree.trees(); ImmutableList<Node> features = tree.features(); SortedMap<Integer, Bucket> buckets = tree.buckets(); RevTree fakenId = RevTreeBuilder.create(treeId, size, childTreeCount, trees, features, buckets); return fakenId; }