@Test public void testHashCode() { Tuple t1 = new VTuple(5); Tuple t2 = new VTuple(5); t1.put(0, DatumFactory.createInt4(1)); t1.put(1, DatumFactory.createInt4(2)); t1.put(3, DatumFactory.createInt4(2)); t1.put(4, DatumFactory.createText("hyunsik")); t2.put(0, DatumFactory.createInt4(1)); t2.put(1, DatumFactory.createInt4(2)); t2.put(3, DatumFactory.createInt4(2)); t2.put(4, DatumFactory.createText("hyunsik")); assertEquals(t1.hashCode(),t2.hashCode()); Tuple t3 = new VTuple(5); t3.put(0, DatumFactory.createInt4(1)); t3.put(1, DatumFactory.createInt4(2)); t3.put(4, DatumFactory.createInt4(2)); assertNotSame(t1.hashCode(),t3.hashCode()); }
@Override public int hashCode() { int hashCode = 37; for (int i=0; i < values.length; i++) { if(values[i] != null) { hashCode ^= (values[i].hashCode() * 41); } else { hashCode = hashCode ^ (i + 17); } } return hashCode; }
VTuple implements Tuple, Cloneable { @Override public int hashCode() { int hashCode = 37; for (int i=0; i < values.length; i++) { if(values[i] != null) { hashCode ^= (values[i].hashCode() * 41); } else { hashCode = hashCode ^ (i + 17); } } return hashCode; } }
VTuple implements Tuple, Cloneable { @Override public int hashCode() { int hashCode = 37; for (int i=0; i < values.length; i++) { if(values[i] != null) { hashCode ^= (values[i].hashCode() * 41); } else { hashCode = hashCode ^ (i + 17); } } return hashCode; } VTuple(int size);  VTuple(Tuple tuple);  VTuple(Datum [] datum); }
VTuple implements Tuple, Cloneable { @Override public int hashCode() { int hashCode = 37; for (int i=0; i < values.length; i++) { if(values[i] != null) { hashCode ^= (values[i].hashCode() * 41); } else { hashCode = hashCode ^ (i + 17); } } return hashCode; } VTuple(int size);  VTuple(Tuple tuple);  VTuple(Datum [] datum); @Override int size(); boolean contains(int fieldId); @Override boolean isNull(int fieldid); @Override void clear(); void put(int fieldId, Datum value); @Override void put(int fieldId, Datum[] values); @Override void put(int fieldId, Tuple tuple); void put(Datum [] values); Datum get(int fieldId); void setOffset(long offset); long getOffset(); @Override boolean getBool(int fieldId); @Override byte getByte(int fieldId); @Override char getChar(int fieldId); @Override byte [] getBytes(int fieldId); @Override short getInt2(int fieldId); @Override int getInt4(int fieldId); @Override long getInt8(int fieldId); @Override float getFloat4(int fieldId); @Override double getFloat8(int fieldId); Inet4Datum getIPv4(int fieldId); byte [] getIPv4Bytes(int fieldId); InetAddress getIPv6(int fieldId); byte[] getIPv6Bytes(int fieldId); @Override String getText(int fieldId); @Override Tuple clone(); String toString(); @Override int hashCode(); @Override Datum[] getValues(); @Override boolean equals(Object obj); }
VTuple implements Tuple, Cloneable { @Override public int hashCode() { int hashCode = 37; for (int i=0; i < values.length; i++) { if(values[i] != null) { hashCode ^= (values[i].hashCode() * 41); } else { hashCode = hashCode ^ (i + 17); } } return hashCode; } VTuple(int size);  VTuple(Tuple tuple);  VTuple(Datum [] datum); @Override int size(); boolean contains(int fieldId); @Override boolean isNull(int fieldid); @Override void clear(); void put(int fieldId, Datum value); @Override void put(int fieldId, Datum[] values); @Override void put(int fieldId, Tuple tuple); void put(Datum [] values); Datum get(int fieldId); void setOffset(long offset); long getOffset(); @Override boolean getBool(int fieldId); @Override byte getByte(int fieldId); @Override char getChar(int fieldId); @Override byte [] getBytes(int fieldId); @Override short getInt2(int fieldId); @Override int getInt4(int fieldId); @Override long getInt8(int fieldId); @Override float getFloat4(int fieldId); @Override double getFloat8(int fieldId); Inet4Datum getIPv4(int fieldId); byte [] getIPv4Bytes(int fieldId); InetAddress getIPv6(int fieldId); byte[] getIPv6Bytes(int fieldId); @Override String getText(int fieldId); @Override Tuple clone(); String toString(); @Override int hashCode(); @Override Datum[] getValues(); @Override boolean equals(Object obj); @Expose public Datum [] values; }