/** * @return whether or not this object id represents the {@link #NULL} object id */ public boolean isNull() { return NULL.equals(this); }
/** * @return whether or not this object id represents the {@link #NULL} object id */ public boolean isNull() { return NULL.equals(this); }
@Override public String toString() { String revTreeId = originalTreeId.equals(RevTree.EMPTY_TREE_ID) ? "EMPTY" : originalTreeId.toString().substring(0, 8); return String.format( "DAG[id:%s, orig:%s, status: %s, size: %,d, children: %,d, buckets: %,d)[children: %s, buckets: %s]", id, revTreeId, state, childCount, children.size(), buckets.size(), children, buckets); }
@Override public String toString() { String revTreeId = originalTreeId.equals(RevTree.EMPTY_TREE_ID) ? "EMPTY" : originalTreeId.toString().substring(0, 8); return String.format( "DAG[id:%s, orig:%s, status: %s, size: %,d, children: %,d, buckets: %,d)[children: %s, buckets: %s]", id, revTreeId, state, childCount, children.size(), buckets.size(), children, buckets); }
/** * Equality is based on id * * @see AbstractRevObject#equals(Object) */ @Override public boolean equals(Object o) { if (!(o instanceof RevTree)) { return false; } return id.equals(((RevTree) o).getId()); }
@Override public boolean apply(@Nullable Ref ref) { String refName = ref.getName(); ObjectId refId = ref.getObjectId(); return refName.startsWith(Ref.HEADS_PREFIX) && refId.equals(this.id); } };
/** * Equality is based on id * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object o) { if (!(o instanceof RevFeature)) { return false; } return getId().equals(((RevObject) o).getId()); }
/** * Equality is based on id * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object o) { if (!(o instanceof RevFeature)) { return false; } return getId().equals(((RevObject) o).getId()); }
@Override protected boolean existsInDestination(ObjectId commitId) { // If the commit has not been mapped, it hasn't been pushed to the remote yet return !source.graphDatabase().getMapping(commitId).equals(ObjectId.NULL); }
@Override public boolean apply(SimpleFeature input) { RevFeatureType type; type = (RevFeatureType) input.getUserData().get(RevFeatureType.class); ObjectId metadataId = type.getId(); if (!forceMetadataId.equals(metadataId)) { throw new GeoToolsOpException(StatusCode.MIXED_FEATURE_TYPES); } return true; } });
private boolean repositoryChanged(Ref ref) { Optional<Ref> transactionOriginal = transaction.command(RefParse.class) .setName(ref.getName().replace("refs/", "orig/refs/")).call(); if (transactionOriginal.isPresent()) { return !ref.getObjectId().equals(transactionOriginal.get().getObjectId()); } // Ref was created in transaction and on the repo return true; } }
private boolean repositoryChanged(Ref ref) { Optional<Ref> transactionOriginal = transaction.command(RefParse.class) .setName(ref.getName().replace("refs/", "orig/refs/")).call(); if (transactionOriginal.isPresent()) { return !ref.getObjectId().equals(transactionOriginal.get().getObjectId()); } // Ref was created in transaction and on the repo return true; } }
/** * Equality check based on {@link #getName() name}, {@link #getType() type}, and * {@link #getObjectId() objectId}; {@link #getMetadataId()} is NOT part of the equality check. */ public static boolean equals(@NonNull Node node, @Nullable Object o) { if (o instanceof Node) { Node r = (Node) o; return node.getType().equals(r.getType()) && node.getName().equals(r.getName()) && node.getObjectId().equals(r.getObjectId()); } return false; }
@Override public boolean equals(Object o) { if (o instanceof Index) { Index i = (Index) o; return info().equals(i.info()) && indexTreeId().equals(i.indexTreeId()); } return false; }
@Override protected Evaluation evaluate(CommitNode commitNode) { if (destination.objectExists(commitNode.getObjectId())) { return Evaluation.EXCLUDE_AND_PRUNE; } if (!commitNode.getObjectId().equals(ObjectId.NULL) && !source.objectExists(commitNode.getObjectId())) { // Source is too shallow throw new SynchronizationException(StatusCode.HISTORY_TOO_SHALLOW); } return Evaluation.INCLUDE_AND_CONTINUE; }
@Override protected Evaluation evaluate(CommitNode commitNode) { if (destination.objectExists(commitNode.getObjectId())) { return Evaluation.EXCLUDE_AND_PRUNE; } if (!commitNode.getObjectId().equals(ObjectId.NULL) && !source.objectExists(commitNode.getObjectId())) { // Source is too shallow throw new SynchronizationException(StatusCode.HISTORY_TOO_SHALLOW); } return Evaluation.INCLUDE_AND_CONTINUE; }
@Test public void testInsertNonEqualObjects() throws Exception { ObjectId oId1 = insertAndAdd(points1); ObjectId oId2 = insertAndAdd(points2); assertNotNull(oId1); assertNotNull(oId2); assertFalse(oId1.equals(oId2)); }
@Test public void testConstructorAndMutators() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).call(); Ref branch = geogig.command(BranchCreateOp.class).setName("branch1").call(); geogig.command(UpdateSymRef.class).setDelete(false).setName(Ref.HEAD) .setNewValue("refs/heads/branch1").setOldValue(Ref.MASTER) .setReason("this is a test").call(); Optional<ObjectId> branchId = geogig.command(RevParse.class).setRefSpec(Ref.HEAD).call(); assertTrue(branch.getObjectId().equals(branchId.get())); }
@Test public void testConstructorAndMutators() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).call(); Ref branch = geogig.command(BranchCreateOp.class).setName("branch1").call(); geogig.command(UpdateSymRef.class).setDelete(false).setName(Ref.HEAD) .setNewValue("refs/heads/branch1").setOldValue(Ref.MASTER) .setReason("this is a test").call(); Optional<ObjectId> branchId = geogig.command(RevParse.class).setRefSpec(Ref.HEAD).call(); assertTrue(branch.getObjectId().equals(branchId.get())); }