Skip to content

meos.js


meos.js / IntSpan

Class: IntSpan ​

Defined in: core/types/collections/number/IntSpan.ts:28

A contiguous range of integers, stored internally as a half-open interval [lower, upper).

Example ​

ts
const s = IntSpan.fromBounds(1, 10); // [1, 10)
console.log(s.lower()); // 1
console.log(s.upper()); // 10
s.free();

Extends ​

Constructors ​

Constructor ​

ts
new IntSpan(inner): IntSpan;

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

Parameters ​

inner ​

number

Returns ​

IntSpan

Inherited from ​

Span.constructor

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

Inherited from ​

Span.inner

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

Inherited from ​

Span.[dispose]


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

Inherited from ​

Span.asHexWKB


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

Inherited from ​

Span.contains


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

Inherited from ​

Span.copy


distance() ​

ts
distance(other): number;

Defined in: core/types/collections/number/IntSpan.ts:119

Returns the distance (gap) between this and other in integers. Returns 0 if they overlap or are adjacent.

Parameters ​

other ​

this

Returns ​

number

Overrides ​

Span.distance


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

Inherited from ​

Span.eq


expand() ​

ts
expand(value): IntSpan;

Defined in: core/types/collections/number/IntSpan.ts:139

Returns a new span expanded by value on each side.

Parameters ​

value ​

number

Number of integers to add to each end.

Returns ​

IntSpan


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

Inherited from ​

Span.free


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

Inherited from ​

Span.ge


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

Inherited from ​

Span.gt


hash() ​

ts
hash(): number;

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

32-bit integer hash of this span.

Returns ​

number

Inherited from ​

Span.hash


intersection() ​

ts
intersection(other): IntSpan | 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 ​

IntSpan | null

Inherited from ​

Span.intersection


isAdjacent() ​

ts
isAdjacent(other): boolean;

Defined in: core/types/collections/number/IntSpan.ts:104

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

Parameters ​

other ​

this

Returns ​

boolean

Overrides ​

Span.isAdjacent


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

Inherited from ​

Span.isAfter


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

Inherited from ​

Span.isBefore


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

Inherited from ​

Span.isContainedIn


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

Inherited from ​

Span.isOverOrAfter


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

Inherited from ​

Span.isOverOrBefore


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

Inherited from ​

Span.le


lower() ​

ts
lower(): number;

Defined in: core/types/collections/number/IntSpan.ts:82

Returns the inclusive lower bound as an integer.

Returns ​

number

Overrides ​

Span.lower


lowerInc() ​

ts
lowerInc(): boolean;

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

true if the lower bound is inclusive ([).

Returns ​

boolean

Inherited from ​

Span.lowerInc


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

Inherited from ​

Span.lt


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

Inherited from ​

Span.minus


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

Inherited from ​

Span.ne


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

Inherited from ​

Span.overlaps


shiftScale() ​

ts
shiftScale(
   shift, 
   width, 
   hasShift?, 
   hasWidth?): IntSpan;

Defined in: core/types/collections/number/IntSpan.ts:150

Returns a new span shifted and/or scaled along the integer axis.

Parameters ​

shift ​

number

Amount to add to every bound (ignored when hasShift is false).

width ​

number

New total width (ignored when hasWidth is false).

hasShift? ​

boolean = true

Set to false to skip shifting (default true).

hasWidth? ​

boolean = true

Set to false to skip scaling (default true).

Returns ​

IntSpan


toFloatSpan() ​

ts
toFloatSpan(): number;

Defined in: core/types/collections/number/IntSpan.ts:131

Converts this span to a FloatSpan and returns the raw WASM pointer. Use new FloatSpan(ptr) to obtain a typed object.

Returns ​

number


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

Inherited from ​

Span.toSpanSet


toString() ​

ts
toString(): string;

Defined in: core/types/collections/number/IntSpan.ts:77

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

Returns ​

string

Overrides ​

Span.toString


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

Inherited from ​

Span.union


upper() ​

ts
upper(): number;

Defined in: core/types/collections/number/IntSpan.ts:87

Returns the exclusive upper bound as an integer (stored half-open).

Returns ​

number

Overrides ​

Span.upper


upperInc() ​

ts
upperInc(): boolean;

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

true if the upper bound is inclusive (]).

Returns ​

boolean

Inherited from ​

Span.upperInc


width() ​

ts
width(): number;

Defined in: core/types/collections/number/IntSpan.ts:92

Returns the number of integers in this span (upper - lower).

Returns ​

number


fromBounds() ​

ts
static fromBounds(
   lower, 
   upper, 
   lowerInc?, 
   upperInc?): IntSpan;

Defined in: core/types/collections/number/IntSpan.ts:55

Creates an IntSpan from explicit integer bounds. MEOS normalises all integer spans to half-open form internally, so fromBounds(1, 10, true, true) is stored as [1, 11).

Parameters ​

lower ​

number

Lower bound value.

upper ​

number

Upper bound value.

lowerInc? ​

boolean = true

true for inclusive lower bound [ (default).

upperInc? ​

boolean = false

true for inclusive upper bound ] (default false).

Returns ​

IntSpan


fromHexWKB() ​

ts
static fromHexWKB(hexwkb): IntSpan;

Defined in: core/types/collections/number/IntSpan.ts:68

Deserialises an IntSpan from a hex-encoded WKB string produced by asHexWKB.

Parameters ​

hexwkb ​

string

Hex-encoded WKB string.

Returns ​

IntSpan


fromString() ​

ts
static fromString(str): IntSpan;

Defined in: core/types/collections/number/IntSpan.ts:41

Parses an IntSpan from its WKT string representation.

Parameters ​

str ​

string

WKT string, e.g. "[1, 10)".

Returns ​

IntSpan