Packagecom.yworks.yfiles.util
Classpublic class SkipList
InheritanceSkipList Inheritance YObject Inheritance Object

A simple implementation of a randomized sorted skip list that uses com.yworks.yfiles.util.SkipList_Cell s to carry the values.

See also

com.yworks.yfiles.base.YList
com.yworks.yfiles.util.SkipList_Cell


Public Methods
 MethodDefined By
  
SkipList(init:Boolean = true)
Creates a skip list that uses a comparator that uses the com.yworks.bridge.util.Comparable of the instances in the cells.
SkipList
  
clear():void
Clears this list.
SkipList
  
Removes all cells from from to to inclusive from this list.
SkipList
 Inherited
equals(o:Object):Boolean
YObject
  
Finds a cell in this list where the comparator yields 0 when it compares o with the cell's contents or null if no such cell could be found.
SkipList
  
Finds the greatest predecessor in this list where the comparator yields positive values when it compares o with the cell's contents or null if no such cell could be found.
SkipList
  
Finds the smallest successor in this list where the comparator yields negative values when it compares o with the cell's contents or null if no such cell could be found.
SkipList
  
Gets the first cell in this list or null if there are no cells in this list.
SkipList
  
getClass():Class
[override]
SkipList
 Inherited
hashCode():int
YObject
  
Inserts a new item after the provided cell.
SkipList
  
Inserts a new item before the provided cell.
SkipList
  
Inserts a new item into the list at the correct position.
SkipList
  
Creates a non-fail-save iterator that iterates over the cells in this list and yields their com.yworks.yfiles.util.SkipList_Cell.info
SkipList
  
Gets the last cell in this list or null if there are no cells in this list.
SkipList
  
[static] Creates a skip list that uses a comparator that uses the com.yworks.bridge.util.Comparable of the instances in the cells.
SkipList
  
[static] Creates a skip list that uses the given comparator to sort the list.
SkipList
  
Returns the predecessor of the given cell or null.
SkipList
  
Removes the given cell from this list.
SkipList
  
size():int
Yields the number of cells in this list.
SkipList
  
Returns the successor of the given cell or null.
SkipList
  
toString():String
Yields a human readable string version of the list.
SkipList
Protected Methods
 MethodDefined By
  
Initializes this object.
SkipList
  
initSkipList2(comparator:Comparator):void
Initializes this object.
SkipList
Constructor Detail
SkipList()Constructor
public function SkipList(init:Boolean = true)

Creates a skip list that uses a comparator that uses the com.yworks.bridge.util.Comparable of the instances in the cells.

Parameters
init: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.

See also

Method Detail
clear()method
public function clear():void

Clears this list.

clear2()method 
public function clear2(from:SkipList_Cell, to:SkipList_Cell):void

Removes all cells from from to to inclusive from this list.

Parameters

from:SkipList_Cell — The first cell to remove
 
to:SkipList_Cell — The last cell to remove

findCell()method 
public function findCell(o:Object):SkipList_Cell

Finds a cell in this list where the comparator yields 0 when it compares o with the cell's contents or null if no such cell could be found.

Parameters

o:Object — the value to search.

Returns
SkipList_Cell — The cell that contains an equal value or null.
findPredecessor()method 
public function findPredecessor(o:Object):SkipList_Cell

Finds the greatest predecessor in this list where the comparator yields positive values when it compares o with the cell's contents or null if no such cell could be found.

Parameters

o:Object — the value to search.

Returns
SkipList_Cell — The greatest cell that contains a smaller value or null.
findSuccessor()method 
public function findSuccessor(o:Object):SkipList_Cell

Finds the smallest successor in this list where the comparator yields negative values when it compares o with the cell's contents or null if no such cell could be found.

Parameters

o:Object — the value to search.

Returns
SkipList_Cell — The smallest cell that contains a greater value or null.
firstCell()method 
public function firstCell():SkipList_Cell

Gets the first cell in this list or null if there are no cells in this list.

Returns
SkipList_Cell — The first cell in the list or null.
getClass()method 
override public function getClass():Class

Returns
Class
initSkipList1()method 
protected final function initSkipList1():void

Initializes this object. See the documentation of the corresponding factory method newSkipList1() for details.

See also

initSkipList2()method 
protected final function initSkipList2(comparator:Comparator):void

Initializes this object. See the documentation of the corresponding factory method newSkipList2() for details.

Parameters

comparator:Comparator

See also

insertAfter()method 
public function insertAfter(cell:SkipList_Cell, o:Object):SkipList_Cell

Inserts a new item after the provided cell. It is not checked whether this would violate the java.util.Comparator.

Parameters

cell:SkipList_Cell — The cell to insert the item after.
 
o:Object — The item to insert.

Returns
SkipList_Cell — The cell that has just been created.

See also

java.util.Comparator
insertBefore()method 
public function insertBefore(cell:SkipList_Cell, o:Object):SkipList_Cell

Inserts a new item before the provided cell. It is not checked whether this would violate the java.util.Comparator.

Parameters

cell:SkipList_Cell — The cell to insert the item before.
 
o:Object — The item to insert.

Returns
SkipList_Cell — The cell that has just been created.

See also

java.util.Comparator
insertCell()method 
public function insertCell(o:Object):SkipList_Cell

Inserts a new item into the list at the correct position.

Parameters

o:Object — The item to insert.

Returns
SkipList_Cell — The cell that holds the item.
iterator()method 
public function iterator():Iterator

Creates a non-fail-save iterator that iterates over the cells in this list and yields their com.yworks.yfiles.util.SkipList_Cell.info

Returns
Iterator — An iterator over the values in the cells of this list.

See also

lastCell()method 
public function lastCell():SkipList_Cell

Gets the last cell in this list or null if there are no cells in this list.

Returns
SkipList_Cell — The last cell in the list or null.
newSkipList1()method 
public static function newSkipList1():SkipList

Creates a skip list that uses a comparator that uses the com.yworks.bridge.util.Comparable of the instances in the cells.

Returns
SkipList

See also

newSkipList2()method 
public static function newSkipList2(comparator:Comparator):SkipList

Creates a skip list that uses the given comparator to sort the list.

Parameters

comparator:Comparator — The comparator to use for sorting.

Returns
SkipList
predCell()method 
public function predCell(cell:SkipList_Cell):SkipList_Cell

Returns the predecessor of the given cell or null.

Parameters

cell:SkipList_Cell — The cell to get the predecessor from.

Returns
SkipList_Cell — The predecessor or null if cell is the first cell in the list.
removeCell()method 
public function removeCell(cell:SkipList_Cell):void

Removes the given cell from this list.

Parameters

cell:SkipList_Cell — The cell to remove.

size()method 
public function size():int

Yields the number of cells in this list.

Returns
int — The number of cells this list contains.
succCell()method 
public function succCell(cell:SkipList_Cell):SkipList_Cell

Returns the successor of the given cell or null.

Parameters

cell:SkipList_Cell — The cell to get the successor from.

Returns
SkipList_Cell — The successor or null if cell is the last cell in the list.
toString()method 
public function toString():String

Yields a human readable string version of the list.

Returns
String