Package | com.yworks.yfiles.base |
Class | public class YList |
Inheritance | YList YObject Object |
Implements | Collection, List |
Subclasses | EdgeList, NodeList |
null
as values. It implements the com.yworks.bridge.util.List interface but does not support the subList() method. The implementation of this method will throw an flash.errors.IllegalOperationError if invoked. The iterator() s returned by instances of this class are fail fast, however the cursor() implementation is not.
See also
Property | Defined By | ||
---|---|---|---|
empty : Boolean [read-only]
Checks whether this list contains elements. | YList | ||
length : int [read-only]
Returns the number of elements in this list. | YList |
Method | Defined By | ||
---|---|---|---|
YList(init:Boolean = true)
Creates an empty doubly linked list. | YList | ||
addAll(collection:Collection):Boolean
Appends all elements provided by the given collection to this list. | YList | ||
addAllAt(index:int, c:Collection):Boolean | YList | ||
addAllFromCursor(c:YCursor):void
Appends all elements provided by the given cursor to this list. | YList | ||
Inserts the given object at the head of this list. | YList | ||
addFirstCell(cell:ListCell):void
Adds a formerly removed ListCell object at the head of this list. | YList | ||
addItem(o:Object):Boolean
Same as addLast(). | YList | ||
addItemAt(index:int, element:Object):void | YList | ||
Inserts the given object at the tail of this list. | YList | ||
addLastCell(cell:ListCell):void
Adds a formerly removed ListCell object at the tail of this list. | YList | ||
clear():void
Removes all elements from this list. | YList | ||
containsAll(collection:Collection):Boolean
Whether or not this list contains all the elements in the given collection. | YList | ||
containsItem(o:Object):Boolean
Whether or not this list contains the given element. | YList | ||
Returns a cursor for this list. | YList | ||
Returns the cyclic predecessor cell of the given list cell. | YList | ||
Returns the cyclic successor cell of the given list cell. | YList | ||
elementAt(i:int):Object
Returns the i-th element of this list. | YList | ||
equals(other:Object):Boolean [override] | YList | ||
Returns the com.yworks.yfiles.base.ListCell where object o is stored. | YList | ||
first():Object
Returns the first element of this list. | YList | ||
Returns the first cell of this list. | YList | ||
Gets the cell at the given index. | YList | ||
getClass():Class [override] | YList | ||
Returns the element stored in the given list cell. | YList | ||
getItemAt(index:int):Object | YList | ||
hashCode():int [override] | YList | ||
indexOf(obj:Object):int
Returns the zero-based index of the given element in this list. | YList | ||
Inserts the given object into this list with respect to a given reference list cell. | YList | ||
Inserts the given object into this list with respect to a given reference list cell. | YList | ||
Inserts a formerly removed ListCell object into this list with respect to a given reference list cell. | YList | ||
Inserts a formerly removed ListCell object into this list with respect to a given reference list cell. | YList | ||
Returns an iterator for that list. | YList | ||
last():Object
Returns the last element of this list. | YList | ||
Returns the last cell of this list. | YList | ||
lastIndexOf(o:Object):int | YList | ||
YList | |||
listIterator2(index:int):ListIterator | YList | ||
[static]
Creates an empty doubly linked list. | YList | ||
[static]
Creates a list that is initialized with the elements provided by the given array of objects. | YList | ||
[static]
Creates a list that is initialized with the elements provided by the given Collection object. | YList | ||
[static]
Creates a list that is initialized with the elements provided by the given Iterator object. | YList | ||
[static]
Creates a list that is initialized with the elements provided by the given YCursor object. | YList | ||
[static]
Creates a list that is initialized with those elements from the given YCursor object for which the given data provider returns true upon calling its getBool (com.yworks.yfiles.base.DataProvider.getBool()) method. | 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 | ||
Returns the predecessor cell of the given list cell. | YList | ||
Equivalent to addFirst(). | YList | ||
removeAll(collection:Collection):Boolean
Removes the given collection of objects from this list. | YList | ||
Removes the element pointed to by the given YCursor object. | YList | ||
removeCell(c:ListCell):Object
Removes the given list cell, and hence the element stored in it, from this list. | YList | ||
removeItem(o:Object):Boolean
Removes the given object from this list. | YList | ||
removeItemAt(index:int):Object | YList | ||
retainAll(collection:Collection):Boolean
Retains only those elements in this list which are contained in the given collection. | YList | ||
reverse():void
Reverses the sequence of elements in this list. | YList | ||
Updates the element stored in the given list cell with the given object. | YList | ||
setItemAt(index:int, element:Object):Object | YList | ||
sort(comp:Comparator):void
Sorts the elements in this list according to the given comparator. | YList | ||
sort2():void
Sorts the elements in this list into ascending order, according to their natural ordering. | YList | ||
Transfers the contents of the given list to the end of this list. | YList | ||
YList | |||
Returns the successor cell of the given list cell. | YList | ||
toArray():Vector.<Object>
Returns an array representation of this list. | YList | ||
toArray2(a:Vector.<Object>):Vector.<Object>
Returns an array containing all list elements in the correct order. | YList | ||
toString():String
Returns a string representation of this List. | YList |
Method | Defined By | ||
---|---|---|---|
initYList1():void
Initializes this object. | YList | ||
initYList2(a:Vector.<Object>):void
Initializes this object. | YList | ||
initYList3(c:Collection):void
Initializes this object. | YList | ||
initYList4(it:Iterator):void
Initializes this object. | YList | ||
initYList5(c:YCursor):void
Initializes this object. | YList | ||
Initializes this object. | YList |
empty | property |
empty:Boolean
[read-only] Checks whether this list contains elements.
public function get empty():Boolean
length | property |
length:int
[read-only] Returns the number of elements in this list.
public function get length():int
YList | () | Constructor |
public function YList(init:Boolean = true)
Creates an empty doubly linked list.
Parametersinit:Boolean (default = true ) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods.
This parameter can safely be ignored/omitted when calling the constructor.
|
addAll | () | method |
public function addAll(collection:Collection):Boolean
Appends all elements provided by the given collection to this list.
Parameters
collection:Collection |
Boolean — Whether there have been elements appended.
|
addAllAt | () | method |
public function addAllAt(index:int, c:Collection):Boolean
Parameters
index:int | |
c:Collection |
Boolean |
addAllFromCursor | () | method |
public function addAllFromCursor(c:YCursor):void
Appends all elements provided by the given cursor to this list. The cursor will be moved from its given position to the end.
Be aware that a statement likeaList.append(aList.cursor())
results in an infinite recursion.
Parameters
c:YCursor |
addFirst | () | method |
public function addFirst(o:Object):ListCell
Inserts the given object at the head of this list.
Parameters
o:Object |
ListCell — The newly created ListCell object that stores the given object.
|
addFirstCell | () | method |
public function addFirstCell(cell:ListCell):void
Adds a formerly removed ListCell object at the head of this list.
Attention: If the ListCell object is still part of any list, then that list will be corrupted afterwards.Parameters
cell:ListCell — A list cell which is not part of any list.
|
addItem | () | method |
public function addItem(o:Object):Boolean
Same as addLast().
Parameters
o:Object |
Boolean — true
|
See also
addItemAt | () | method |
public function addItemAt(index:int, element:Object):void
Parameters
index:int | |
element:Object |
addLast | () | method |
public function addLast(o:Object):ListCell
Inserts the given object at the tail of this list.
Parameters
o:Object |
ListCell — The newly created ListCell object that stores the given object.
|
addLastCell | () | method |
public function addLastCell(cell:ListCell):void
Adds a formerly removed ListCell object at the tail of this list.
Attention: If the ListCell object is still part of any list, then that 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 elements from this list.
containsAll | () | method |
public function containsAll(collection:Collection):Boolean
Whether or not this list contains all the elements in the given collection. Equality of elements is defined by the com.yworks.bridge.util.FlexUtils.equals() method.
Parameters
collection:Collection |
Boolean |
See also
containsItem | () | method |
public function containsItem(o:Object):Boolean
Whether or not this list contains the given element. Equality of elements is defined by the com.yworks.bridge.util.FlexUtils.equals() method.
Parameters
o:Object |
Boolean |
See also
cursor | () | method |
public function cursor():YCursor
Returns a cursor for this list. All cursor operations are supported. This cursor implementation is not fail-fast and continues to work if this list is modified during the traversal as long as the current ListCell the cursor points at is this in this list or has been removed from this list but has not been added to another instance since then.
ReturnsYCursor |
cyclicPred | () | method |
public function cyclicPred(c:ListCell):ListCell
Returns the cyclic predecessor cell of the given list cell.
The last cell is returned as the cyclic predecessor of the first list cell.Parameters
c:ListCell |
ListCell |
cyclicSucc | () | method |
public function cyclicSucc(c:ListCell):ListCell
Returns the cyclic successor cell of the given list cell.
The first cell is returned as the cyclic successor of the last list cell.Parameters
c:ListCell |
ListCell |
elementAt | () | method |
public function elementAt(i:int):Object
Returns the i-th element of this list.
Precondition i
is a valid index, i.e., i >= 0 && i < size()
.
Parameters
i:int |
Object |
equals | () | method |
override public function equals(other:Object):Boolean
Parameters
other:Object |
Boolean |
findCell | () | method |
public function findCell(o:Object):ListCell
Returns the com.yworks.yfiles.base.ListCell where object o
is stored.
This operation returns null
, if no such cell exists. Equality of elements is defined by the com.yworks.bridge.util.FlexUtils.equals() method. The first element in the list that matches that criteria is returned.
Parameters
o:Object |
ListCell — the ListCell that contains the element or null if no such ListCell was found
|
See also
first | () | method |
public function first():Object
Returns the first element of this list.
Precondition !isEmpty()
.
Object |
firstCell | () | method |
public function firstCell():ListCell
Returns the first cell of this list.
Precondition !isEmpty()
.
ListCell |
getCell | () | method |
public function getCell(index:int):ListCell
Gets the cell at the given index.
Parameters
index:int — the zero-based index of the cell in this list.
|
ListCell — The cell.
|
RangeError — if the index is negative or greater or equal than the length
|
See also
getClass | () | method |
override public function getClass():Class
ReturnsClass |
getInfo | () | method |
public function getInfo(c:ListCell):Object
Returns the element stored in the given list cell.
Parameters
c:ListCell |
Object |
getItemAt | () | method |
public function getItemAt(index:int):Object
Parameters
index:int |
Object |
hashCode | () | method |
override public function hashCode():int
Returnsint |
indexOf | () | method |
public function indexOf(obj:Object):int
Returns the zero-based index of the given element in this list. If the given element is not in the list, -1 is returned.
Parameters
obj:Object |
int |
initYList1 | () | method |
protected final function initYList1():void
Initializes this object. See the documentation of the corresponding factory method newYList1()
for details.
See also
initYList2 | () | method |
protected final function initYList2(a:Vector.<Object>):void
Initializes this object. See the documentation of the corresponding factory method newYList2()
for details.
Parameters
a:Vector.<Object> |
See also
initYList3 | () | method |
protected final function initYList3(c:Collection):void
Initializes this object. See the documentation of the corresponding factory method newYList3()
for details.
Parameters
c:Collection |
See also
initYList4 | () | method |
protected final function initYList4(it:Iterator):void
Initializes this object. See the documentation of the corresponding factory method newYList4()
for details.
Parameters
it:Iterator |
See also
initYList5 | () | method |
protected final function initYList5(c:YCursor):void
Initializes this object. See the documentation of the corresponding factory method newYList5()
for details.
Parameters
c:YCursor |
See also
initYList6 | () | method |
protected final function initYList6(c:YCursor, predicate:DataProvider):void
Initializes this object. See the documentation of the corresponding factory method newYList6()
for details.
Parameters
c:YCursor | |
predicate:DataProvider |
See also
insertAfter | () | method |
public function insertAfter(o:Object, refCell:ListCell):ListCell
Inserts the given object into this list with respect to a given reference list cell.
The (newly created) list cell that stores the object is inserted right after the reference list cell refCell
.
refCell == null
, the given object is inserted at the head of the list.
Precondition refCell
must be part of this list.
Parameters
o:Object — The object to be inserted.
| |
refCell:ListCell — The list cell used to reference the position.
|
ListCell — The newly created ListCell object that stores object o .
|
insertBefore | () | method |
public function insertBefore(o:Object, refCell:ListCell):ListCell
Inserts the given object into this list with respect to a given reference list cell.
The (newly created) list cell that stores the object is inserted right before the reference list cell refCell
.
refCell == null
, the given object is appended to the list.
Precondition refCell
must be part of this list.
Parameters
o:Object — The object to be inserted.
| |
refCell:ListCell — The list cell used to reference the position.
|
ListCell — The newly created ListCell object that stores object o .
|
insertCellAfter | () | method |
public function insertCellAfter(cellToInsert:ListCell, refCell:ListCell):void
Inserts a formerly removed ListCell object into this list with respect to a given reference list cell.
The ListCell object is inserted right after the reference list cell refCell
.
Precondition refCell
must be part of this list.
Parameters
cellToInsert:ListCell — A list cell which is not part of any list.
| |
refCell:ListCell — The list cell used to reference the position.
|
insertCellBefore | () | method |
public function insertCellBefore(cellToInsert:ListCell, refCell:ListCell):void
Inserts a formerly removed ListCell object into this list with respect to a given reference list cell.
The ListCell object is inserted right before the reference list cell refCell
.
Precondition refCell
must be part of this list.
Parameters
cellToInsert:ListCell — A list cell which is not part of any list.
| |
refCell:ListCell — The list cell used to reference the position.
|
iterator | () | method |
public function iterator():Iterator
Returns an iterator for that list. The remove operation is supported on the iterator. This iterator instance is fail-fast.
ReturnsIterator |
last | () | method |
public function last():Object
Returns the last element of this list.
Precondition !isEmpty()
.
Object |
lastCell | () | method |
public function lastCell():ListCell
Returns the last cell of this list.
Precondition !isEmpty()
.
ListCell |
lastIndexOf | () | method |
public function lastIndexOf(o:Object):int
Parameters
o:Object |
int |
listIterator | () | method |
listIterator2 | () | method |
newYList1 | () | method |
newYList2 | () | method |
public static function newYList2(a:Vector.<Object>):YList
Creates a list that is initialized with the elements provided by the given array of objects.
Parameters
a:Vector.<Object> |
YList |
newYList3 | () | method |
public static function newYList3(c:Collection):YList
Creates a list that is initialized with the elements provided by the given Collection object.
Parameters
c:Collection |
YList |
newYList4 | () | method |
public static function newYList4(it:Iterator):YList
Creates a list that is initialized with the elements provided by the given Iterator object.
Parameters
it:Iterator |
YList |
newYList5 | () | method |
public static function newYList5(c:YCursor):YList
Creates a list that is initialized with the elements provided by the given YCursor object.
Parameters
c:YCursor |
YList |
newYList6 | () | method |
public static function newYList6(c:YCursor, predicate:DataProvider):YList
Creates a list that is initialized with those elements from the given YCursor object for which the given data provider returns true
upon calling its getBool (com.yworks.yfiles.base.DataProvider.getBool()) method.
Parameters
c:YCursor — A cursor providing objects that should be added to this list.
| |
predicate:DataProvider — A data provider that acts as a inclusion predicate for each object accessible by the given cursor.
|
YList |
See also
peek | () | method |
pop | () | method |
public function pop():Object
Removes the first element from this list and returns it.
ReturnsObject |
popLast | () | method |
public function popLast():Object
Removes the last element from this list and returns it.
ReturnsObject |
predCell | () | method |
public function predCell(c:ListCell):ListCell
Returns the predecessor cell of the given list cell.
Parameters
c:ListCell |
ListCell |
push | () | method |
public function push(o:Object):ListCell
Equivalent to addFirst().
Parameters
o:Object |
ListCell |
See also
removeAll | () | method |
public function removeAll(collection:Collection):Boolean
Removes the given collection of objects from this list.
Parameters
collection:Collection |
Boolean — Whether there have been elements removed.
|
removeAt | () | method |
public function removeAt(c:YCursor):Object
Removes the element pointed to by the given YCursor object.
Precondition The given cursor has been created by a call to this list's cursor() method and the element pointed to by it is contained in this list.
Parameters
c:YCursor |
Object — The removed element.
|
See also
removeCell | () | method |
public function removeCell(c:ListCell):Object
Removes the given list cell, and hence the element stored in it, from this list.
Complexity O(1)
Precondition The given list cell is part of this list.
Parameters
c:ListCell |
Object — The element that is stored in the removed cell.
|
removeItem | () | method |
public function removeItem(o:Object):Boolean
Removes the given object from this list.
Only the first element for which equality to o
holds gets removed.
Complexity O(size())
Parameters
o:Object |
Boolean |
removeItemAt | () | method |
public function removeItemAt(index:int):Object
Parameters
index:int |
Object |
retainAll | () | method |
public function retainAll(collection:Collection):Boolean
Retains only those elements in this list which are contained in the given collection.
Complexity This operation has running time O(max(m, n)), were m and n are the sizes of this list and the given collection, respectively.
Parameters
collection:Collection |
Boolean — Whether there have been elements removed.
|
reverse | () | method |
public function reverse():void
Reverses the sequence of elements in this list.
setInfo | () | method |
public function setInfo(c:ListCell, value:Object):void
Updates the element stored in the given list cell with the given object.
Parameters
c:ListCell | |
value:Object |
setItemAt | () | method |
public function setItemAt(index:int, element:Object):Object
Parameters
index:int | |
element:Object |
Object |
sort | () | method |
public function sort(comp:Comparator):void
Sorts the elements in this list according to the given comparator.
NOTE: The elements will be assigned to different list cells by this method.Complexity O(size() * log(size()))
Parameters
comp:Comparator |
sort2 | () | method |
public function sort2():void
Sorts the elements in this list into ascending order, according to their natural ordering.
All elements must implement the com.yworks.bridge.util.Comparable interface. Furthermore, all elements in this list must be mutually comparable (that is, e1.compareTo(e2)
must not throw a ClassCastException for any elements e1
and e2
in this list).
Complexity O(size() * log(size()))
See also
splice | () | method |
public function splice(list:YList):void
Transfers the contents of the given list to the end of this list. The given list will be empty after this operation.
Note that this operation transfers the list cells of the given list to this list. No new list cells are created by this operation.Complexity O(1)
Parameters
list:YList |
subList | () | method |
public function subList(fromIndex:int, toIndex:int):List
Parameters
fromIndex:int | |
toIndex:int |
List |
succCell | () | method |
public function succCell(c:ListCell):ListCell
Returns the successor cell of the given list cell.
Parameters
c:ListCell |
ListCell |
toArray | () | method |
public function toArray():Vector.<Object>
Returns an array representation of this list.
ReturnsVector.<Object> |
toArray2 | () | method |
public function toArray2(a:Vector.<Object>):Vector.<Object>
Returns an array containing all list elements in the correct order. The runtime type of the returned array is that of the given array.
If the list does not fit in the specified array, a new array is allocated with the runtime type of the specified array and the size of this list. If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the collection is set tonull
. This is useful in determining the length of the list only if the caller knows that the list does not contain any null
elements.
Parameters
a:Vector.<Object> — The array into which the elements of the list are to be stored, if it is big enough. Otherwise, a new array of the same runtime type is allocated for this purpose.
|
Vector.<Object> — An array containing the elements of the list.
|
Error — if the runtime type of the specified array a is not a supertype of the runtime type of every element in this list.
|
toString | () | method |
public function toString():String
Returns a string representation of this List.
ReturnsString |