lost+found/src/interfaces/enumerator_.js
function _gpfEnumeratorEach (enumerator, callback, eventsHandler) {
    var iEnumerator = _gpfI.query(enumerator, _gpfI.IEnumerator),
        process;
    function end (event) {
        _gpfEventsFire.call(enumerator, event, {}, eventsHandler);
    }
    if (1 < callback.length) {
        process = function (event) {
            if (gpf.events.EVENT_CONTINUE === event.type) {
                if (!iEnumerator.moveNext(process)) {
                    return;
                }
            } else if (gpf.events.EVENT_STOP === event.type) {
                return end(gpf.events.EVENT_STOPPED);
            } else if (gpf.events.EVENT_DATA !== event.type) {
                return end(event.type);
            }
            callback(iEnumerator.current(), process);
        };
        if (iEnumerator.moveNext(process)) {
            callback(iEnumerator.current(), process);
        }

    } else {
        process = function (event) {
            if (gpf.events.EVENT_DATA !== event.type) {
                return end(event);
            }
            do {
                callback(iEnumerator.current());
            } while (iEnumerator.moveNext(process));
        };
        while (iEnumerator.moveNext(process)) {
            callback(iEnumerator.current());
        }
    }
}
function _gpfEnumeratorEach (enumerator, callback, eventsHandler) {
    var iEnumerator = _gpfI.query(enumerator, _gpfI.IEnumerator),
        process;
    function end (event) {
        _gpfEventsFire.call(enumerator, event, {}, eventsHandler);
    }
    if (1 < callback.length) {
        process = function (event) {
            if (gpf.events.EVENT_CONTINUE === event.type) {
                if (!iEnumerator.moveNext(process)) {
                    return;
                }
            } else if (gpf.events.EVENT_STOP === event.type) {
                return end(gpf.events.EVENT_STOPPED);
            } else if (gpf.events.EVENT_DATA !== event.type) {
                return end(event.type);
            }
            callback(iEnumerator.current(), process);
        };
        if (iEnumerator.moveNext(process)) {
            callback(iEnumerator.current(), process);
        }

    } else {
        process = function (event) {
            if (gpf.events.EVENT_DATA !== event.type) {
                return end(event);
            }
            do {
                callback(iEnumerator.current());
            } while (iEnumerator.moveNext(process));
        };
        while (iEnumerator.moveNext(process)) {
            callback(iEnumerator.current());
        }
    }
}
function _gpfEnumeratorEach ( enumerator , callback , eventsHandler ) { var iEnumerator = _gpfI . query ( enumerator , _gpfI . IEnumerator ) , process ; function end ( event ) { _gpfEventsFire . call ( enumerator , event , { } , eventsHandler ) ; } if ( 1 < callback . length ) { process = function ( event ) { if ( gpf . events . EVENT_CONTINUE === event . type ) { if ( ! iEnumerator . moveNext ( process ) ) { return ; } } else if ( gpf . events . EVENT_STOP === event . type ) { return end ( gpf . events . EVENT_STOPPED ) ; } else if ( gpf . events . EVENT_DATA !== event . type ) { return end ( event . type ) ; } callback ( iEnumerator . current ( ) , process ) ; } ; if ( iEnumerator . moveNext ( process ) ) { callback ( iEnumerator . current ( ) , process ) ; } } else { process = function ( event ) { if ( gpf . events . EVENT_DATA !== event . type ) { return end ( event ) ; } do { callback ( iEnumerator . current ( ) ) ; } while ( iEnumerator . moveNext ( process ) ) ; } ; while ( iEnumerator . moveNext ( process ) ) { callback ( iEnumerator . current ( ) ) ; } } }
Enumerates all elements of the enumerator and call the callback function.

NOTE: reset is *not* called.
NOTE: if an error occurs during the enumeration, the process stops

@param {gpf.interfaces.IEnumerator} enumerator
@param {Function} callback receive each item of the enumerator, signature is either:
- {*} element
or
- {*} element
- {gpf.events.Handler} eventsHandler

If the signature supports two parameter, the last one will be used to control the iteration.
The callback function has to trigger
- gpf.events.EVENT_CONTINUE
- gpf.events.EVENT_STOP

@param {gpf.events.Handler} eventsHandler

@event gpf.events.EVENT_END_OF_DATA
No more data is available, the each function terminated

@event gpf.events.EVENT_STOPPED
The processing function requested to stop enumeration
 TODO how to put attributes on static members? TODO secure callback to throw an ERROR event if any exception occur "[each]": [gpf.$ClassEventHandler()],
Enumerates all elements of the enumerator and call the callback function .