@Override public long getLong( long index ) { final long start = index * width; return bitVector.getLong( start, start + width ); }
@Override public long getLong( long index ) { final long start = index * width; return bitVector.getLong( start, start + width ); }
@Override public long getLong(final long index) { final long start = index * width; return bitVector.getLong(start, start + width); }
@Override @SuppressWarnings("unchecked") public long getLong(final Object o) { if (n == 0) return defRetValue; final int[] e = new int[4]; final long[] h = new long[3]; Hashes.spooky4(transform.toBitVector((T) o), globalSeed, h); final int chunk = chunkShift == Long.SIZE ? 0 : (int) (h[0] >>> chunkShift); final long olc = offsetAndSeed[chunk]; final long chunkOffset = olc & OFFSET_MASK; final long nextChunkOffset = offsetAndSeed[chunk + 1] & OFFSET_MASK; final long chunkSeed = olc & SEED_MASK; final int w = globalMaxCodewordLength; final int numVariables = (int)(nextChunkOffset - chunkOffset - w); if (numVariables == 0) return defRetValue; Linear4SystemSolver.tripleToEquation(h, chunkSeed, numVariables, e); final long e0 = e[0] + chunkOffset, e1 = e[1] + chunkOffset, e2 = e[2] + chunkOffset, e3 = e[3] + chunkOffset; final long code = data.getLong(e0, e0 + w) ^ data.getLong(e1, e1 + w) ^ data.getLong(e2, e2 + w) ^ data.getLong(e3, e3 + w); return decoder.decode(code); }
@Override @SuppressWarnings("unchecked") public long getLong(final Object o) { if (n == 0) return defRetValue; final int[] e = new int[3]; final long[] h = new long[3]; Hashes.spooky4(transform.toBitVector((T) o), globalSeed, h); final int chunk = chunkShift == Long.SIZE ? 0 : (int) (h[0] >>> chunkShift); final long olc = offsetAndSeed[chunk]; final long chunkOffset = olc & OFFSET_MASK; final long nextChunkOffset = offsetAndSeed[chunk + 1] & OFFSET_MASK; final long chunkSeed = olc & SEED_MASK; final int w = globalMaxCodewordLength; final int numVariables = (int)(nextChunkOffset - chunkOffset - w); if (numVariables == 0) return defRetValue; Linear3SystemSolver.tripleToEquation(h, chunkSeed, numVariables, e); final long e0 = e[0] + chunkOffset, e1 = e[1] + chunkOffset, e2 = e[2] + chunkOffset; return decoder.decode(data.getLong(e0, e0 + w) ^ data.getLong(e1, e1 + w) ^ data.getLong(e2, e2 + w)); }
@Override public long getLong(final long index) { final long from = borders.getLong(index), to = borders.getLong(index + 1); return ((1L << (to - from)) | bits.getLong(from, to)) - offset; }
/** Extracts a number of consecutive entries into a given array fragment. * * @param index the index of the first entry returned. * @param dest the destination array; it will be filled with {@code length} consecutive entries starting at position {@code offset}. * @param offset the first position written in {@code dest}. * @param length the number of elements written in {@code dest} starting at {@code offset}. * @return {@code dest} * @see #get(long, long[]) */ public long[] get(long index, final long dest[], final int offset, final int length) { long from = borders.getLong(index++), to; // We use the destination array to cache borders. borders.get(index, dest, offset, length); for(int i = 0; i < length; i++) { to = dest[offset + i]; dest[offset + i] = ((1L << (to - from)) | bits.getLong(from, to)) - this.offset; from = to; } return dest; }
if (pathLength > 0) for(int i = 0; i < pathLength; i += Long.SIZE) obs.writeLong(n.path.getLong(i, Math.min(i + Long.SIZE, pathLength)), Math.min(Long.SIZE, pathLength - i));
falseFollowsKeys.writeDelta(skip); for(int i = 0; i < skip; i += Long.SIZE) falseFollowsKeys.writeLong(curr.getLong(s + i, Math.min(s + i + Long.SIZE, s + skip)), Math.min(Long.SIZE, skip - i)); final long key[] = new long[(skip + Long.SIZE - 1) / Long.SIZE + 1]; key[0] = p - 1; for(int i = 0; i < skip; i += Long.SIZE) key[i / Long.SIZE + 1] = curr.getLong(s + i, Math.min(s + i + Long.SIZE, s + skip)); final long result = falseFollows.put(LongArrayBitVector.wrap(key, skip + Long.SIZE), 0); assert result == -1 : result + " != " + -1; externalKeys.writeDelta(pathLength); for(int i = 0; i < pathLength; i += Long.SIZE) externalKeys.writeLong(curr.getLong(startPath + i, Math.min(startPath + i + Long.SIZE, endPath)), Math.min(Long.SIZE, endPath - i - startPath)); final long key[] = new long[(pathLength + Long.SIZE - 1) / Long.SIZE + 1]; key[0] = p - 1; for(int i = 0; i < pathLength; i += Long.SIZE) key[i / Long.SIZE + 1] = curr.getLong(startPath + i, Math.min(startPath + i + Long.SIZE, endPath)); assert externalTestFunction.put(LongArrayBitVector.wrap(key, pathLength + Long.SIZE), exitLeft ? LEFT : RIGHT) == -1; if (DEBUG) System.err.println(externalTestFunction); falseFollowsKeys.writeDelta(pathLength); for(int i = 0; i < pathLength; i += Long.SIZE) falseFollowsKeys.writeLong(curr.getLong(startPath + i, Math.min(startPath + i + Long.SIZE, endPath)), Math.min(Long.SIZE, endPath - i - startPath)); for(int i = 0; i < pathLength; i += Long.SIZE) key[i / Long.SIZE + 1] = curr.getLong(startPath + i, Math.min(startPath + i + Long.SIZE, endPath)); assert falseFollows.put(LongArrayBitVector.wrap(key, pathLength + Long.SIZE), 1) == -1; if (DEBUG) System.err.println(falseFollows);
if (pathLength > 0) for(int i = 0; i < pathLength; i += Long.SIZE) obs.writeLong(n.path.getLong(i, Math.min(i + Long.SIZE, pathLength)), Math.min(Long.SIZE, pathLength - i));