container.list - Palamecia/mint GitHub Wiki

Module

load container.list

This module provides the Container.List class which store objects sequentially in memory.

Packages

Classes

Container.List

This class creates a list which stores a liste of values and provides an indexes based access and always stores its items sequentially in memory.

Members

Modifiers Member Description
+ const != Returns true if other is not equal to this list; otherwise returns fals...
+ const & Returns a list corresponding to the intersection self and value.
+ const * Returns a list with each elements of this list repeated value times.
+ const + Returns a list which is the result of concatenating self and value.
+ const - Returns a list with each occurence of value removed.
+ const << Appends value to the list and returns self.
+ const == Returns true if other is equal to this list; otherwise returns false. T...
+ const (#ContainerList-7) Returns the elements at the specified index in the list. If index is nega...
+ const []= Replace the elements at the specified index in the list with the elements o...
+ const append Inserts value at the end of the list.
+ const clear Removes all the elements of the list.
+ const contains Returns true if the list contains value; otherwise returns false.
+ const count Returns the number of occurrences of value in the list.
+ const data Returns an array containing each elements of the list.
+ const each Apply the func function to each elements of the list.
+ const first Returns the first element of the list. If the list is empty, an instance of E...
+ const in Returns an iterator on the elements of the list.
+ const indexOf Returns the index position of the first occurrence of value in the list, se...
+ const insert Inserts value in the list at the specified index. If index is negative,...
+ const isEmpty Returns true if the list is empty; otherwise returns false.
+ const last Returns the last element of the list. If the list is empty, an instance of Ex...
+ const lastIndexOf Returns the index position of the last occurrence of value in the list, sea...
+ const move Moves the element at index position from to index position to.
+ const new Creates a new instance of Container.List. If values is given, the list will...
+ const prepend Inserts value at the beginning of the list.
+ const remove Removes the element at the given index in the list.
+ const removeAll Removes all the occurences of value in the list.
+ const removeOne Removes the first occurence of value in the list.
+ const replace Replace the elements at the specified index in the list with the elements o...
+ const size Returns the number of elements in the list.
+ const toArray Converts the list to an array.
+ const toHash Converts the list to an hash.
- final values Internal values representation.

Descriptions

Container.List.!=

def (const self, const other)

Returns true if other is not equal to this list; otherwise returns false.

Two lists are considered equal if they contain the same values in the same order.

This function requires the values to have an implementation of the != operator.

Container.List.&

def (self, value)

Returns a list corresponding to the intersection self and value.

Container.List.*

def (self, value)

Returns a list with each elements of this list repeated value times.

Container.List.+

def (self, value)

Returns a list which is the result of concatenating self and value.

Container.List.-

def (self, value)

Returns a list with each occurence of value removed.

Container.List.<<

def (self, value)

Appends value to the list and returns self.

Container.List.==

def (const self, const other)

Returns true if other is equal to this list; otherwise returns false.

Two lists are considered equal if they contain the same values in the same order.

This function requires the values to have an implementation of the != operator.

Container.List.[]

def (const self, index)

Returns the elements at the specified index in the list. If index is negative, the position is relative to the end of the list.

The index parameter can either be a number or an iterator. This operator can then be used with a range to extract a sub-set of elements between two positions.

Container.List.[]=

def (self, index, value)

Replace the elements at the specified index in the list with the elements of value. If index is negative, the position is relative to the end of the list.

The index parameter can either be a number or an iterator. This operator can then be used with a range to replace a sub-set of elements between two positions.

Container.List.append

def (self, value)

Inserts value at the end of the list.

Container.List.clear

def (self)

Removes all the elements of the list.

Container.List.contains

def (const self, value)

Returns true if the list contains value; otherwise returns false.

Container.List.count

def (const self, value)

Returns the number of occurrences of value in the list.

Container.List.data

def (const self)

Returns an array containing each elements of the list.

Container.List.each

def (const self, func)

Apply the func function to each elements of the list.

Container.List.first

def (const self)

Returns the first element of the list. If the list is empty, an instance of Exception.NoItem is raised.

Container.List.in

def (const self)

Returns an iterator on the elements of the list.

def (const self, const value)

Returns true if the list contains value; otherwise returns false.

Container.List.indexOf

def (const self, value, from = 0)

Returns the index position of the first occurrence of value in the list, searching forward from index position from. Returns none if no element matched.

Container.List.insert

def (self, index, value)

Inserts value in the list at the specified index. If index is negative, the position is relative to the end of the list. If index is not a valid index of the list (ie. index is not contained in the range 0...size), an instance of Exception.OutOfRange is raised.

Container.List.isEmpty

def (const self)

Returns true if the list is empty; otherwise returns false.

Container.List.last

def (const self)

Returns the last element of the list. If the list is empty, an instance of Exception.NoItem is raised.

Container.List.lastIndexOf

def (const self, value, from = none)

Returns the index position of the last occurrence of value in the list, searching backward from index position from. Returns none if no element matched.

Container.List.move

def (self, from, to)

Moves the element at index position from to index position to.

Container.List.new

def (self, values = [])

Creates a new instance of Container.List. If values is given, the list will be initialized with the given values.

Container.List.prepend

def (self, value)

Inserts value at the beginning of the list.

Container.List.remove

def (self, index)

Removes the element at the given index in the list.

Container.List.removeAll

def (self, value)

Removes all the occurences of value in the list.

Container.List.removeOne

def (self, value)

Removes the first occurence of value in the list.

Container.List.replace

def (self, index, value)

Replace the elements at the specified index in the list with the elements of value. If index is negative, the position is relative to the end of the list. If index is not a valid index of the list (ie. index is not contained in the range 0...size), an instance of Exception.OutOfRange is raised.

Container.List.size

def (const self)

Returns the number of elements in the list.

Container.List.toArray

def (const self)

Converts the list to an array.

Container.List.toHash

def (const self)

Converts the list to an hash.

Container.List.values

[]

Internal values representation.