private MutableTree(String name) { this(RevObjectFactory.defaultInstance().createNode(name, RevTree.EMPTY_TREE_ID, ObjectId.NULL, TYPE.TREE, null, null)); }
public static final Bucket readBucket(int index, DataInput in) throws IOException { ObjectId objectId = ObjectId.readFrom(in); Envelope bounds = readBBox(in); return RevObjectFactory.defaultInstance().createBucket(objectId, index, bounds); }
static RevTree build(final long size, final int childTreeCount, @Nullable List<Node> trees, @Nullable List<Node> features, @Nullable SortedSet<Bucket> buckets) { trees = trees == null ? Collections.emptyList() : trees; features = features == null ? Collections.emptyList() : features; buckets = buckets == null ? Collections.emptySortedSet() : buckets; ObjectId id = HashObjectFunnels.hashTree(trees, features, buckets); if (buckets.isEmpty()) { return RevObjectFactory.defaultInstance().createTree(id, size, trees, features); } return RevObjectFactory.defaultInstance().createTree(id, size, childTreeCount, buckets); }
public RevPerson build(@Nullable String name, @Nullable String email, long timeStamp, int timeZoneOffset) { return RevObjectFactory.defaultInstance().createPerson(name, email, timeStamp, timeZoneOffset); }
public RevFeature build() { if (id == null) { id = HashObjectFunnels.hashFeature(values); } return RevObjectFactory.defaultInstance().createFeature(id, values); }
@Before public void before() { ObjectId oid = hashString("id"); ObjectId metadataId = hashString("metadata"); Envelope bounds = new Envelope(0, 180, 0, 90); Map<String, Object> materializedAttributes = ImmutableMap.of(// "int", 1, // "double", 0.5, // "date", new Date(1486344231314L)); Map<String, Object> extraData = ImmutableMap.of(IndexInfo.FEATURE_ATTRIBUTES_EXTRA_DATA, materializedAttributes); testNode = RevObjectFactory.defaultInstance().createNode("test", oid, metadataId, TYPE.FEATURE, bounds, extraData); testNodeRef = new NodeRef(testNode, "fakeLayerName", metadataId); ObjectId bucketId = hashString("bucketId"); testBucket = RevObjectFactory.defaultInstance().createBucket(bucketId, 0, bounds); }
ObjectId bucketId = ObjectId.valueOf(tokens.get(2)); Envelope bounds = parseBBox(tokens.get(3)); Bucket bucket = RevObjectFactory.defaultInstance().createBucket(bucketId, idx.intValue(), bounds); subtrees.add(bucket); return RevObjectFactory.defaultInstance().createTree(id, size, trees.build(), features.build()); return RevObjectFactory.defaultInstance().createTree(id, size, numTrees, subtrees);
public @Override Node createNode(String name, ObjectId objectId, ObjectId metadataId, TYPE type, @Nullable Envelope bounds, @Nullable Map<String, Object> extraData) { return DEFAULT_IMPL.createNode(name, objectId, metadataId, type, bounds, extraData); }
public RevCommit build(@NonNull ObjectId treeId, @NonNull List<ObjectId> parents, @NonNull RevPerson author, @NonNull RevPerson committer, @NonNull String message) { final ObjectId commitId = HashObjectFunnels.hashCommit(treeId, parents, author, committer, message); return RevObjectFactory.defaultInstance().createCommit(commitId, treeId, ImmutableList.copyOf(parents), author, committer, message); } }
private RevTree createBucketTree(int i) { final int bucketCount = 32; SortedSet<Bucket> buckets = new TreeSet<>(); for (int b = 0; b < bucketCount; b++) { ObjectId bucketTree = RevObjectTestSupport.hashString("b" + b); Envelope bounds = new Envelope(0, b, 0, b); Bucket bucket = objectFactory.createBucket(bucketTree, b, bounds); buckets.add(bucket); } final ObjectId fakeId = RevObjectTestSupport.hashString(String.valueOf(i)); RevTree tree = objectFactory.createTree(fakeId, 1024, 0, buckets); return tree; }
public @Override Bucket createBucket(@NonNull ObjectId bucketTree, int bucketIndex, @Nullable Envelope bounds) { if (bucketIndex < 0) { throw new IllegalArgumentException( "Bucket cannot have a negative index: " + bucketIndex); } return DEFAULT_IMPL.createBucket(bucketTree, bucketIndex, bounds); }
public RevTag build(@Nullable ObjectId id, @NonNull String name, @NonNull ObjectId commitId, @NonNull String message, @NonNull RevPerson tagger) { if (id == null) { id = HashObjectFunnels.hashTag(name, commitId, message, tagger); } if (factory == null) { factory = RevObjectFactory.defaultInstance(); } return factory.createTag(id, name, commitId, message, tagger); } }
/** * Creates and returns a new {@link RevFeatureType} for the given FeatureType with the given * {@link ObjectId id} without verifying the SHA-1 matches the contents of the * {@link RevFeatureType} */ public RevFeatureType build(@Nullable ObjectId id, @NonNull FeatureType ftype) { FeatureType featureType = adapt(ftype); ObjectId oid = id == null ? HashObjectFunnels.hashFeatureType(featureType) : id; return RevObjectFactory.defaultInstance().createFeatureType(oid, featureType); }
private RevTree createLeafTree(int i) { final int numNodes = 512; List<Node> nodes = IntStream.range(0, numNodes).mapToObj(this::createNode) .collect(Collectors.toList()); ObjectId id = ObjectId.create(i, i * i, i * i * i); RevTree tree = objectFactory.createTree(id, numNodes, Collections.emptyList(), ImmutableList.copyOf(nodes)); return tree; }
private void testCommit(ObjectId id, ObjectId treeId, List<ObjectId> parents, RevPerson author, RevPerson committer, String message) { RevCommit actual = factory.createCommit(id, treeId, parents, author, committer, message); assertNotNull(actual); final RevCommit expected = DEFAULT.createCommit(id, treeId, parents, author, committer, message); RevObjectTestUtil.deepEquals(expected, actual); }
private RevFeatureType testCreateFeatureType(ObjectId id, SimpleFeatureType type) { RevFeatureType actual = factory.createFeatureType(id, type); assertNotNull(actual); RevFeatureType expected = DEFAULT.createFeatureType(id, type); assertNotNull(expected); RevObjectTestUtil.deepEquals(expected, actual); return actual; }
private void testCreateFeature(ObjectId id, List<Object> values) { RevFeature actual = factory.createFeature(id, values); assertNotNull(actual); RevFeature expected = DEFAULT.createFeature(id, values); assertNotNull(expected); assertEquals(id, expected.getId()); RevObjectTestUtil.deepEquals(expected, actual); }
@Before public void before() { ObjectId oid = hashString("id"); ObjectId metadataId = hashString("metadata"); Envelope bounds = new Envelope(0, 180, 0, 90); Map<String, Object> materializedAttributes = new HashMap<>(); materializedAttributes.put("int", 1); materializedAttributes.put("double", 0.5); materializedAttributes.put("date", DATE_VALUE); materializedAttributes.put("string", "geogig"); materializedAttributes.put("nullprop", null); filterSplitter = new PrePostFilterSplitter() .extraAttributes(materializedAttributes.keySet()); Map<String, Object> extraData = ImmutableMap.of(IndexInfo.FEATURE_ATTRIBUTES_EXTRA_DATA, materializedAttributes); testNode = RevObjectFactory.defaultInstance().createNode("testFid", oid, metadataId, TYPE.FEATURE, bounds, extraData); testNodeRef = new NodeRef(testNode, "fakeLayerName", metadataId); ObjectId bucketId = hashString("bucketId"); testBucket = RevObjectFactory.defaultInstance().createBucket(bucketId, 0, bounds); }
private RevTree createBucketTree(int i) { final int bucketCount = 32; SortedSet<Bucket> buckets = new TreeSet<>(); for (int b = 0; b < bucketCount; b++) { ObjectId bucketTree = RevObjectTestSupport.hashString("b" + b); Envelope bounds = new Envelope(0, b, 0, b); Bucket bucket = RevObjectFactory.defaultInstance().createBucket(bucketTree, 0, bounds); buckets.add(bucket); } final ObjectId fakeId = RevObjectTestSupport.hashString(String.valueOf(i)); RevTree tree = RevObjectFactory.defaultInstance().createTree(fakeId, 1024, 0, buckets); return tree; }
private Node createNode(String name, ObjectId oid, ObjectId metadataId, TYPE type, Envelope bounds, Map<String, Object> extraData) { Node actual = factory.createNode(name, oid, metadataId, type, bounds, extraData); return actual; }