@Override public int hashCode() { if (ryatype == null) { return 0; } else { return ryatype.hashCode(); } } }
@Override public int hashCode() { if (ryatype == null) { return 0; } else { return ryatype.hashCode(); } } }
@Override public int hashCode() { int result = subject != null ? subject.hashCode() : 0; result = 31 * result + (predicate != null ? predicate.hashCode() : 0); result = 31 * result + (object != null ? object.hashCode() : 0); result = 31 * result + (context != null ? context.hashCode() : 0); result = 31 * result + (qualifer != null ? qualifer.hashCode() : 0); result = 31 * result + (columnVisibility != null ? Arrays.hashCode(columnVisibility) : 0); result = 31 * result + (value != null ? Arrays.hashCode(value) : 0); result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0); return result; }
@Override public int hashCode() { int result = subject != null ? subject.hashCode() : 0; result = 31 * result + (predicate != null ? predicate.hashCode() : 0); result = 31 * result + (object != null ? object.hashCode() : 0); result = 31 * result + (context != null ? context.hashCode() : 0); result = 31 * result + (qualifer != null ? qualifer.hashCode() : 0); result = 31 * result + (columnVisibility != null ? Arrays.hashCode(columnVisibility) : 0); result = 31 * result + (value != null ? Arrays.hashCode(value) : 0); result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0); return result; }
@Test public void testHashCodeEquals() throws Exception { Assert.assertEquals("Same data and same type should yield same hash code.", a.hashCode(), same.hashCode()); Assert.assertEquals("Same type and both null data should yield same hash code.", nullData.hashCode(), new RyaType(XMLSchema.STRING, null).hashCode()); Assert.assertEquals("Same data and both null type should yield same hash code.", nullType.hashCode(), new RyaType(null, "http://www.example.com/Alice").hashCode()); Assert.assertEquals("Null type and null data should yield same hash code.", nullBoth.hashCode(), new RyaType(null, null).hashCode()); } }
private static int getKey(RyaSubGraph subgraph) { int key = 0; for(RyaStatement statement: subgraph.getStatements()) { key += statement.getObject().hashCode(); } return key; }
private static int getKey(RyaSubGraph subgraph) { int key = 0; for(RyaStatement statement: subgraph.getStatements()) { key += statement.getObject().hashCode(); } return key; }