Class: Combinations

shared.combinations~ Combinations

Represents all compatible combinations of the given elements. Elements must have the isCompatible() method that determines if two elements are compatible with each other.

new Combinations(elements, maximumCombinationSize)

Construct the combinations.
Parameters:
Name Type Default Description
elements Array
maximumCombinationSize Number 0

Methods


getCombinations(size)

Get combinations of given size.
Parameters:
Name Type Description
size Number

getElements()

Get the elements.
Returns:
Type
Array

getLargestCombinationSize()

Get the size of the largest compatible combination.
Returns:
Type
Number

getLargestCombinationWithElements(elements)

Get the largest combination that contains the given smaller combination.
Parameters:
Name Type Description
elements Array
Returns:
Type
Array

removeElement(element)

Remove the given element and update combinations.
Parameters:
Name Type Description
element Object

removeElements(combination)

Remove a set of elements.
Parameters:
Name Type Description
combination Array