java.lang.Object
org.apache.jena.sparql.service.enhancer.slice.impl.RangeBufferImpl<A>
All Implemented Interfaces:
HasArrayOps<A>, ArrayReadable<A>, ArrayWritable<A>, BufferLike<A>, RangeBuffer<A>

public class RangeBufferImpl<A> extends Object implements RangeBuffer<A>
  • Constructor Summary

    Constructors
    Constructor
    Description
    RangeBufferImpl(com.google.common.collect.RangeSet<Long> ranges, long offsetInRanges, Buffer<A> buffer)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <A> RangeBufferImpl<A>
    create(com.google.common.collect.RangeSet<Long> ranges, long offsetInRanges, Buffer<A> buffer)
     
    static <A> RangeBufferImpl<A>
    create(Buffer<A> buffer)
     
    get(long index)
     
     
     
    long
    Buffers with 'unlimited' capacity should return Long.MAX_VALUE
    com.google.common.collect.RangeSet<Long>
    getCoveredRanges(com.google.common.collect.Range<Long> localRange)
    Return a set of contributions by this buffer for the given lookup range While this method does not expose which parts of the global range are covered, this method allows to check whether there are any gaps in the read
    The offset within the range set where this buffer starts; may be null if the offset cannot be represented in a single value such as in a union of two buffers which have different offsets
    com.google.common.collect.RangeSet<Long>
    A set of ranges from which reading is valid.
    void
    put(long offset, Object item)
     
    int
    readInto(A tgt, int tgtOffset, long srcOffset, int length)
    Read operation that blocks when attempting to access uncovered regions.
     
    static <A> RangeBufferImpl<A>
    wrap(Buffer<A> buffer)
     
    void
    write(long offsetInBuffer, A arrayWithItemsOfTypeT, int arrOffset, int arrLength)
    The method that needs to be implemented; all other methods default-delegate to this one.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.jena.sparql.service.enhancer.slice.impl.ArrayReadable

    readIntoRaw

    Methods inherited from interface org.apache.jena.sparql.service.enhancer.slice.impl.ArrayWritable

    write, write

    Methods inherited from interface org.apache.jena.sparql.service.enhancer.slice.impl.RangeBuffer

    transferFrom, transferTo
  • Constructor Details

    • RangeBufferImpl

      public RangeBufferImpl(com.google.common.collect.RangeSet<Long> ranges, long offsetInRanges, Buffer<A> buffer)
  • Method Details

    • getCoveredRanges

      public com.google.common.collect.RangeSet<Long> getCoveredRanges(com.google.common.collect.Range<Long> localRange)
      Description copied from interface: RangeBuffer
      Return a set of contributions by this buffer for the given lookup range While this method does not expose which parts of the global range are covered, this method allows to check whether there are any gaps in the read
      Specified by:
      getCoveredRanges in interface RangeBuffer<A>
    • getBackingBuffer

      public Buffer<A> getBackingBuffer()
      Specified by:
      getBackingBuffer in interface RangeBuffer<A>
    • create

      public static <A> RangeBufferImpl<A> create(com.google.common.collect.RangeSet<Long> ranges, long offsetInRanges, Buffer<A> buffer)
    • create

      public static <A> RangeBufferImpl<A> create(Buffer<A> buffer)
    • wrap

      public static <A> RangeBufferImpl<A> wrap(Buffer<A> buffer)
    • getRanges

      public com.google.common.collect.RangeSet<Long> getRanges()
      Description copied from interface: RangeBuffer
      A set of ranges from which reading is valid. The range set may be shared among several range buffers and may thus include ranges outside of the range formed by the buffer's offset and capacity
      Specified by:
      getRanges in interface RangeBuffer<A>
    • getCapacity

      public long getCapacity()
      Description copied from interface: BufferLike
      Buffers with 'unlimited' capacity should return Long.MAX_VALUE
      Specified by:
      getCapacity in interface BufferLike<A>
    • getOffsetInRanges

      public Long getOffsetInRanges()
      Description copied from interface: RangeBuffer
      The offset within the range set where this buffer starts; may be null if the offset cannot be represented in a single value such as in a union of two buffers which have different offsets
      Specified by:
      getOffsetInRanges in interface RangeBuffer<A>
    • getArrayOps

      public ArrayOps<A> getArrayOps()
      Specified by:
      getArrayOps in interface HasArrayOps<A>
    • readInto

      public int readInto(A tgt, int tgtOffset, long srcOffset, int length) throws IOException
      Read operation that blocks when attempting to access uncovered regions.
      Specified by:
      readInto in interface ArrayReadable<A>
      Throws:
      IOException
    • get

      public Object get(long index)
      Specified by:
      get in interface ArrayReadable<A>
    • write

      public void write(long offsetInBuffer, A arrayWithItemsOfTypeT, int arrOffset, int arrLength) throws IOException
      Description copied from interface: ArrayWritable
      The method that needs to be implemented; all other methods default-delegate to this one.
      Specified by:
      write in interface ArrayWritable<A>
      Throws:
      IOException
    • put

      public void put(long offset, Object item)
      Specified by:
      put in interface ArrayWritable<A>
    • toString

      public String toString()
      Overrides:
      toString in class Object