Domain
MMO.math · 1 symbol · generated 5 Oct 2026
Domain
Domain.js:14A set of numbers, held as a sorted list of disjoint MMO.math.Interval
- Namespace
MMO.math
Index
| constructor(intervals) | ||
| From(domains) static | Copy another domain, or promote an interval into one. | |
| FromValue(value, isIncluded) static | The domain holding exactly one value. | |
| Infinity() static | ||
| toString() | ||
| clone() | PHP clone $domain + __clone (each interval is cloned) | |
| clear() | Empty the domain. | |
| indexOf(interval) | PHP returns int|false; this returns the JS convention -1 when not found. | |
| Columns(lines) static | Find the common columns between a list of domains. | |
| intervals() | PHP arrays are value types, so PHP returns a copy here; callers (see Columns) rely on being able to mutate the returned array without touching the Domain. | |
| limit() | The single interval spanning from the first bound to the last one, holes included. | |
| set(domains) | Replace the whole content. | |
| add(values) | ||
| remove(values) | ||
| getStart() | On an EMPTY domain these four return null here. | |
| includeStart() | ||
| getEnd() | ||
| includeEnd() | ||
| size() | ||
| contains(value) | Test whether a value lies entirely inside this domain. | |
| overlap(value) | Test whether a value shares any point with this domain. | |
| isEmpty() | ||
| isEqual(value) | Test whether a value covers exactly the same points. | |
| union(value) | Create a new Domain of the union of this one and the given values | |
| exclude(value) | Create a new Domain from this one and remove the given values | |
| intersect(value) | Create a new Domain of the intersection of this one and the given values | |
| inverse(limit) | Create a new Domain of the inverse of this one | |
| addStorage(storage) | ||
| attach(object, info) | Attach an object to EVERY interval of the domain. | |
| freeStorage() | Detach every object from every interval. | |
| computeLeft(operator, value) | Do an arithmetic operation on the start and end of all the intervals using the value at the start of the computing (value * this). | |
| computeRight(operator, value) | Do an arithmetic operation on the start and end of all the intervals using the value at the end of the computing (this * value). | |
| offsetBy(offset) | ||
| [Symbol.iterator]() generator | JS has no operator overloading for $domain[$i], so the four ArrayAccess methods become plain methods: $d[$i] -> d.at(i) $d[$i] = $v -> d.setAt(i, $v) $d[] = $v -> d.add($v) unset($d[$i]) -> d.del… | |
| deleteAt(offset) | PHP \ArrayAccess::offsetUnset | |
| at(offset) | PHP \ArrayAccess::offsetGet (PHP returns by reference; JS cannot) | |
| setAt(offset, value) | PHP \ArrayAccess::offsetSet - note it removes then re-adds (so it re-sorts) | |
| hasAt(offset) | PHP \ArrayAccess::offsetExists |
Methods38
constructor(intervals)
Domain.js:16| ...intervals | ...(number | Array | Interval) |
From(domains)
staticDomain.js:26Copy another domain, or promote an interval into one.
| domains | MMO.math.Domain | MMO.math.Interval | anything exposing intervals() |
| returns | MMO.math.Domain |
FromValue(value, isIncluded)
staticDomain.js:36The domain holding exactly one value.
| value | number | |
| isIncluded = true | boolean | false yields an EMPTY domain |
| returns | MMO.math.Domain |
Infinity()
staticDomain.js:43| returns | MMO.math.Domain | the domain holding every number |
toString()
Domain.js:50| returns | string | the intervals joined by 'u' (union) @example '[0,10]u[20,30]' |
clone()
Domain.js:55PHP clone $domain + __clone (each interval is cloned)
clear()
Domain.js:64Empty the domain.
indexOf(interval)
Domain.js:72PHP returns int|false; this returns the JS convention -1 when not found.
| interval | ||
| returns | number | index, or -1 |
Columns(lines)
staticDomain.js:84Find the common columns between a list of domains.
| ...lines | ...Domain | the lines with various columns on them |
| returns | Domain |
intervals()
Domain.js:181PHP arrays are value types, so PHP returns a copy here; callers (see Columns) rely on being able to mutate the returned array without touching the Domain.
| returns | Interval[] | a shallow copy of the content |
limit()
Domain.js:189The single interval spanning from the first bound to the last one, holes included.
| returns | MMO.math.Interval | an empty interval when the domain is empty |
set(domains)
Domain.js:206Replace the whole content.
| ...domains | ...(number | Array | MMO.math.Interval | MMO.math.Domain) | |
| returns | this |
add(values)
Domain.js:212| ...values | ...(number | Array | Interval) |
remove(values)
Domain.js:262| ...values | ...(number | Array | Interval) |
getStart()
Domain.js:307On an EMPTY domain these four return null here. Verified difference with the PHP: getStart()/getEnd() are declared ?float and also return null there, but includeStart()/includeEnd() are declared : bool, so PHP raises "Return value must be of type bool, null returned" (TypeError) instead.
includeStart()
Domain.js:314| returns | boolean | whether the domain's lower bound is part of it |
getEnd()
Domain.js:321| returns | number | the domain's upper bound, Infinity when unbounded |
includeEnd()
Domain.js:328| returns | boolean | whether the domain's upper bound is part of it |
size()
Domain.js:335| returns | number | the total length of the intervals, EXCLUDING the holes between them |
contains(value)
Domain.js:350Test whether a value lies entirely inside this domain.
| value | number | MMO.math.Interval | MMO.math.Domain | |
| returns | boolean |
overlap(value)
Domain.js:379Test whether a value shares any point with this domain.
| value | number | MMO.math.Interval | MMO.math.Domain | |
| returns | boolean |
isEmpty()
Domain.js:403| returns | boolean | true when the domain holds no value at all |
isEqual(value)
Domain.js:415Test whether a value covers exactly the same points.
| value | number | MMO.math.Interval | MMO.math.Domain | |
| returns | boolean |
union(value)
Domain.js:430Create a new Domain of the union of this one and the given values
| value |
exclude(value)
Domain.js:439Create a new Domain from this one and remove the given values
| value |
intersect(value)
Domain.js:448Create a new Domain of the intersection of this one and the given values
| value |
inverse(limit)
Domain.js:483Create a new Domain of the inverse of this one
| limit = false | boolean | if true, will preserve the domain's limit |
addStorage(storage)
Domain.js:494| storage | Map<object, any> |
attach(object, info)
Domain.js:505Attach an object to EVERY interval of the domain.
| object | Object | |
| info = null | * | anything to remember alongside it |
freeStorage()
Domain.js:514Detach every object from every interval.
computeLeft(operator, value)
Domain.js:528Do an arithmetic operation on the start and end of all the intervals using the value at the start of the computing (value * this).
| operator | (a: number, b: number) => number | null | |
| value | number | Interval | Domain |
computeRight(operator, value)
Domain.js:545Do an arithmetic operation on the start and end of all the intervals using the value at the end of the computing (this * value).
| operator | (a: number, b: number) => number | null | |
| value | number | Interval | Domain |
offsetBy(offset)
Domain.js:560| offset | number | |
| returns | MMO.math.Domain | a NEW domain slid along the axis; this one is untouched |
[Symbol.iterator]()
generatorDomain.js:677JS has no operator overloading for $domain[$i], so the four ArrayAccess methods become plain methods: $d[$i] -> d.at(i) $d[$i] = $v -> d.setAt(i, $v) $d[] = $v -> d.add($v) unset($d[$i]) -> d.deleteAt(i) isset($d[$i]) -> d.hasAt(i)
deleteAt(offset)
Domain.js:682PHP \ArrayAccess::offsetUnset
| offset |
at(offset)
Domain.js:689PHP \ArrayAccess::offsetGet (PHP returns by reference; JS cannot)
| offset |
setAt(offset, value)
Domain.js:695PHP \ArrayAccess::offsetSet - note it removes then re-adds (so it re-sorts)
| offset | ||
| value |
hasAt(offset)
Domain.js:704PHP \ArrayAccess::offsetExists
| offset |