Packagecom.yworks.yfiles.util.pq
Classpublic class DoubleObjectPQ
InheritanceDoubleObjectPQ Inheritance YObject Inheritance Object

This class implements a priority queue for objects whose priority values are of type double.

The implementation is based on binary heaps.



Public Properties
 PropertyDefined By
  empty : Boolean
[read-only] Returns whether or not this queue is empty.
DoubleObjectPQ
  min : Object
[read-only] Returns the object with smallest priority in this queue.
DoubleObjectPQ
  minPriority : Number
[read-only] Returns the minimum priority value in this queue.
DoubleObjectPQ
Public Methods
 MethodDefined By
  
DoubleObjectPQ(initialSize:int, provider:DataProvider, acceptor:DataAcceptor, init:Boolean = true)
Creates an empty ObjectPQ using the given com.yworks.yfiles.base.DataProvider and com.yworks.yfiles.base.DataAcceptor to store and retrieve Object support information.
DoubleObjectPQ
  
add(o:Object, priority:Number):void
Adds the given object with given priority to this queue.
DoubleObjectPQ
  
changePriority(o:Object, priority:Number):void
Changes the priority value of the given object.
DoubleObjectPQ
  
clear():void
Makes this queue the empty queue.
DoubleObjectPQ
  
contains(o:Object):Boolean
Returns whether or not the given object is contained.
DoubleObjectPQ
  
decreasePriority(o:Object, priority:Number):void
Decreases the priority value of the given object.
DoubleObjectPQ
  
dispose():void
Does nothing.
DoubleObjectPQ
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
DoubleObjectPQ
  
getPriority(o:Object):Number
Returns the current priority of the given object.
DoubleObjectPQ
 Inherited
hashCode():int
YObject
  
increasePriority(o:Object, priority:Number):void
Increases the priority value of the given object.
DoubleObjectPQ
  
newDoubleObjectPQ(initialSize:int, provider:DataProvider, acceptor:DataAcceptor):DoubleObjectPQ
[static] Creates an empty ObjectPQ using the given com.yworks.yfiles.base.DataProvider and com.yworks.yfiles.base.DataAcceptor to store and retrieve Object support information.
DoubleObjectPQ
  
remove(o:Object):void
Removes the given object from this queue.
DoubleObjectPQ
  
removeMin():Object
Removes the object with smallest priority from this queue.
DoubleObjectPQ
  
size():int
Returns the number of nodes currently in this queue.
DoubleObjectPQ
Protected Methods
 MethodDefined By
  
initDoubleObjectPQ(initialSize:int, provider:DataProvider, acceptor:DataAcceptor):void
Initializes this object.
DoubleObjectPQ
Property Detail
emptyproperty
empty:Boolean  [read-only]

Returns whether or not this queue is empty.

Complexity O(1)


Implementation
    public function get empty():Boolean
minproperty 
min:Object  [read-only]

Returns the object with smallest priority in this queue.

Precondition !isEmpty()


Implementation
    public function get min():Object
minPriorityproperty 
minPriority:Number  [read-only]

Returns the minimum priority value in this queue.


Implementation
    public function get minPriority():Number
Constructor Detail
DoubleObjectPQ()Constructor
public function DoubleObjectPQ(initialSize:int, provider:DataProvider, acceptor:DataAcceptor, init:Boolean = true)

Creates an empty ObjectPQ using the given com.yworks.yfiles.base.DataProvider and com.yworks.yfiles.base.DataAcceptor to store and retrieve Object support information. The contents of the provider should be modified through the use of the acceptor, i.e. they should be based on the same initially empty backing store. Additionally this backing store should not be modified externally as long as this PQ is still in use.

Parameters
initialSize:int
 
provider:DataProvider
 
acceptor:DataAcceptor
 
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
add()method
public function add(o:Object, priority:Number):void

Adds the given object with given priority to this queue.

Precondition !contains(o)

Complexity O(log(size()))

Parameters

o:Object
 
priority:Number

changePriority()method 
public function changePriority(o:Object, priority:Number):void

Changes the priority value of the given object.

Precondition contains(o)

Complexity O(log(size()))

Parameters

o:Object
 
priority:Number

clear()method 
public function clear():void

Makes this queue the empty queue.

Complexity O(size())

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

Returns whether or not the given object is contained. in this queue.

Complexity O(1)

Parameters

o:Object

Returns
Boolean
decreasePriority()method 
public function decreasePriority(o:Object, priority:Number):void

Decreases the priority value of the given object.

Precondition contains(o)

Precondition priority < getPriority(o)

Complexity O(log(size()))

Parameters

o:Object
 
priority:Number

dispose()method 
public function dispose():void

Does nothing.

getClass()method 
override public function getClass():Class

Returns
Class
getPriority()method 
public function getPriority(o:Object):Number

Returns the current priority of the given object.

Precondition contains(o)

Parameters

o:Object

Returns
Number
increasePriority()method 
public function increasePriority(o:Object, priority:Number):void

Increases the priority value of the given object.

Precondition contains(o)

Precondition priority > getPriority(o)

Complexity O(log(size()))

Parameters

o:Object
 
priority:Number

initDoubleObjectPQ()method 
protected final function initDoubleObjectPQ(initialSize:int, provider:DataProvider, acceptor:DataAcceptor):void

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

Parameters

initialSize:int
 
provider:DataProvider
 
acceptor:DataAcceptor

See also

newDoubleObjectPQ()method 
public static function newDoubleObjectPQ(initialSize:int, provider:DataProvider, acceptor:DataAcceptor):DoubleObjectPQ

Creates an empty ObjectPQ using the given com.yworks.yfiles.base.DataProvider and com.yworks.yfiles.base.DataAcceptor to store and retrieve Object support information. The contents of the provider should be modified through the use of the acceptor, i.e. they should be based on the same initially empty backing store. Additionally this backing store should not be modified externally as long as this PQ is still in use.

Parameters

initialSize:int
 
provider:DataProvider
 
acceptor:DataAcceptor

Returns
DoubleObjectPQ

See also

remove()method 
public function remove(o:Object):void

Removes the given object from this queue.

Precondition contains(o)

Complexity O(log(size()))

Parameters

o:Object

removeMin()method 
public function removeMin():Object

Removes the object with smallest priority from this queue.

Precondition !isEmpty()

Complexity O(log(size()))

Returns
Object — the removed object with smallest priority
size()method 
public function size():int

Returns the number of nodes currently in this queue.

Complexity O(1)

Returns
int