47 list). |
47 list). |
48 An abstract superclass for linkElements is Link; a concrete class is |
48 An abstract superclass for linkElements is Link; a concrete class is |
49 ValueLink, which holds a reference to some object. |
49 ValueLink, which holds a reference to some object. |
50 |
50 |
51 [warning:] |
51 [warning:] |
52 Be careful when subclassing Link, since there is a big drawback, |
52 Be careful when subclassing Link, since there is a big drawback, |
53 which may be overlooked by beginners: |
53 which may be overlooked by beginners: |
54 a Link element can only be in one LinkedList |
54 a Link element can only be in one LinkedList |
55 - adding the same element to another LinkedList |
55 - adding the same element to another LinkedList |
56 will remove it from the first as a side effect. |
56 will remove it from the first as a side effect. |
57 Therefore, NEVER simply add something to a linkedList (except for |
57 Therefore, NEVER simply add something to a linkedList (except for |
58 valueLinks) unless you know what you do. |
58 valueLinks) unless you know what you do. |
59 The ST-80 implementors probably wanted this behavior, to move |
59 The ST-80 implementors probably wanted this behavior, to move |
60 processes from the waitingList to runLists and vice versa; |
60 processes from the waitingList to runLists and vice versa; |
61 however, literature seems to not point this out enough. |
61 however, literature seems to not point this out enough. |
62 |
62 |
63 Although LinkedList is a subclass of SequenceableCollection (and therefore |
63 Although LinkedList is a subclass of SequenceableCollection (and therefore |
64 supports indexed access via at:), you should be careful in using it or |
64 supports indexed access via at:), you should be careful in using it or |
65 other methods based upon at:. |
65 other methods based upon at:. |
66 The reason is that #at: walks the linkedlist to find the indexed element |
66 The reason is that #at: walks the linkedlist to find the indexed element |
74 the only good application is where elements must be repeatedly be removed |
74 the only good application is where elements must be repeatedly be removed |
75 at the front and added at the end. |
75 at the front and added at the end. |
76 (the schedulers process handling code does this to manage process lists.) |
76 (the schedulers process handling code does this to manage process lists.) |
77 |
77 |
78 [memory requirements:] |
78 [memory requirements:] |
79 (OBJ-HEADER + (3 * ptr-size)) * size |
79 (OBJ-HEADER + (3 * ptr-size)) * size |
80 + any additional instvars due to subclassing |
80 + any additional instvars due to subclassing |
81 |
81 |
82 [author:] |
82 [author:] |
83 Claus Gittinger |
83 Claus Gittinger (July 1993) |
84 |
84 |
85 [see also:] |
85 [see also:] |
86 Link ValueLink Process |
86 Link ValueLink Process |
87 " |
87 " |
88 ! |
88 ! |
89 |
89 |
90 examples |
90 examples |
91 " |
91 " |