Object <- FixedList |
|
|
Count Dense ExtraSizeActuallyUsed InitialListWordFormat Stride |
Define Class FixedList; inherits from Object, HasCount; has no dispatcher hintdata; abstract; // list structure attribute Count: Unsigned; // adds a getter to the attribute inherited from HasCount attribute Stride: Unsigned, readOnly; // default element size is 4 which is correct for an object reference or an integer // override to change the element size attribute Dense: Boolean, readOnly; // handling of invalid entries. // false by default. // reading elements operation ElementAt(index: Unsigned; returnElement: Pointer); operation EachElement(function: EachElementFunction; parameters: Pointer): Object, noFail; // perform function on each element, but stop if function returns result other than nilObject // if stopped, return the function result that caused stop, otherwise return nilObject. operation EachElementAfter(function: EachElementFunction; parameters: Pointer; afterIndex: Unsigned): Object, noFail; operation FindElementAfter(element: ReadOnlyPointer; afterIndex: Unsigned): Unsigned, noFail; operation FindElement(element: ReadOnlyPointer): Unsigned, noFail; // elements as integers operation ValueAt(index: Unsigned): Unsigned, noFail; // modifying the list operation AddElementAt(index: Unsigned; newElement: ReadOnlyPointer), safe; operation AddElement(element: ReadOnlyPointer); operation AddElementFirst(element: ReadOnlyPointer); operation AddElementLast(element: ReadOnlyPointer); operation AddUniqueElement(element: ReadOnlyPointer); operation RemoveAt(index: Unsigned); operation RemoveElement(element: ReadOnlyPointer); operation ReplaceElementAt(index: Unsigned; element: ReadOnlyPointer); operation Reverse(), noFail; // call to flip the order of the items in the list operation Clear(), noFail; // reading or modifying multiple elements at once operation AddElementsAt(index: Unsigned; numElements: Unsigned; newElements: ReadOnlyPointer); operation RemoveElementsAt(index: Unsigned; numElements: Unsigned); // read/write/swap bottlenecks operation ElementsAt(index: Unsigned; numElements: Unsigned; returnElements: Pointer); operation ReplaceElementsAt(index: Unsigned; numOldElements: Unsigned; numNewElements: Unsigned; newElement: ReadOnlyPointer); operation SwapElements(index1: Unsigned; index2: Unsigned; numElements: Unsigned); // bottlenecks so subclasses can control the format of the list attribute InitialListWordFormat: WordFormat, readOnly; // format of list element words // override to specify the type of word format for the type of list // that should be created when elements are added to an empty list // that does not have a word format set // other housekeeping overrides Finalize; // to invalidate the stride cache overrides Init; overrides Stabilize, Compact; overrides ExtraSizeActuallyUsed; end class;