FuzzySet:
Filter:
Classes (extension) | Collections > Unordered | Libraries > MathLib > Markov & Fuzzy

FuzzySet : FuzzyDictionary : IdentityDictionary : Dictionary : Set : Collection : Object
ExtensionExtension

random lookup dictionary with singular elements

Description

A dictionary that keeps objects with the same key in a list and returns randomly one of them.

Part of MathLib, a diverse library of mathematical functions.

Class Methods

Inherited class methods

Undocumented class methods

FuzzySet.new(size: 8)

Instance Methods

.put(key, item)

Put an object into the dictionary. If there is already an object at that key, the new object is added to the list of choices. If the object exists already somewhere in the set at a certain key, it is removed there.

.at(key)

From superclass: FuzzyDictionary

Retrieve an object at a key. If there are several, one of them is chosen at random.

.removeAt(key, item)

Remove an object from a certain key. If there are several of the same kind, only one is removed.

.remove(item)

Remove an object from the set.

.replace(item, by)

Replace an object by another one at the same key.

.choose

From superclass: FuzzyDictionary

Choose a key from all possible keys, and then choose an object from it.

.doAt(key, function)

From superclass: FuzzyDictionary

Iterate over all elements at a certain key.

.keyAt(key)

From superclass: FuzzyDictionary

Return the list of objects at a certain key.

Inherited instance methods

Undocumented instance methods

.reverseLookup

Examples