@Override public int hashCode() { int result = 17; result = 31 * result + id.hashCode(); result = 31 * result + Arrays.hashCode(teams); return result; }
@Override public int hashCode() { int hash = 3; hash = 67 * hash + Arrays.hashCode(this._bytes); return hash; }
public int hashCode() { // stolen from GPIndividual. It's a decent algorithm. int hash = this.getClass().hashCode(); hash = (hash << 1 | hash >>> 31) ^ Arrays.hashCode(genome); return hash; }
@Override public int hashCode() { return Arrays.hashCode(teammates); }
// returns an ID for each test result private int getTestId(ITestResult result) { int id = result.getTestClass().getName().hashCode(); id = 31 * id + result.getMethod().getMethodName().hashCode(); id = 31 * id + (result.getParameters() != null ? Arrays.hashCode(result.getParameters()) : 0); return id; }
/** {@inheritDoc} */ @Override public int hashCode() { return Arrays.hashCode(vals); }
/** @throws Exception If failed. */ public void testCompact() throws Exception { File file = new File(UUID.randomUUID().toString()); X.println("file: " + file.getPath()); FileSwapSpaceSpi.SwapFile f = new FileSwapSpaceSpi.SwapFile(file, 8); Random rnd = new Random(); ArrayList<FileSwapSpaceSpi.SwapValue> arr = new ArrayList<>(); int size = 0; for (int a = 0; a < 100; a++) { FileSwapSpaceSpi.SwapValue[] vals = new FileSwapSpaceSpi.SwapValue[1 + rnd.nextInt(10)]; int size0 = 0; for (int i = 0; i < vals.length; i++) { byte[] bytes = new byte[1 + rnd.nextInt(49)]; rnd.nextBytes(bytes); size0 += bytes.length; vals[i] = new FileSwapSpaceSpi.SwapValue(bytes); arr.add(vals[i]); } f.write(new FileSwapSpaceSpi.SwapValues(vals, size0), 1); size += size0; assertEquals(f.length(), size); assertEquals(file.length(), size); } int i = 0; for (FileSwapSpaceSpi.SwapValue val : arr) assertEquals(val.idx(), ++i); i = 0; for (int cnt = arr.size() / 2; i < cnt; i++) { FileSwapSpaceSpi.SwapValue v = arr.remove(rnd.nextInt(arr.size())); assertTrue(f.tryRemove(v.idx(), v)); } int hash0 = 0; for (FileSwapSpaceSpi.SwapValue val : arr) hash0 += Arrays.hashCode(val.readValue(f.readCh)); ArrayList<T2<ByteBuffer, ArrayDeque<FileSwapSpaceSpi.SwapValue>>> bufs = new ArrayList(); for (; ; ) { ArrayDeque<FileSwapSpaceSpi.SwapValue> que = new ArrayDeque<>(); ByteBuffer buf = f.compact(que, 1024); if (buf == null) break; bufs.add(new T2(buf, que)); } f.delete(); int hash1 = 0; for (FileSwapSpaceSpi.SwapValue val : arr) hash1 += Arrays.hashCode(val.value(null)); assertEquals(hash0, hash1); File file0 = new File(UUID.randomUUID().toString()); FileSwapSpaceSpi.SwapFile f0 = new FileSwapSpaceSpi.SwapFile(file0, 8); for (T2<ByteBuffer, ArrayDeque<FileSwapSpaceSpi.SwapValue>> t : bufs) f0.write(t.get2(), t.get1(), 1); int hash2 = 0; for (FileSwapSpaceSpi.SwapValue val : arr) hash2 += Arrays.hashCode(val.readValue(f0.readCh)); assertEquals(hash2, hash1); }
@Override public int hashCode() { return Arrays.hashCode(hashBytes); }
@Override public int hashCode() { return (superClass.hashCode() + Arrays.hashCode(interfaces)) ^ names.size(); }