LinkedList.st
changeset 17123 784f5f9ce77f
parent 15428 8a9d687ee50a
child 17209 7447f1b1e6c5
equal deleted inserted replaced
17122:bf8149233069 17123:784f5f9ce77f
    41     See (the abstract) Link, ValueLink and (possibly other) classes,
    41     See (the abstract) Link, ValueLink and (possibly other) classes,
    42     which can be used as elements of a linkedList.
    42     which can be used as elements of a linkedList.
    43 
    43 
    44     LinkedList does not care for storage; all it does is handling
    44     LinkedList does not care for storage; all it does is handling
    45     chained link elements, which must respond to #nextLink/#nextLink:.
    45     chained link elements, which must respond to #nextLink/#nextLink:.
    46     (i.e. any object which can do this, can be used as elements of a linked
    46     (i.e. any object which can do this, can be used as elements of a linked list).
    47      list).
       
    48     An abstract superclass for linkElements is Link; a concrete class is
    47     An abstract superclass for linkElements is Link; a concrete class is
    49     ValueLink, which holds a reference to some object.
    48     ValueLink, which holds a reference to some object.
    50 
    49 
    51     [warning:]
    50     [warning:]
    52         Be careful when subclassing Link, since there is a big drawback,
    51         Be careful when subclassing Link, since there is a big drawback,
    53         which may be overlooked by beginners:
    52         which may be overlooked by beginners:
    54             a Link element can only be in one LinkedList
    53             a Link element can ONLY be in one LinkedList at a time
    55             - adding the same element to another LinkedList
    54             - adding the same element to another LinkedList
    56             will remove it from the first as a side effect.
    55               will remove it from the first as a side effect.
    57         Therefore, NEVER simply add something to a linkedList (except for
    56         Therefore, NEVER simply add something to a linkedList (except for
    58         valueLinks) unless you know what you do.
    57         valueLinks) unless you know what you do.
    59         The ST-80 implementors probably wanted this behavior, to move
    58         The ST-80 implementors probably wanted this behavior, to move
    60         processes from the waitingList to runLists and vice versa;
    59         processes from the waitingList to runLists and vice versa;
    61         however, literature seems to not point this out enough.
    60         however, literature seems to not point this out enough.
    71     OrderedCollection or similar.
    70     OrderedCollection or similar.
    72 
    71 
    73     For the above reasons, the system does not make heavily use of LinkedLists;
    72     For the above reasons, the system does not make heavily use of LinkedLists;
    74     the only good application is where elements must be repeatedly be removed
    73     the only good application is where elements must be repeatedly be removed
    75     at the front and added at the end.
    74     at the front and added at the end.
    76     (the schedulers process handling code does this to manage process lists.)
    75     (the scheduler's process handling code does this to manage process lists.)
    77 
    76 
    78     [memory requirements:]
    77     [memory requirements:]
    79         (OBJ-HEADER + (3 * ptr-size)) * size
    78         (OBJ-HEADER + (3 * ptr-size)) * size
    80                     + any additional instvars due to subclassing
    79                     + any additional instvars due to subclassing
    81 
    80 
   434 ! !
   433 ! !
   435 
   434 
   436 !LinkedList class methodsFor:'documentation'!
   435 !LinkedList class methodsFor:'documentation'!
   437 
   436 
   438 version
   437 version
   439     ^ '$Header: /cvs/stx/stx/libbasic/LinkedList.st,v 1.42 2013-06-25 11:23:45 cg Exp $'
   438     ^ '$Header: /cvs/stx/stx/libbasic/LinkedList.st,v 1.43 2014-11-26 08:47:42 cg Exp $'
   440 !
   439 !
   441 
   440 
   442 version_CVS
   441 version_CVS
   443     ^ '$Header: /cvs/stx/stx/libbasic/LinkedList.st,v 1.42 2013-06-25 11:23:45 cg Exp $'
   442     ^ '$Header: /cvs/stx/stx/libbasic/LinkedList.st,v 1.43 2014-11-26 08:47:42 cg Exp $'
   444 ! !
   443 ! !
   445 
   444