lib/matcher/GroupManager.js
function Group(options) {

        /**
         * ## Group.name
         *
         * The name of the group
         *
         * Must be unique amongst groups
         */
        this.name = null;

        /**
         * ## Group.elements
         *
         * The elements belonging to this group
         *
         * They can be matched with other elements contained in the _pool_.
         *
         * @see Group.pool
         * @see Group.matched
         */
        this.elements = [];

        /**
         * ## Group.pool
         *
         * Sets of elements that to match with the group members sequentially
         *
         * It is an array of arrays, and elements in ealier sets are more
         * likely to be matched than subsequent ones.
         *
         * @see Group.elements
         * @see Group.matched
         */
        this.pool = [];

        /**
         * ## Group.matched
         *
         * Array of arrays of matched elements
         *
         * Each index in the parent array corresponds to a group member,
         * and each array are the matched element for such a member.
         *
         * @see Group.elements
         * @see Group.pool
         */
        this.matched = [];

        /**
         * ## Group.leftOver
         *
         * Array of elements from the pool that could not be matched
         */
        this.leftOver = [];

        /**
         * ## Group.pointer
         *
         * Index of the row we are trying to complete currently
         */
        this.pointer = 0;

        /**
         * ## Group.matches
         *
         * Summary of matching results
         *
         */
        this.matches = {
            total: 0,
            requested: 0,
            done: false
        };

        /**
         * ## Group.rowLimit
         *
         * Number of elements necessary to a row
         *
         * Each group member will be matched with _rowLimit_ elements from
         * the _pool_ elements.
         */
        this.rowLimit = 1;

        /**
         * ## Group.noSelf
         *
         * If TRUE, a group member cannot be matched with himself.
         */
        this.noSelf = true;

        /**
         * ## Group.shuffle
         *
         * If TRUE, all elements of the pool will be randomly shuffled.
         */
        this.shuffle = true;

        /**
         * ## Group.stretch
         *
         * If TRUE,  each element in the pool will be replicated
         * as many times as the _rowLimit_ variable.
         */
        this.stretch = true;

        // Init user options.
        this.init(options);
    }
function Group(options) {

        /**
         * ## Group.name
         *
         * The name of the group
         *
         * Must be unique amongst groups
         */
        this.name = null;

        /**
         * ## Group.elements
         *
         * The elements belonging to this group
         *
         * They can be matched with other elements contained in the _pool_.
         *
         * @see Group.pool
         * @see Group.matched
         */
        this.elements = [];

        /**
         * ## Group.pool
         *
         * Sets of elements that to match with the group members sequentially
         *
         * It is an array of arrays, and elements in ealier sets are more
         * likely to be matched than subsequent ones.
         *
         * @see Group.elements
         * @see Group.matched
         */
        this.pool = [];

        /**
         * ## Group.matched
         *
         * Array of arrays of matched elements
         *
         * Each index in the parent array corresponds to a group member,
         * and each array are the matched element for such a member.
         *
         * @see Group.elements
         * @see Group.pool
         */
        this.matched = [];

        /**
         * ## Group.leftOver
         *
         * Array of elements from the pool that could not be matched
         */
        this.leftOver = [];

        /**
         * ## Group.pointer
         *
         * Index of the row we are trying to complete currently
         */
        this.pointer = 0;

        /**
         * ## Group.matches
         *
         * Summary of matching results
         *
         */
        this.matches = {
            total: 0,
            requested: 0,
            done: false
        };

        /**
         * ## Group.rowLimit
         *
         * Number of elements necessary to a row
         *
         * Each group member will be matched with _rowLimit_ elements from
         * the _pool_ elements.
         */
        this.rowLimit = 1;

        /**
         * ## Group.noSelf
         *
         * If TRUE, a group member cannot be matched with himself.
         */
        this.noSelf = true;

        /**
         * ## Group.shuffle
         *
         * If TRUE, all elements of the pool will be randomly shuffled.
         */
        this.shuffle = true;

        /**
         * ## Group.stretch
         *
         * If TRUE,  each element in the pool will be replicated
         * as many times as the _rowLimit_ variable.
         */
        this.stretch = true;

        // Init user options.
        this.init(options);
    }
## Group constructor

Creates a group