SUMMARY: MODULE | CLASS | TYPE | PROC | VAR | CONST | DETAIL: TYPE | PROC | VAR | CONST |
ADT:Storable IO Object Object
Class List | |
Entry | |
Iterator | |
LinkedList | Linked-list implementation of a list. |
Class Summary: Entry [Detail] | |
+---Object.Object | +--ADT:LinkedList.Entry | |
Inherited Methods | |
From Object.Object: |
Class Summary: Iterator [Detail] | |
+--ADT:LinkedList.Iterator | |
Method Summary | |
HasNext(): BOOLEAN | |
Insert(Object) | |
Next(): Object | |
NextIndex(): LONGINT | |
Remove() | |
Set(Object) |
Class Summary: LinkedList [Detail] | |
+---Object.Object | +---ADT:Storable.Object | +--ADT:LinkedList.LinkedList Linked-list implementation of a list. Objects may be efficiently added to or removed from the start or end of the list, making it useful for implementing queues. | |
Field Summary | |
size-: LONGINT Number of elements in the list. | |
Constructor Summary | |
Init(LinkedList) Initializes an emtpy list | |
New(): LinkedList Creates a new list | |
Method Summary | |
[AddBefore](Object, Entry) | |
Append(Object) Appends the specified element obj to the end of this list. | |
Clear() Removes all of the elements from this list. | |
Contains(Object): BOOLEAN Returns TRUE if this list contains the specified element. | |
Copy(): LinkedList Returns a shallow copy of l. | |
Destroy() | |
Equals(Object): BOOLEAN Test if an object is equal to this list. | |
[FindEntry](LONGINT): Entry | |
Get(LONGINT): Object Returns the element at the specified position index in this list. | |
GetFirst(): Object Returns the first element in this list | |
GetIterator(Iterator): Iterator Return an iterator positioned at the start of this list. | |
GetLast(): Object Returns the last element in this list | |
HashCode(): LONGINT Returns a hash code value for the object. | |
IndexOf(Object): LONGINT Searches for the first occurence of the given argument, testing for equality using the Object.Object.Equals method. | |
Insert(LONGINT, Object) Inserts the specified element obj at the specified position index in this list. | |
IsEmpty(): BOOLEAN Tests if this list has no elements. | |
LastIndexOf(Object): LONGINT Searches for the last occurence of the given argument, testing for equality using the Object.Object.Equals method. | |
Load(Reader) Loads data of l from r. | |
Prepend(Object) Appends the specified element obj to the beginning of this list. | |
Remove(LONGINT): Object Removes the element at the specified position index in this list. | |
[RemoveEntry](Entry) | |
RemoveFirst(): Object Removes the first element in this list. | |
RemoveLast(): Object Removes the last element in this list. | |
RemoveRange(LONGINT, LONGINT) Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive. | |
Set(LONGINT, Object) Replaces the element at the specified position index in this list with the specified element obj. | |
Size(): LONGINT Returns the number of elements in this list. | |
Store(Writer) Stores data of l to w. | |
Inherited Methods | |
From Object.Object: From ADT:Storable.Object: |
Class Detail: Entry |
Class Detail: Iterator |
Method Detail |
PROCEDURE (i: Iterator) HasNext(): BOOLEAN
PROCEDURE (i: Iterator) Insert(obj: Object)
PROCEDURE (i: Iterator) Next(): Object
PROCEDURE (i: Iterator) NextIndex(): LONGINT
PROCEDURE (i: Iterator) Remove()
PROCEDURE (i: Iterator) Set(obj: Object)
Class Detail: LinkedList |
Field Detail |
FIELD size-: LONGINT
Number of elements in the list.
Constructor Detail |
PROCEDURE Init(l: LinkedList)
Initializes an emtpy list
PROCEDURE New(): LinkedList
Creates a new list
Method Detail |
PROCEDURE (l: LinkedList) [AddBefore](element: Object; e: Entry)
PROCEDURE (l: LinkedList) Append(obj: Object)
Appends the specified element obj to the end of this list.
PROCEDURE (l: LinkedList) Clear()
Removes all of the elements from this list. The list will be empty after this call returns.
PROCEDURE (l: LinkedList) Contains(obj: Object): BOOLEAN
Returns TRUE if this list contains the specified element.
PROCEDURE (l: LinkedList) Copy(): LinkedList
Returns a shallow copy of l. The elements themselves are not copied.
PROCEDURE (l: LinkedList) Destroy()
PROCEDURE (l: LinkedList) Equals(obj: Object): BOOLEAN
Test if an object is equal to this list. To be equal, a list must contain the same sequence of objects. In this context, "same" means that the Equals test returns true for pairs of objects at equivalent ordinal positions in the source lists.
PROCEDURE (l: LinkedList) [FindEntry](index: LONGINT): Entry
PROCEDURE (l: LinkedList) Get(index: LONGINT): Object
Returns the element at the specified position index in this list.
PROCEDURE (l: LinkedList) GetFirst(): Object
Returns the first element in this list
PROCEDURE (l: LinkedList) GetIterator(i: Iterator): Iterator
Return an iterator positioned at the start of this list. If an iterator i is supplied (ie. not NIL), it will be initialised and returned as the result. Otherwise (i is NIL), a new iterator is allocated.
PROCEDURE (l: LinkedList) GetLast(): Object
Returns the last element in this list
PROCEDURE (l: LinkedList) HashCode(): LONGINT
Returns a hash code value for the object. This method is supported for the benefit of dictionaries such as those provided by ADT:Dictionary..
The general contract of Object.HashCode is:
Whenever it is invoked on the same object more than once during an execution of an application, the Object.HashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
If two objects are equal according to the Object.Equals method, then calling the Object.HashCode method on each of the two objects must produce the same integer result.
It is not required that if two objects are unequal according to the Object.Equals method, then calling the Object.HashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of dictionaries.
As much as is reasonably practical, the Object.HashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required.)
[Description inherited from HashCode]
PROCEDURE (l: LinkedList) IndexOf(obj: Object): LONGINT
Searches for the first occurence of the given argument, testing for equality using the Object.Object.Equals method. Returns -1 if the object is not found.
PROCEDURE (l: LinkedList) Insert(index: LONGINT; obj: Object)
Inserts the specified element obj at the specified position index in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
PROCEDURE (l: LinkedList) IsEmpty(): BOOLEAN
Tests if this list has no elements.
PROCEDURE (l: LinkedList) LastIndexOf(obj: Object): LONGINT
Searches for the last occurence of the given argument, testing for equality using the Object.Object.Equals method. Returns -1 if the object is not found.
PROCEDURE (l: LinkedList) Load(r: Reader) RAISES Error;
Loads data of l from r. Nested record pointers are loaded by calling the type-bound procecdure Reader.ReadObject. This procedure must be symmetric to Object.Store, or data internalization will break, causing undefined object state or program termination.
Note: When internalizing a file with alien objects, it is possible that the type-bound procedure Object.Load is invoked more than once for a single object. Except for the results of the last call, all duplicates are discarded. Because of this, all changes by this procedure to any program state that is not part of the object l are deprecated.
Pre-condition: This procedure is either activated by a super call, or from the procedure Reader.ReadObject.
[Description inherited from Load]
Redefines: Load
PROCEDURE (l: LinkedList) Prepend(obj: Object)
Appends the specified element obj to the beginning of this list.
PROCEDURE (l: LinkedList) Remove(index: LONGINT): Object
Removes the element at the specified position index in this list. Shifts any subsequent elements to the left (subtracts one from their indices).
PROCEDURE (l: LinkedList) [RemoveEntry](e: Entry)
PROCEDURE (l: LinkedList) RemoveFirst(): Object
Removes the first element in this list. Shifts any subsequent elements to the left (subtracts one from their indices).
PROCEDURE (l: LinkedList) RemoveLast(): Object
Removes the last element in this list.
PROCEDURE (l: LinkedList) RemoveRange(fromIndex: LONGINT; toIndex: LONGINT)
Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive. Shifts any succeeding elements to the left (reduces their index). This call shortens the list by `toIndex - fromIndex' elements. (If `toIndex = fromIndex', this operation has no effect.)
PROCEDURE (l: LinkedList) Set(index: LONGINT; obj: Object)
Replaces the element at the specified position index in this list with the specified element obj.
PROCEDURE (l: LinkedList) Size(): LONGINT
Returns the number of elements in this list.
PROCEDURE (l: LinkedList) Store(w: Writer) RAISES Error;
Stores data of l to w. Nested record pointers are stored by calling the type-bound procedure Writer.WriteObject. The procedure is not allowed to make any changes to the global state of the program, except for calling the `Write' methods of the writer w. Any redefinition of this procedure must include a super call, preferably as the first statement of the procedure body.
Pre-condition: This procedure is either activated by a super call, or from the procedure Writer.WriteObject.
[Description inherited from Store]
Redefines: Store