Packagecom.yworks.support
Classpublic class YList
InheritanceYList Inheritance flash.utils.Proxy
Implements List, Iterable

An implementation of a double linked list



Public Properties
 PropertyDefined By
  first : Object
[read-only] Returns the first element in this list.
YList
  firstCell : ListCell
[read-only] Returns the first cell in this list.
YList
  last : Object
[read-only] Returns the last element in this list.
YList
  lastCell : ListCell
[read-only] Returns the last cell in this list.
YList
  userObject : Object
Gets or set the user object associated with this list.
YList
Public Methods
 MethodDefined By
  
YList(array:Array = null)
Creates a new list.
YList
  
addAll(iter:Iterable):void
Adds all of the elements in the specified collection to this collection (optional operation).
YList
  
addFirst(o:Object):ListCell
Inserts Object o at the head of this list.
YList
  
Adds a formerly removed ListCell at the head of this list.
YList
  
addItem(item:Object):Boolean
Same as addLast()
YList
  
addLast(o:Object):ListCell
Inserts Object o at the tail of this list.
YList
  
Adds a formerly removed ListCell at the tail of this list.
YList
  
clear():void
Removes all of the elements from this collection.
YList
  
contains(item:Object):Boolean
Returns true if this collection contains the specified element.
YList
  
findCell(o:Object):ListCell
Returns the cell where Object o is stored.
YList
  
getCell(index:int):ListCell
Returns the ListCell which can be found at the given index.
YList
  
getItemAt(i:int):Object
Returns the element at the specified position in this collection.
YList
  
indexOf(item:Object):int
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
YList
  
insert(item:Object, i:uint):void
Inserts the given item at the given index into the list.
YList
  
insertAfter(o:Object, refCell:ListCell):ListCell
Inserts the given object to this list.
YList
  
insertBefore(o:Object, refCell:ListCell):ListCell
Inserts the given object to this list.
YList
  
insertCellAfter(cellToInsert:ListCell, refCell:ListCell):void
Inserts a formerly removed ListCell at the specified position.
YList
  
insertCellBefore(cellToInsert:ListCell, refCell:ListCell):void
Inserts a formerly removed ListCell at the specified position.
YList
  
isEmpty():Boolean
Returns true if this collection contains no elements.
YList
  
Creates an Iterator over this list.
YList
  
length():uint
Returns the number of elements in this collection.
YList
  
peek():Object
Equivalent to first
YList
  
pop():Object
Removes the first element from this list and returns it.
YList
  
popLast():Object
Removes the last element from this list and returns it.
YList
  
push(o:Object):ListCell
Equivalent to addFirst
YList
  
removeAt(index:uint):void
Removes the element at the specified position in this list.
YList
  
Removes the ListCell c and the element stored in it from this list.
YList
  
removeItem(item:Object):Boolean
Removes a single instance of the specified element from this collection, if it is present (optional operation).
YList
  
sort(comparisonFunction:Function = null, sortOptions:int = -1):void
Not yet implemented! This implementation does nothing
YList
  
toArray():Array
Returns an array containing all of the elements in this collection.
YList
Protected Methods
 MethodDefined By
  
getProperty(name:*):*
[override]
YList
  
nextName(index:int):String
[override]
YList
  
nextNameIndex(index:int):int
[override]
YList
  
nextValue(index:int):*
[override]
YList
  
setProperty(name:*, value:*):void
[override]
YList
Property Detail
firstproperty
first:Object  [read-only]

Returns the first element in this list.

Precondition: !isEmpty().


Implementation
    public function get first():Object
firstCellproperty 
firstCell:ListCell  [read-only]

Returns the first cell in this list.

Precondition: !isEmpty().


Implementation
    public function get firstCell():ListCell
lastproperty 
last:Object  [read-only]

Returns the last element in this list.

Precondition: !isEmpty().


Implementation
    public function get last():Object
lastCellproperty 
lastCell:ListCell  [read-only]

Returns the last cell in this list.

Precondition: !isEmpty().


Implementation
    public function get lastCell():ListCell
userObjectproperty 
userObject:Object

Gets or set the user object associated with this list.


Implementation
    public function get userObject():Object
    public function set userObject(value:Object):void
Constructor Detail
YList()Constructor
public function YList(array:Array = null)

Creates a new list. If an array is provided, the list is initialized with the elements provided by the given array.

Parameters
array:Array (default = null) — The array to initialize the list with.
Method Detail
addAll()method
public function addAll(iter:Iterable):void

Adds all of the elements in the specified collection to this collection (optional operation).

Parameters

iter:Iterable — the collection containing elements to be added to this collection

addFirst()method 
public function addFirst(o:Object):ListCell

Inserts Object o at the head of this list.

Parameters

o:Object

Returns
ListCell — The ListCell where the Object o is stored.
addFirstCell()method 
public function addFirstCell(cell:ListCell):void

Adds a formerly removed ListCell at the head of this list.

Attention: If the ListCell is still part of a list, this list will be corrupted afterwards.

Parameters

cell:ListCell — A list cell which is not part of any list.

addItem()method 
public function addItem(item:Object):Boolean

Same as addLast()

Parameters

item:Object

Returns
Boolean

See also

addLast()method 
public function addLast(o:Object):ListCell

Inserts Object o at the tail of this list.

Parameters

o:Object

Returns
ListCell — the ListCell where the Object o is stored.
addLastCell()method 
public function addLastCell(cell:ListCell):void

