Packagecom.yworks.yfiles.util
Classpublic class BoundedStack
InheritanceBoundedStack Inheritance YObject Inheritance Object

This class represents an efficient stack of bounded size.



Public Properties
 PropertyDefined By
  empty : Boolean
[read-only] Returns true if this stack is empty.
BoundedStack
Public Methods
 MethodDefined By
  
BoundedStack(capacity:int, init:Boolean = true)
Creates a new instance of BoundedStack.
BoundedStack
  
capacity():int
Returns the maximal number of elements that this stack can hold.
BoundedStack
  
clear():void
Removes all elements from this stack;
BoundedStack
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
BoundedStack
 Inherited
hashCode():int
YObject
  
[static] Creates a new instance of BoundedStack.
BoundedStack
  
pop():Object
Returns the element that has been pushed last on this stack and removes it from this stack.
BoundedStack
  
push(o:Object):void
Pushes a new element on this stack.
BoundedStack
  
size():int
Returns the number of elements in this stack.
BoundedStack
  
top():Object
Returns the element that has been pushed last on this stack.
BoundedStack
Protected Methods
 MethodDefined By
  
initBoundedStack(capacity:int):void
Initializes this object.
BoundedStack
Property Detail
emptyproperty
empty:Boolean  [read-only]

Returns true if this stack is empty.


Implementation
    public function get empty():Boolean
Constructor Detail
BoundedStack()Constructor
public function BoundedStack(capacity:int, init:Boolean = true)

Creates a new instance of BoundedStack.

Parameters
capacity:int — the maximum capacity of this queue.
 
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.
Method Detail
capacity()method
public function capacity():int

Returns the maximal number of elements that this stack can hold.

Returns
int
clear()method 
public function clear():void

Removes all elements from this stack;

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

Returns
Class
initBoundedStack()method 
protected final function initBoundedStack(capacity:int):void

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

Parameters

capacity:int

See also

newBoundedStack()method 
public static function newBoundedStack(capacity:int):BoundedStack

Creates a new instance of BoundedStack.

Parameters

capacity:int — the maximum capacity of this queue.

Returns
BoundedStack
pop()method 
public function pop():Object

Returns the element that has been pushed last on this stack and removes it from this stack.

Precondition !isEmpty()

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

Pushes a new element on this stack.

Parameters

o:Object

size()method 
public function size():int

Returns the number of elements in this stack.

Returns
int
top()method 
public function top():Object

Returns the element that has been pushed last on this stack.

Precondition !isEmpty()

Returns
Object