ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 75 of file class.ilDclStack.php.

76 {
77 return count($this->stack);
78 }

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 81 of file class.ilDclStack.php.

82 {
83 echo "<pre>" . print_r($this->stack, 1) . "</pre>";
84 }

◆ isEmpty()

ilDclStack::isEmpty ( )
Returns
bool

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

61 {
62 return !(bool) count($this->stack);
63 }

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 30 of file class.ilDclStack.php.

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

References count(), and isEmpty().

+ Here is the call graph for this function:

◆ push()

ilDclStack::push (   $elem)
Parameters
$elem

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

22 {
23 $this->stack[] = $elem;
24 }

◆ reset()

ilDclStack::reset ( )

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

67 {
68 $this->stack = array();
69 }

◆ top()

ilDclStack::top ( )
Returns
null

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

48 {
49 if (!$this->isEmpty()) {
50 return $this->stack[count($this->stack) - 1];
51 }
52
53 return null;
54 }

References count(), and isEmpty().

+ Here is the call graph for this function:

Field Documentation

◆ $stack

ilDclStack::$stack = array()
protected

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


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