import ( qaqao:collections:Collection, qaqao:cursors:Forward-Cursor ), // Cells are included in the standard environment implementation ( One-way-linked-component-Type [Meta-Type ( supertypes « (Collection-Type), instance « ( supertypes « (One-way-linked-component (Item-type « Item-type, Structure-type « instance)), attributes « (Item-type Type, Structure-type One-way-linked-component-Type) )], [One-way-linked-component ( Item-type Type, Structure-type One-way-linked-component-Type )] [One-way-linked-component-Type ( supertypes « (Bounded-Collection (Item-type « Item-type)), instance « ( representation « ( item [Cell (Item-type « Item-type)], next [Cell (Item-type « Structure-type)], state [Cell (Item-type « Component-state)] ), receives « ( empty? (replies [state = Component-state.EMPTY]), size? (replies « [if [state = Component-state.EMPTY] then 0 else [1 + [next ← size]]]), get-Cursor (replies « [[Component-Cursor (Item-type « Item-type, Structure-type « Structure-type)] ← make-cursor]) ) ), receives « ( make-empty-component ( does « { component « memory ← [allocate (item « [[Cell (Item-type « Item-type)] ← make-cell], next « [[Cell (Item-type « Structure-type)] ← make-cell], state « [[Cell (Item-type « Component-state)] ← make-cell] )]; component:state ← [set-item (item « Component-state:EMPTY)] }, replies « component ) [make-filled-component (item Item-type, structure Structure-type)] ( does « { component « [memory ← [allocate (item « [[Cell (Item-type « Item-type)] ← make-cell], next « [[Cell (Item-type « Structure-type)] ← make-cell], state « [[Cell (Item-type « Component-state)] ← make-cell] )]]; ( component:item ← [set-item (item « item)], component:next ← [set-item (item « structure)], component:state ← [set-item (item « Component-state:NOT_EMPTY)] ) }, replies « component ) ) )], Component-state [Enumerated-Type ( supertypes « (Equality-Type), members « (EMPTY, NOT_EMPTY) // *** Do we need to implement/override = ? // *** Or do such enumeration types handle this automatically? // *** If so, how? )], [Component-Cursor ( Item-type Type, Structure-type One-way-linked-component-Type )] [Type ( supertypes « (Forward-Cursor (Item-type « Item-type)), instance « ( representation « ( component [Cell (Item-type « [One-way-linked-component ( Item-type « Item-type, Structure-type « Structure-type )])] ), receives « ( at-item? (replies « [¬ [component ← is-empty?]]), get-item (replies « [[component ← get-item]:item]), move-to-next ( does « { component ← [set-item (item « [[component ← get-item]:next])] } ) ) ), receives « ( [make-cursor (component [One-way-linked-component ( Item-type « Item-type, Structure-type « Structure-type )])] ( replies « [memory ← [allocate ( component « [Cell (Item-type « [One-way-linked-component ( Item-type « Item-type, Structure-type « Structure-type )])] ← make-cell]] ) ) ) )] ) /* This type and meta-type are abstract classes; that is, they have no public interface. They are therefore only usable in implementations of other classes. */