Skip to content

meos.js


meos.js / Span

Abstract Class: Span

Defined in: core/types/collections/base/Span.ts:42

Abstract base class for all MEOS span types (contiguous ranges).

A span represents a contiguous set of values between a lower and an upper bound, each of which can be inclusive ([, ]) or exclusive ((, )).

Concrete subclasses: IntSpan, FloatSpan, DateSpan, TsTzSpan.

Remarks

Every span object wraps a WASM heap pointer and must be released with free (or a using declaration) when no longer needed to avoid memory leaks.

Extended by

Constructors

Constructor

ts
new Span(inner): Span;

Defined in: core/types/collections/base/Span.ts:45

Parameters

inner

number

Returns

Span

Accessors

inner

Get Signature

ts
get inner(): number;

Defined in: core/types/collections/base/Span.ts:57

Raw WASM heap pointer. Do not free this value directly; use free.

Returns

number

Methods

[dispose]()

ts
dispose: void;

Defined in: core/types/collections/base/Span.ts:67

Implements the using resource-management protocol — calls free automatically.

Returns

void


asHexWKB()

ts
asHexWKB(variant?): string;

Defined in: core/types/collections/base/Span.ts:90

Serialises this span to a hex-encoded WKB string.

Parameters

variant?

number = 4

WKB encoding variant (default 4 = Extended WKB).

Returns

string


contains()

ts
contains(other): boolean;

Defined in: core/types/collections/base/Span.ts:149

true if this entirely contains other.

Parameters

other

this

Returns

boolean


copy()

ts
copy(): this;

Defined in: core/types/collections/base/Span.ts:75

Returns a deep copy of this span. The caller is responsible for calling free on the returned copy.

Returns

this


distance()

ts
abstract distance(other): number;

Defined in: core/types/collections/base/Span.ts:197

Returns the distance between this and other. Returns 0 if they overlap. The unit depends on the concrete type (integers for IntSpan, days for DateSpan, microseconds for TsTzSpan).

Parameters

other

this

Returns

number


eq()

ts
eq(other): boolean;

Defined in: core/types/collections/base/Span.ts:233

true if this and other have identical bounds and inclusivity.

Parameters

other

this

Returns

boolean


free()

ts
free(): void;

Defined in: core/types/collections/base/Span.ts:62

Releases the WASM-allocated memory. Must be called when the object is no longer needed.

Returns

void


ge()

ts
ge(other): boolean;

Defined in: core/types/collections/base/Span.ts:258

true if this is greater than or equal to other in MEOS total ordering.

Parameters

other

this

Returns

boolean


gt()

ts
gt(other): boolean;

Defined in: core/types/collections/base/Span.ts:253

true if this is strictly greater than other in MEOS total ordering.

Parameters

other

this

Returns

boolean


hash()

ts
hash(): number;

Defined in: core/types/collections/base/Span.ts:121

32-bit integer hash of this span.

Returns

number


intersection()

ts
intersection(other): Span | null;

Defined in: core/types/collections/base/Span.ts:207

Returns the intersection of this and other, or null if they are disjoint. The caller is responsible for calling free on the result.

Parameters

other

this

Returns

Span | null


isAdjacent()

ts
abstract isAdjacent(other): boolean;

Defined in: core/types/collections/base/Span.ts:141

true if this and other share exactly one boundary point without overlapping. For example, [1, 5) is adjacent to [5, 10].

Parameters

other

this

Returns

boolean


isAfter()

ts
isAfter(other): boolean;

Defined in: core/types/collections/base/Span.ts:176

true if every point in this is strictly greater than every point in other (no overlap).

Parameters

other

this

Returns

boolean


isBefore()

ts
isBefore(other): boolean;

Defined in: core/types/collections/base/Span.ts:163

true if every point in this is strictly less than every point in other (no overlap).

Parameters

other

this

Returns

boolean


isContainedIn()

ts
isContainedIn(other): boolean;

Defined in: core/types/collections/base/Span.ts:144

true if this is entirely contained within other.

Parameters

other

this

Returns

boolean


isOverOrAfter()

ts
isOverOrAfter(other): boolean;

Defined in: core/types/collections/base/Span.ts:184

true if this does not extend to the left of other (i.e. min(this) ≥ min(other)).

Parameters

other

this

Returns

boolean


isOverOrBefore()

ts
isOverOrBefore(other): boolean;

Defined in: core/types/collections/base/Span.ts:171

true if this does not extend to the right of other (i.e. max(this) ≤ max(other)).

Parameters

other

this

Returns

boolean


le()

ts
le(other): boolean;

Defined in: core/types/collections/base/Span.ts:248

true if this is less than or equal to other in MEOS total ordering.

Parameters

other

this

Returns

boolean


lower()

ts
abstract lower(): number;

Defined in: core/types/collections/base/Span.ts:102

Returns the lower bound value. The concrete type determines the unit (integer, float, DateADT, TimestampTz).

Returns

number


lowerInc()

ts
lowerInc(): boolean;

Defined in: core/types/collections/base/Span.ts:111

true if the lower bound is inclusive ([).

Returns

boolean


lt()

ts
lt(other): boolean;

Defined in: core/types/collections/base/Span.ts:243

true if this is strictly less than other in MEOS total ordering.

Parameters

other

this

Returns

boolean


minus()

ts
minus(other): number;

Defined in: core/types/collections/base/Span.ts:216

Returns the part of this that is not in other as a raw WASM pointer. The result may represent a SpanSet when the subtraction splits this span into two parts.

Parameters

other

this

Returns

number


ne()

ts
ne(other): boolean;

Defined in: core/types/collections/base/Span.ts:238

true if this and other differ in at least one bound or inclusivity.

Parameters

other

this

Returns

boolean


overlaps()

ts
overlaps(other): boolean;

Defined in: core/types/collections/base/Span.ts:154

true if this and other share at least one point.

Parameters

other

this

Returns

boolean


toSpanSet()

ts
toSpanSet(): number;

Defined in: core/types/collections/base/Span.ts:129

Wraps this span in a one-element SpanSet and returns the raw WASM pointer. Use the appropriate SpanSet constructor (e.g. new IntSpanSet(ptr)) to obtain a typed object.

Returns

number


toString()

ts
abstract toString(): string;

Defined in: core/types/collections/base/Span.ts:84

Returns the WKT string representation of this span (e.g. [1, 10)).

Returns

string


union()

ts
union(other): number;

Defined in: core/types/collections/base/Span.ts:224

Returns the union of this and other as a raw WASM pointer. The spans do not need to be adjacent or overlapping.

Parameters

other

this

Returns

number


upper()

ts
abstract upper(): number;

Defined in: core/types/collections/base/Span.ts:108

Returns the upper bound value. The concrete type determines the unit (integer, float, DateADT, TimestampTz).

Returns

number


upperInc()

ts
upperInc(): boolean;

Defined in: core/types/collections/base/Span.ts:116

true if the upper bound is inclusive (]).

Returns

boolean