ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilDclStack Class Reference

Class ilDclStack. More...

+ Collaboration diagram for ilDclStack:

Public Member Functions

 push ($elem)
 
 pop ()
 
 top ()
 
 isEmpty ()
 
 reset ()
 
 count ()
 
 debug ()
 

Protected Attributes

 $stack = array()
 

Detailed Description

Member Function Documentation

◆ count()

ilDclStack::count ( )
Returns
int

Definition at line 69 of file class.ilDclStack.php.

69 {
70 return count($this->stack);
71 }

References count().

Referenced by count(), isEmpty(), pop(), and top().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ debug()

ilDclStack::debug ( )

Definition at line 74 of file class.ilDclStack.php.

74 {
75 echo "<pre>" . print_r($this->stack, 1) . "</pre>";
76 }

◆ isEmpty()

ilDclStack::isEmpty ( )
Returns
bool

Definition at line 56 of file class.ilDclStack.php.

56 {
57 return !(bool)count($this->stack);
58 }

References count().

Referenced by pop(), and top().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pop()

ilDclStack::pop ( )
Returns
null

Definition at line 28 of file class.ilDclStack.php.

28 {
29 if (!$this->isEmpty()) {
30 $last_index = count($this->stack) - 1;
31 $elem = $this->stack[$last_index];
32 unset($this->stack[$last_index]);
33 $this->stack = array_values($this->stack); // re-index
34 return $elem;
35 }
36
37 return NULL;
38 }

References count(), and isEmpty().

+ Here is the call graph for this function:

◆ push()

ilDclStack::push (   $elem)
Parameters
$elem

Definition at line 20 of file class.ilDclStack.php.

20 {
21 $this->stack[] = $elem;
22 }

◆ reset()

ilDclStack::reset ( )

Definition at line 61 of file class.ilDclStack.php.

61 {
62 $this->stack = array();
63 }

◆ top()

ilDclStack::top ( )
Returns
null

Definition at line 44 of file class.ilDclStack.php.

44 {
45 if (!$this->isEmpty()) {
46 return $this->stack[count($this->stack) - 1];
47 }
48
49 return NULL;
50 }

References count(), and isEmpty().

+ Here is the call graph for this function:

Field Documentation

◆ $stack

ilDclStack::$stack = array()
protected

Definition at line 14 of file class.ilDclStack.php.


The documentation for this class was generated from the following file: