type

SpecMap

@Js
const mixin SpecMap

SpecMap is a map of named Specs

NOTE: in most cases name keys match the Spec.name of slot specs themselves. However, in cases where the slot name is an auto-name of "_0", "_1", etc its possible that the slot name keys do not match their slot names. This occurs when inheriting auto-named slots. The spec names are assigned uniquely per type, but when merged by inheritance might be assigned new unique names. This often occurs in queries such as point queries.

methods

each

Iterate through the specs with name key.

eachWhile

Iterate through the specs until function returns non-null.

empty

Empty spec map

get

Get the spec keyed by given name.

getAll

Get all the specs by name if there are naming collisions.

getQualified

Get the spec using its qualified name.

has

Return if the given name is defined.

isEmpty

Return if slots are empty

list

List the specs; prefer each NOTE: the names may not match slots names

missing

Return if the given name is undefined.

names

Convenience to list the spec names in this map; prefer each.

toStr

Debug string

Slot Details

each

abstract Void each(|Spec,Str| f)

Iterate through the specs with name key. If there are collisions with the same name they are iterated individually. NOTE: the name parameter may not match slots names

eachWhile

abstract Obj? eachWhile(|Spec,Str->Obj?| f)

Iterate through the specs until function returns non-null. If there are collisions with the same name they are iterated individually. NOTE: the name parameter may not match slots names

empty

static SpecMap empty()

Empty spec map

get

abstract Spec? get(Str name, Bool checked := true)

Get the spec keyed by given name. If there are naming collisions for the name then raise AmbiguousSpecErr regardless of checked flag. NOTE: the name key may not match slot name

getAll

abstract Spec[] getAll(Str name)

Get all the specs by name if there are naming collisions. If no collisions return a list of one item, and if name is not mapped return empty list.

getQualified

abstract Spec? getQualified(Str qname, Bool checked := true)

Get the spec using its qualified name. If the spec is not found or has different qname then return null or raise exception based on the checked flag.

has

abstract Bool has(Str name)

Return if the given name is defined.

isEmpty

abstract Bool isEmpty()

Return if slots are empty

list

abstract Spec[] list()

List the specs; prefer each NOTE: the names may not match slots names

missing

abstract Bool missing(Str name)

Return if the given name is undefined.

names

abstract Str[] names()

Convenience to list the spec names in this map; prefer each. NOTE: the names may not match slots names

toStr

virtual override Str toStr()

Debug string