/** * Get the shape from * the given int buffer * @param buffer the buffer to get the shape information for * @return */ public static IntBuffer shapeOf(IntBuffer buffer) { Buffer buffer2 = (Buffer) buffer; IntBuffer ret = (IntBuffer) buffer2.position(1); return ret.slice(); }
/** * Get the stride for the given * shape information buffer * @param buffer * @return */ public static IntBuffer stride(IntBuffer buffer) { int rank = rank(buffer); val buffer2 = (Buffer) buffer; val ret = (IntBuffer) buffer2.position(1 + rank); return ret.slice(); }
/** * Return the value at the given indexes, without checking bounds * * @param rowIndex an int row index * @param columnIndex an int column index * @return the double at the index */ @Override public double getQuick(int rowIndex, int columnIndex) { IntBuffer tmp = data.get(bufferIndex[rowIndex]).asReadOnlyBuffer(); tmp.position(rowOffset[rowIndex]); tmp.limit(rowSize[rowIndex]); tmp = tmp.slice(); return searchForIndex(tmp, columnIndex); }
/** * Returns a view of a row. Changes to the view will affect the original. * * @param rowIndex Which row to return. * @return A vector that references the desired row. */ @Override public Vector viewRow(int rowIndex) { IntBuffer tmp = data.get(bufferIndex[rowIndex]).asReadOnlyBuffer(); tmp.position(rowOffset[rowIndex]); tmp.limit(rowOffset[rowIndex] + rowSize[rowIndex]); tmp = tmp.slice(); return new SparseBinaryVector(tmp, columnSize()); }
@Override public IntBuffer sliceBuffer(IntBuffer buffer) { return buffer.slice(); }
@Override public IntBuffer sliceBuffer(IntBuffer buffer) { return buffer.slice(); }
/** * Get the shape from * the given int buffer * @param buffer the buffer to get the shape information for * @return */ public static IntBuffer shapeOf(IntBuffer buffer) { IntBuffer ret = (IntBuffer) buffer.position(1); return ret.slice(); }
IntBuffer get(int[] array, int index) { return IntBuffer.wrap( array, index, 1 ).slice(); } get( array, 5 ).put( 42 );
/** * Get the stride for the given * shape information buffer * @param buffer * @return */ public static IntBuffer stride(IntBuffer buffer) { int rank = rank(buffer); IntBuffer ret = (IntBuffer) buffer.position(1 + rank); return ret.slice(); }
public static IntBuffer sliced( IntBuffer buffer, int first, int count ) { IntBuffer buffer2 = buffer.duplicate( ); buffer2.limit( first + count ); buffer2.position( first ); return buffer2.slice( ); }
protected Entry<K, V> getEntryAtTableOffset(int offset) { IntBuffer entry = ((IntBuffer) hashtable.duplicate().position(offset).limit(offset + ENTRY_SIZE)).slice(); if (isPresent(entry)) { return new DirectEntry(entry); } else { throw new AssertionError(); } }
protected Entry<K, V> getEntryAtTableOffset(int offset) { IntBuffer entry = ((IntBuffer) hashtable.duplicate().position(offset).limit(offset + ENTRY_SIZE)).slice(); if (isPresent(entry)) { return new DirectEntry(entry); } else { throw new AssertionError(); } }
public IntBuffer sliceChunkLabelLengths( RenderChunk chunk ) { IntBuffer labelLengthsBuf; synchronized ( labelLengthsBufMaster ) { labelLengthsBuf = labelLengthsBufMaster.duplicate( ); } poslim( labelLengthsBuf, chunk.labelLengthFirst, chunk.labelLengthCount, 1 ); return labelLengthsBuf.slice( ); }
public IntBuffer sliceChunkGroups( RenderChunk chunk ) { IntBuffer groupsBuf; synchronized ( groupsBufMaster ) { groupsBuf = groupsBufMaster.duplicate( ); } poslim( groupsBuf, chunk.groupFirst, chunk.groupCount, intsPerRenderGroup ); return groupsBuf.slice( ); }
@SuppressWarnings("unchecked") protected V getAtTableOffset(int offset) { IntBuffer entry = ((IntBuffer) hashtable.duplicate().position(offset).limit(offset + ENTRY_SIZE)).slice(); if (isPresent(entry)) { return (V) storageEngine.readValue(readLong(entry, ENCODING)); } else { throw new AssertionError(); } }
protected void removeAtTableOffset(int offset, boolean shrink) { IntBuffer entry = ((IntBuffer) hashtable.duplicate().position(offset).limit(offset + ENTRY_SIZE)).slice(); if (isPresent(entry)) { storageEngine.freeMapping(readLong(entry, ENCODING), entry.get(KEY_HASHCODE), true); entry.put(STATUS, STATUS_REMOVED); slotRemoved(entry); if (shrink) { shrink(); } } else { throw new AssertionError(); } }
protected void removeAtTableOffset(int offset, boolean shrink) { IntBuffer entry = ((IntBuffer) hashtable.duplicate().position(offset).limit(offset + ENTRY_SIZE)).slice(); if (isPresent(entry)) { storageEngine.freeMapping(readLong(entry, ENCODING), entry.get(KEY_HASHCODE), true); entry.put(STATUS, STATUS_REMOVED); slotRemoved(entry); if (shrink) { shrink(); } } else { throw new AssertionError(); } }
@Override public IntBuffer getBuffer(int address, int length) { address = normalizeAddress(address); IntBuffer buffer = getMainMemoryByteBuffer(); buffer.position(address >> 2); buffer.limit(round4(round4(address) + length) >> 2); return buffer.slice(); }
@Override public void remove() { throw new UnsupportedOperationException(); }