/** * Returns a shallow clone of this instance (the underlying longs are * <b>not</b> copied and will be shared by both the returned object and this * object. * * @see #deepCopyOf */ @Override public LongsRef clone() { return new LongsRef(longs, offset, length); }
/** This instance will directly reference longs w/o making a copy. * longs should not be null */ public LongsRef(long[] longs, int offset, int length) { this.longs = longs; this.offset = offset; this.length = length; assert isValid(); }
@Override public boolean equals(Object other) { if (other == null) { return false; } if (other instanceof LongsRef) { return this.longsEquals((LongsRef) other); } return false; }
/** * Creates a new LongsRef that points to a copy of the longs from * <code>other</code> * <p> * The returned IntsRef will have a length of other.length * and an offset of zero. */ public static LongsRef deepCopyOf(LongsRef other) { return new LongsRef(ArrayUtil.copyOfSubArray(other.longs, other.offset, other.offset + other.length), 0, other.length); }
/** This instance will directly reference longs w/o making a copy. * longs should not be null */ public LongsRef(long[] longs, int offset, int length) { this.longs = longs; this.offset = offset; this.length = length; assert isValid(); }
@Override public boolean equals(Object other) { if (other == null) { return false; } if (other instanceof LongsRef) { return this.longsEquals((LongsRef) other); } return false; }
/** Sole constructor. * @param blockSize the number of values of a block, must be equal to the * block size of the {@link BlockPackedWriter} which has * been used to write the stream */ public BlockPackedReaderIterator(DataInput in, int packedIntsVersion, int blockSize, long valueCount) { checkBlockSize(blockSize, MIN_BLOCK_SIZE, MAX_BLOCK_SIZE); this.packedIntsVersion = packedIntsVersion; this.blockSize = blockSize; this.values = new long[blockSize]; this.valuesRef = new LongsRef(this.values, 0, 0); reset(in, valueCount); }
/** This instance will directly reference longs w/o making a copy. * longs should not be null */ public LongsRef(long[] longs, int offset, int length) { this.longs = longs; this.offset = offset; this.length = length; assert isValid(); }
@Override public boolean equals(Object other) { if (other == null) { return false; } if (other instanceof LongsRef) { return this.longsEquals((LongsRef) other); } return false; }
PackedReaderIterator(PackedInts.Format format, int packedIntsVersion, int valueCount, int bitsPerValue, DataInput in, int mem) { super(valueCount, bitsPerValue, in); this.format = format; this.packedIntsVersion = packedIntsVersion; bulkOperation = BulkOperation.of(format, bitsPerValue); iterations = bulkOperation.computeIterations(valueCount, mem); assert valueCount == 0 || iterations > 0; nextBlocks = new byte[iterations * bulkOperation.byteBlockCount()]; nextValues = new LongsRef(new long[iterations * bulkOperation.byteValueCount()], 0, 0); nextValues.offset = nextValues.longs.length; position = -1; }
/** This instance will directly reference longs w/o making a copy. * longs should not be null */ public LongsRef(long[] longs, int offset, int length) { this.longs = longs; this.offset = offset; this.length = length; assert isValid(); }
@Override public boolean equals(Object other) { if (other == null) { return false; } if (other instanceof LongsRef) { return this.longsEquals((LongsRef) other); } return false; }
public OrdinalsBuilder(int maxDoc, float acceptableOverheadRatio) { this.maxDoc = maxDoc; int startBitsPerValue = 8; ordinals = new OrdinalsStore(maxDoc, startBitsPerValue, acceptableOverheadRatio); spare = new LongsRef(); }
/** * Returns a shallow clone of this instance (the underlying longs are * <b>not</b> copied and will be shared by both the returned object and this * object. * * @see #deepCopyOf */ @Override public LongsRef clone() { return new LongsRef(longs, offset, length); }
/** * Returns a shallow clone of this instance (the underlying longs are * <b>not</b> copied and will be shared by both the returned object and this * object. * * @see #deepCopyOf */ @Override public LongsRef clone() { return new LongsRef(longs, offset, length); }
/** * Returns a shallow clone of this instance (the underlying longs are * <b>not</b> copied and will be shared by both the returned object and this * object. * * @see #deepCopyOf */ @Override public LongsRef clone() { return new LongsRef(longs, offset, length); }
/** * Creates a new LongsRef that points to a copy of the longs from * <code>other</code> * <p> * The returned IntsRef will have a length of other.length * and an offset of zero. */ public static LongsRef deepCopyOf(LongsRef other) { return new LongsRef(Arrays.copyOfRange(other.longs, other.offset, other.offset + other.length), 0, other.length); }
/** * Creates a new LongsRef that points to a copy of the longs from * <code>other</code> * <p> * The returned IntsRef will have a length of other.length * and an offset of zero. */ public static LongsRef deepCopyOf(LongsRef other) { return new LongsRef(Arrays.copyOfRange(other.longs, other.offset, other.offset + other.length), 0, other.length); }
/** * Creates a new LongsRef that points to a copy of the longs from * <code>other</code> * <p> * The returned IntsRef will have a length of other.length * and an offset of zero. */ public static LongsRef deepCopyOf(LongsRef other) { return new LongsRef(ArrayUtil.copyOfSubArray(other.longs, other.offset, other.offset + other.length), 0, other.length); }
@Override public Iterator<Number> iterator() { final Iterator<Number> valueCountIterator = docToValueCount.iterator(); final Iterator<Number> valueIterator = values.iterator(); final LongsRef docValues = new LongsRef(256); return new Iterator<Number>() { @Override public boolean hasNext() { return valueCountIterator.hasNext(); } @Override public Number next() { docValues.length = valueCountIterator.next().intValue(); for (int i = 0; i < docValues.length; ++i) { docValues.longs[i] = valueIterator.next().longValue(); } final Integer id = setIds.get(docValues); assert id != null; return id; } }; } };