commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [1/3] incubator-commonsrdf git commit: added Triple.equals()
Date Mon, 04 Apr 2016 14:19:03 GMT
Repository: incubator-commonsrdf
Updated Branches:
  refs/heads/jsonld-java db9fd7667 -> 7e4cb373e


added Triple.equals()


Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/ede1a704
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/ede1a704
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/ede1a704

Branch: refs/heads/jsonld-java
Commit: ede1a704b9427448651df148bd1da43cc1328b20
Parents: db9fd76
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Mon Apr 4 15:02:10 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Mon Apr 4 15:02:10 2016 +0100

----------------------------------------------------------------------
 .../commons/rdf/jsonldjava/JsonLDGraph.java      | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ede1a704/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLDGraph.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLDGraph.java
b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLDGraph.java
index ef117b7..461c4a2 100644
--- a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLDGraph.java
+++ b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLDGraph.java
@@ -19,6 +19,7 @@ package org.apache.commons.rdf.jsonldjava;
 
 import java.util.Iterator;
 import java.util.List;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.UUID;
 import java.util.function.Predicate;
@@ -83,6 +84,24 @@ public class JsonLDGraph implements Graph {
 			public RDFTerm getObject() {
 				return asTerm(quad.getObject());
 			}
+			
+			@Override
+			public boolean equals(Object obj) {
+				if (! (obj instanceof Triple)) {
+					return false;
+				}
+				Triple other = (Triple) obj;
+				return getSubject().equals(other.getSubject()) && 
+						getPredicate().equals(other.getPredicate()) && 
+						getObject().equals(other.getObject());
+				
+			}
+			
+			@Override
+			public int hashCode() {
+				return Objects.hash(getSubject(), getPredicate(), getObject());
+			}
+			
 		};
 	}
 	


Mime
View raw message