# Interface MemorySegmentStatus

All Known Implementing Classes:
  `BloomFilter, CompactQuantilesDoublesSketch, CompactThetaSketch, DirectBitArrayR, HllSketch, HllUnion, KllDoublesSketch, KllFloatsSketch, KllItemsSketch, KllLongsSketch, KllSketch, QuantilesDoublesSketch, QuantilesDoublesUnion, ThetaAnotB, ThetaIntersection, ThetaSetOperation, ThetaSketch, ThetaUnion, UpdatableQuantilesDoublesSketch, UpdatableThetaSketch`

public interface MemorySegmentStatus
Methods for inquiring the status of a backing MemorySegment.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`hasMemorySegment()`
Returns true if this object's internal data is backed by a MemorySegment, which may be on-heap or off-heap.
`boolean`
`isOffHeap()`
Returns true if this object's internal data is backed by an off-heap (direct or native)) MemorySegment.
`boolean`
`isSameResource(MemorySegment that)`
Returns true if an internally referenced MemorySegment has the same backing resource as that, or equivalently, if their two memory regions overlap.
`static boolean`
`isSameResource(MemorySegment seg1, MemorySegment seg2)`
Returns true if the two given MemorySegments have to the same backing resource, or equivalently, if the two memory regions overlap.

## Method Details

### hasMemorySegment

boolean hasMemorySegment()
Returns true if this object's internal data is backed by a MemorySegment, which may be on-heap or off-heap.

Returns:
  true if this object's internal data is backed by a MemorySegment.

### isOffHeap

boolean isOffHeap()
Returns true if this object's internal data is backed by an off-heap (direct or native)) MemorySegment.

Returns:
  true if this object's internal data is backed by an off-heap (direct or native)) MemorySegment.

### isSameResource

boolean isSameResource(MemorySegment that)
Returns true if an internally referenced MemorySegment has the same backing resource as that, or equivalently, if their two memory regions overlap. This applies to both on-heap and off-heap MemorySegments.

Note: If both segments are on-heap and not read-only, it can be determined if they were derived from the same backing memory (array). However, this is not always possible off-heap. Because of this asymmetry, this definition of "isSameResource" is confined to the existence of an overlap.

Parameters:
  `that` - The given MemorySegment.
Returns:
  true if an internally referenced MemorySegment has the same backing resource as that.

### isSameResource

static boolean isSameResource(MemorySegment seg1, MemorySegment seg2)
Returns true if the two given MemorySegments have to the same backing resource, or equivalently, if the two memory regions overlap. This applies to both on-heap and off-heap MemorySegments.

Note: If both segments are on-heap and not read-only, it can be determined if they were derived from the same backing memory (array). However, this is not always possible off-heap. Because of this asymmetry, this definition of "isSameResource" is confined to the existence of an overlap.

Parameters:
  `seg1` - The first given MemorySegment
  `seg2` - The second given MemorySegment
Returns:
  true if the two given MemorySegments have to the same backing resource.