Adds a formerly removed ListCell at the tail of this list.

Attention: If the ListCell is still part of a list, this list will be corrupted afterwards.

Parameters

cell:ListCell — A list cell which is not part of any list.

clear()method 
public function clear():void

Removes all of the elements from this collection. The collection will be empty after this method returns.

contains()method 
public function contains(item:Object):Boolean

Returns true if this collection contains the specified element.

Parameters

item:Object — element whose presence in this collection is to be tested

Returns
Boolean — true if this collection contains the specified element
findCell()method 
public function findCell(o:Object):ListCell

Returns the cell where Object o is stored.

This operation returns null, if no such cell exists.

Parameters

o:Object

Returns
ListCell
getCell()method 
public function getCell(index:int):ListCell

Returns the ListCell which can be found at the given index.

Parameters

index:int — The index of the ListCell to return.

Returns
ListCell — The ListCell at the given index
getItemAt()method 
public function getItemAt(i:int):Object

Returns the element at the specified position in this collection.

Parameters

i:int — the index of the element to return

Returns
Object — the element at the specified position in this list
getProperty()method 
override flash_proxy function getProperty(name:*):*

Parameters

name:*

Returns
*
indexOf()method 
public function indexOf(item:Object):int

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

Parameters

item:Object — the element to search for

Returns
int — the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element
insert()method 
public function insert(item:Object, i:uint):void

Inserts the given item at the given index into the list.

Creates a new ListCell, inserts it into the list and sets the new ListCell's info value to the given item.

Parameters

item:Object — The item to insert.
 
i:uint — The index to insert the item at

insertAfter()method 
public function insertAfter(o:Object, refCell:ListCell):ListCell

Inserts the given object to this list.

The newly created ListCell will be inserted to this list immediatelly after refCell. If refCell == null the given object is inserted at the head of the list.

Parameters

o:Object — the object to be inserted
 
refCell:ListCell — the cell used to reference the position

Returns
ListCell — the newly created ListCell, which contains o
insertBefore()method 
public function insertBefore(o:Object, refCell:ListCell):ListCell

Inserts the given object to this list.

The newly created ListCell will be inserted to this list immediatelly before refCell. If refCell == null the given object is appended to the list.

Parameters

o:Object — the object to be inserted
 
refCell:ListCell — the cell used to reference the position

Returns
ListCell — the newly created ListCell, which contains o
insertCellAfter()method 
public function insertCellAfter(cellToInsert:ListCell, refCell:ListCell):void

Inserts a formerly removed ListCell at the specified position.

Attention: If the ListCell is still part of a list, this list will be corrupted afterwards.

Parameters

cellToInsert:ListCell — A list cell that is not part of any list.
 
refCell:ListCell — A list cell that is contained in this list.

insertCellBefore()method 
public function insertCellBefore(cellToInsert:ListCell, refCell:ListCell):void

Inserts a formerly removed ListCell at the specified position.

Attention: If the ListCell is still part of a list, this list will be corrupted afterwards.

Parameters

cellToInsert:ListCell — A list cell that is not part of any other list.
 
refCell:ListCell — A list cell that is contained in this list

isEmpty()method 
public function isEmpty():Boolean

Returns true if this collection contains no elements.

Returns
Boolean — true if this collection contains no elements
iterator()method 
public function iterator():Iterator

Creates an Iterator over this list.

Returns
Iterator — An Iterator over the elements of this list.
length()method 
public function length():uint

Returns the number of elements in this collection.

Returns
uint — the number of elements in this collection
nextName()method 
override flash_proxy function nextName(index:int):String

Parameters

index:int

Returns
String
nextNameIndex()method 
override flash_proxy function nextNameIndex(index:int):int

Parameters

index:int

Returns
int
nextValue()method 
override flash_proxy function nextValue(index:int):*

Parameters

index:int

Returns
*
peek()method 
public function peek():Object

Equivalent to first

Returns
Object

See also

pop()method 
public function pop():Object

Removes the first element from this list and returns it.

Returns
Object
popLast()method 
public function popLast():Object

Removes the last element from this list and returns it.

Returns
Object
push()method 
public function push(o:Object):ListCell

Equivalent to addFirst

Parameters

o:Object

Returns
ListCell — The ListCell where the Object o is stored.

See also

removeAt()method 
public function removeAt(index:uint):void

Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).

Parameters

index:uint — the index of the element to be removed

removeCell()method 
public function removeCell(c:ListCell):Object

Removes the ListCell c and the element stored in it from this list.

This operation has time complexity O(1). Precondition: c is a cell of this list.

Parameters

c:ListCell

Returns
Object — The element that was stored in the removed cell
removeItem()method 
public function removeItem(item:Object):Boolean

Removes a single instance of the specified element from this collection, if it is present (optional operation).

Parameters

item:Object — element to be removed from this collection, if present

Returns
Boolean — true if an element was removed as a result of this call
setProperty()method 
override flash_proxy function setProperty(name:*, value:*):void

Parameters

name:*
 
value:*

sort()method 
public function sort(comparisonFunction:Function = null, sortOptions:int = -1):void

Not yet implemented!

This implementation does nothing

Parameters

comparisonFunction:Function (default = null)
 
sortOptions:int (default = -1)

toArray()method 
public function toArray():Array

Returns an array containing all of the elements in this collection.

Returns
Array — an array containing all of the elements in this collection