DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T V

⟦d2d9cb883⟧ TextFile

    Length: 7890 (0x1ed2)
    Types: TextFile
    Names: »V«

Derivation

└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
    └─⟦5cb1d1d7f⟧ »DATA« 
        └─⟦3b1ee7bd8⟧ 
            └─⟦this⟧ 

TextFile

generic
    type List_Element is private;
package Singly_Linked_List is
    --------------------------------------------------------------------------
    -- Abstract   : This package provides an abstraction for a singly linked
    --              list.
    --------------------------------------------------------------------------

    type List_Type is limited private;

    function Empty (List : List_Type) return Boolean;
    --------------------------------------------------------------------------
    -- Abstract   : Indicates whether the list contains any elements.
    --------------------------------------------------------------------------
    -- Parameters : LIST - is the list to be queried.
    --------------------------------------------------------------------------

    function Null_Node (List : List_Type) return Boolean;
    --------------------------------------------------------------------------
    -- Abstract   : Indicates whether the "current pointer" references an
    --              element in the list.
    --------------------------------------------------------------------------
    -- Parameters : LIST - is the list to be queried.
    --------------------------------------------------------------------------

    function Head_Node (List : List_Type) return Boolean;
    --------------------------------------------------------------------------
    -- Abstract   : Indicates whether the "current pointer" references the
    --              head of the list.
    --------------------------------------------------------------------------
    -- Parameters : LIST - is the list to be queried.
    --------------------------------------------------------------------------

    function Tail_Node (List : List_Type) return Boolean;
    --------------------------------------------------------------------------
    -- Abstract   : Indicates whether the "current pointer" references the
    --              tail of the list.
    --------------------------------------------------------------------------
    -- Parameters : LIST - is the list to be queried.
    --------------------------------------------------------------------------

    function Current_Element (List : List_Type) return List_Element;
    --------------------------------------------------------------------------
    -- Abstract   : Returns the value of the element referenced by the
    --              "current pointer".
    --              Raises END_ERROR if NULL_NODE(LIST) = TRUE.
    --------------------------------------------------------------------------
    -- Parameters : LIST - is the list to be queried.
    --------------------------------------------------------------------------

    procedure First (List : in out List_Type);
    --------------------------------------------------------------------------
    -- Abstract   : Positions the "current pointer" at the head of the list
    --              (even if the list is empty).
    --------------------------------------------------------------------------
    -- Parameters : LIST - is the list to be modified.
    --------------------------------------------------------------------------

    procedure Next (List : in out List_Type);
    --------------------------------------------------------------------------
    -- Abstract   : Positions the "current pointer" at the next element in the
    --              list.  After the last element in the list NULL_NODE(LIST)
    --              becomes true.
    --              Raises END_ERROR if NULL_NODE(LIST) = TRUE.
    --------------------------------------------------------------------------
    -- Parameters : LIST - is the list to be modified.
    --------------------------------------------------------------------------

    procedure Insert_After (List : in out List_Type; Element : List_Element);
    --------------------------------------------------------------------------
    -- Abstract   : Inserts an element after the "current pointer".
    --              If NULL_NODE(LIST) = TRUE the element is appended after
    --              the tail element of the list.
    --------------------------------------------------------------------------
    -- Parameters : LIST    - is the list to be modified.
    --              ELEMENT - is the element to be inserted.
    --------------------------------------------------------------------------

    procedure Insert_Before (List : in out List_Type; Element : List_Element);
    --------------------------------------------------------------------------
    -- Abstract   : Inserts an element before the "current pointer".
    --              If NULL_NODE(LIST) = TRUE the element is prepended before
    --              the head element of the list.
    --------------------------------------------------------------------------
    -- Parameters : LIST    - is the list to be modified.
    --              ELEMENT - is the element to be inserted.
    --------------------------------------------------------------------------

    procedure Delete_Element (List : in out List_Type);
    --------------------------------------------------------------------------
    -- Abstract   : Deletes the element referenced by the "current pointer"
    --              from the list.  Upon deletion the "current pointer"
    --              references the element after the deleted element.
    --              Raises END_ERROR if NULL_NODE(LIST) = TRUE.
    --------------------------------------------------------------------------
    -- Parameters : LIST - is the list to be modified.
    --------------------------------------------------------------------------

    generic
        with procedure Transformation (Element : in out List_Element);
    procedure Modify (List : List_Type);
    --------------------------------------------------------------------------
    -- Abstract   : Permits modification of the element referenced by the
    --              "current pointer" where the modification doesn't require
    --              external values (e.g. incrementing a field of the element).
    --              Raises END_ERROR if NULL_NODE(LIST) = TRUE.
    --------------------------------------------------------------------------
    -- Parameters : LIST - is the list to be modified.
    --------------------------------------------------------------------------

    generic
        type Update_Information is private;
        with procedure Transformation (Element : in out List_Element;
                                       Information : Update_Information);
    procedure Update (List : List_Type; Information : Update_Information);
    --------------------------------------------------------------------------
    -- Abstract   : Permits modification of the element referenced by the
    --              "current pointer" where the modification requires
    --              external values (e.g. assigning a value to a field of
    --              the element).
    --              Raises END_ERROR if NULL_NODE(LIST) = TRUE.
    --------------------------------------------------------------------------
    -- Parameters : LIST        - is the list to be modified.
    --              INFORMATION - is the data necessary for the modification.
    --------------------------------------------------------------------------

    pragma Inline (Empty, Null_Node, Head_Node, Tail_Node, Current_Element);

    pragma Inline (Modify, Update);

    End_Error : exception;

private

    type Node;
    type Node_Access is access Node;
    type Node is
        record
            Element : List_Element;
            Next : Node_Access;
        end record;

    type List_Type is
        record
            Head : Node_Access;
            Tail : Node_Access;
            Previous : Node_Access;
            Current : Node_Access;
        end record;

end Singly_Linked_List;