ItemsSpec:
Filter:
Modality-toolkit/Classes (extension) | Control | Spec | Libraries/Modality

ItemsSpec
ExtensionExtension

A class to map an Array of items to a value range between 0 and 1.

Description

ItemsSpec maps an item from an array of possible items onto a value range between 0 and 1.

Simple example:

Class Methods

.new

Create a new ItemsSpec.

Arguments:

items

An Array of items to map onto.

warp

An optional warp like \lin, \cos, \sin, or float number.

default

An optional default value (float between 0 and 1)

Instance Methods

.map

Map a SimpleNumber onto the items.

Arguments:

inval

A SimpleNumber

Returns:

a String

.unmap

Unmap an items contained in items to its number value

Arguments:

inval

an item

Returns:

A SimpleNumber or nil if the item was not found.

.default

The default value of an ItemsSpec is 0

.items

The array of items.

.spec

A ControlSpec that handles the conversion of 0-1 range to number of indices for the ItemsSpec.

.asSpec

Convenience method.

Returns:

the ItemsSpec