Documentation

ETHistory class documentation

ETHistory : NSObject <ETCollection>

A generic history class which can contain arbitary entries located in the past or the future.

AuthorsGenerated by qmathe
Declared inETHistory.h

Overview

ETHistory keeps a history of objects of some kind. After going back in time, it can go forward again towards the most recent object. Adding an object while at a historic point will discard the forward history.

It is also possible to give ETHistory an NSEnumerator to use as a lazy source for the forward history. This way, a collection of objects can be added as a "future", replacing the current forward history.

ETHistory supports ETCollection protocol, but not ETCollectionMutation which means -[NSObject isMutableCollection] returns NO and an history won't be considered as a mutable represented object by EtoileUI.


Default

+ (id) history

Return a new autoreleased history.

    - (id) init

    Initialize the history.

      - (void) addObject: (id)object

      Set new current object, discarding the forward history.

        - (id) currentObject

        Return the current object.

          - (void) back

          Go one step back if possible.

            - (id) previousObject

            Go back, and return the new current object or nil if already at the start.

              - (BOOL) hasPrevious

              Return YES if it is possible to go back.

                - (void) forward

                After going back, call this to go one step forward again.

                  - (id) nextObject

                  Go forward, and return the new current object or nil if already at the end.

                    - (BOOL) hasNext

                    Return YES if it is possible to go forward.

                      - (id) peek: (int)relativeIndex

                      Return an object at a position relative to the current object. Return nil if the index refers to a point before the beginning or after the end of time.

                        - (void) clear

                        Forget the history and discard the future.

                          - (void) setFuture: (NSEnumerator *)enumerator

                          Set an enumerator to use as the forward history, discarding everything after the current object.

                            - (void) setMaxHistorySize: (int)maxSize

                            Set the maximum number of objects to remember. When more objects than this are added, the oldest ones are forgotten.

                            The default is to remember an unlimited number of objects (max size = 0).

                            Note that max size only limits the number of objects before -currentObject . Setting a future and peeking into it may force the history to temporarily hold more objects.

                              - (int) maxHistorySize

                              Return the maximum number of objects to remember.

                                - (NSString *) displayName

                                Return 'History'.

                                See also -[NSObject displayName] .

                                  - (BOOL) isOrdered

                                  Returns YES.