ARRANGEMENT (K N)
RETURN: The number of arrangement of k elements (without repeat) taken amongst n.
COMBINATION (K N)
RETURN: The number of combinations of k elements taken amongst n.
COMBINATIONS (LIST N)
RETURN: a list of all the combinations of N elements from the LIST.
COPY-VECTOR (VECTOR &KEY (START 0) (END (LENGTH VECTOR)) (ELEMENT-TYPE NIL))
NEXT-STEP (CHOICE LIMIT I)
RETURN: !atBegining() && ((cardinal()=0) || (index()=cardinal())).
PRE: cardinal()>0. POST: !atBegining(), RETURN: A vector of cardinal: choice. DO: Sets the choice array to the current enumerated element. (ie. the last element retrived with the getNextElement method). The choice array must contain at least elementSize() integers.
PRE: cardinal()>0, !done-p(), atBegining()=b, (!b => index()=a). POST: !atBegining(), (!b => index()=a+1), RETURN: A vector of cardinal: choice; done-p. DO: Computes the next element to be enumerated and sets the choice array to it. It returns TRUE when the last element is retrived, ie. all elements have been enumerated. The choice array must contain at least elementSize() integers.
POST: atBegining(). DO: resets the enumeration.
NOTE: It must be overriden by subclasses to compute the _cardinal from the _baseCardinal and the _elementSize attributes.
NOTE: It must be overriden by subclasses to initialize the enumeration. It must compute the _cardinal, and set the_index either to 0 or to _cardinal. If _index != _cardinal then the choice array must be set to the first enumerated element.
NOTE: It must be overriden by subclasses to step to the next element of the enumeration. If _index<_cardinal, then it must increment _index ; if _index¹_cardinal then the choice array must be set to the first enumerated element.
SET-BASE-CARDINAL (FUNCTOR CARDINAL)
SET-ELEMENT-SIZE (FUNCTOR SIZE)
STEP (FUNCTOR INDEX)
The RETURN: whether the reset() method has been called and getNextElement() (or getCurrentElement()) has not already been called.
The RETURN: The cardinal n of the base set.
The PRE: !atBegining().. RETURN: the number of elements enumerated by this object.
The RETURN: the size of each element returned by getCurrentElement and getNextElement in the choice arrays.
The PRE: !atBegining().. RETURN: the index of the current element enumerated by this object.
We choose k objects in order without repeating the same object, amongst n objects.
We choose k objects in order possibly repeating the same object, amongst n objects.
COMBINATION (K N)
We choose k distinct objects, without taking into account the order, amongst n objects.
Representation of an enumerable set.