ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
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.

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

69  {
70  return count($this->stack);
71  }
+ 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.

References count().

Referenced by pop(), and top().

56  {
57  return !(bool)count($this->stack);
58  }
+ 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.

References count(), and isEmpty().

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  }
+ 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.

References count(), and isEmpty().

44  {
45  if (!$this->isEmpty()) {
46  return $this->stack[count($this->stack) - 1];
47  }
48 
49  return NULL;
50  }
+ 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: