Class used to store objects in an iterable
The constructor
| Name | Type | Description |
|---|---|---|
| classCollection | Class | The class of objects that have to be stored in the collection |
The first object of the Collection
An iterator on the Collection. See CollectionIterator
An Array with the objects in the collection
The last object of the Collection
The length of the Collection
Add an object at the end of the collection
| Name | Type | Description |
|---|---|---|
| object | TravelObject | The object to add |
Search an object in the collection with the index
| Name | Type | Description |
|---|---|---|
| index | Number | The position of the desired object in the array |
Executes a function on each object of the Collection and returns the final result
| Name | Type | Description |
|---|---|---|
| funct | Function | The function to execute |
Search an object in the Collection
| Name | Type | Description |
|---|---|---|
| objId | Number | The objId of the object to search |
Move an object near another object in the Collection
| Name | Type | Description |
|---|---|---|
| objId | Number | The objId of the object to move |
| targetObjId | Number | The objId of the object near witch the object will be moved |
| moveBefore | Boolean | When true, the object is moved before the target, when false after the target |
Gives the next object in the collection that fullfil a given condition
| Name | Type | Description |
|---|---|---|
| objId | Number | The objId of the object from witch the search start |
| condition | null or Function | A fonction used to compare the objects. If null, ( ) => true is used |
Gives the previous object in the collection that fullfil a given condition
| Name | Type | Description |
|---|---|---|
| objId | Number | The objId of the object from witch the search start |
| condition | null or Function | A fonction used to compare the objects. If null, ( ) => true is used |
Remove an object from the Collection
| Name | Type | Description |
|---|---|---|
| objId | Number | The objId of the object to remove |
Remove all objects from the Collection
| Name | Type | Description |
|---|---|---|
| exceptFirstLast | null or Boolean | When true, first and last objects are not removed |
Replace an object in the Collection with another object
| Name | Type | Description |
|---|---|---|
| oldObjId | Number | The objId of the object to replace |
| newObject | TravelObject | The new object |
Sort the collection, using a function
| Name | Type | Description |
|---|---|---|
| compareFunction | Function | The function to use to compare objects in the Collection |
Reverse an Object with the previous or next object in the Collection
| Name | Type | Description |
|---|---|---|
| objId | Number | The objId of the object to swap |
| swapUp | Boolean | When true the object is swapped with the previous one, when false with the next one |
The array where objects are stored
The class definition of objects stored in the collection
The class name of objects stored in the collection
Return the position of an object in the Collection
| Name | Type | Description |
|---|---|---|
| objId | Number | The objId of the object to locate |
Gives the previous or next object in the collection that fullfil a given condition
| Name | Type | Description |
|---|---|---|
| objId | Number | The objId of the object from witch the search start |
| condition | null or Function | A fonction used to compare the objects. If null, ( ) => true is used |
| direction | Number |