11package org .tensorflow .tools .buffer ;
22
33/**
4- * A mutable container for view part of a {@link DataBuffer}.
4+ * A mutable container for viewing part of a {@link DataBuffer}.
55 *
66 * <p>Data buffer windows have a fixed size and can {@link DataBufferWindow#slide(long) "slide"}
77 * along a buffer to provide different views of the data without allocating a new buffer instance,
2929public interface DataBufferWindow <B extends DataBuffer <?>> {
3030
3131 /**
32- * Returns the current offset of this window in the underlying buffer.
32+ * Returns the current offset of this window in the original buffer.
3333 */
3434 long offset ();
3535
@@ -39,36 +39,39 @@ public interface DataBufferWindow<B extends DataBuffer<?>> {
3939 long size ();
4040
4141 /**
42- * Moves the window at the given position in the underlying buffer.
42+ * Moves the window at the given position in the original buffer.
4343 *
4444 * <p>The size of the window remains the same and its offset is set to {@code index}, so that
4545 * accessing the value of {@link #buffer()} at index {@code x} will return the value at
46- * {@code index + x} in the underlying buffer.
46+ * {@code index + x} in the original buffer.
4747 *
4848 * @param index new offset for this window
4949 * @return this instance
50- * @throws IndexOutOfBoundsException if the window cannot be slid because it goes beyond buffer limits
50+ * @throws IndexOutOfBoundsException if the window cannot be slid because it goes beyond
51+ * the original buffer limits
5152 */
5253 DataBufferWindow <B > slideTo (long index );
5354
5455 /**
55- * Moves the window of {@code step} elements in the underlying buffer.
56+ * Moves the window of {@code step} elements in the original buffer.
5657 *
5758 * <p>The size of the window remains the same and its offset is set to {@code offset() + step}.
5859 * If {@code step} is positive, then the window will slide forward. If it is negative, it will
5960 * slide backward.
6061 *
6162 * @param step value to add to the current offset of this window
6263 * @return this instance
63- * @throws IndexOutOfBoundsException if the window cannot be slid because it goes beyond buffer limits
64+ * @throws IndexOutOfBoundsException if the window cannot be slid because it goes beyond
65+ * the original buffer limits
6466 */
6567 DataBufferWindow <B > slide (long step );
6668
6769 /**
68- * Returns a buffer presenting the data currently viewed by this window.
70+ * Returns the buffer backing this window.
6971 *
70- * <p>The same instance is always returned for a given window, even after sliding it at
71- * different offsets in the underlying buffer. For example:
72+ * <p>Each window instance has it's own buffer providing a view onto the original
73+ * {@link DataBuffer}. The buffers are mutated when the window slides to different offsets.
74+ * For example:
7275 *
7376 * <pre>{@code
7477 * IntDataBuffer buffer = DataBuffers.of(0, 1, 2, 3);
0 commit comments