Solstice::Stack - A basic stack object.


Solstice documentation  | view source Contained in the Solstice distribution.

Index


NAME

Top

Solstice::Stack - A basic stack object.

SYNOPSIS

Top

  use Solstice::Stack;

  my $stack = new Solstice::Stack;

  # Push an element onto the stack
  $stack->push($element);

  # Remove the last element in the stack, and return it
  $element = $stack->pop();

  # Return the last element in the stack
  $element = $stack->top();

  # Clear the stack
  $stack->clear();

  my $iterator = $list->iterator();
  while ($iterator->hasNext()) {
    my $element = $iterator->next();
  }

DESCRIPTION

Top

Provides a set of functionality for creating and manipulating a stack.

Export

No symbols exported.

Methods

new ()

Creates and returns an empty Solstice::Stack object.

clear()

Removes all entries from the Stack object.

push($element)

Adds an element to the end of the Stack.

pop()

Remove the last element in the Stack and return it.

top()

Returns the last element in the Stack, without removing it.

isEmpty()

Returns a boolean describing whether the internal Stack array is empty.

_init()

Initialize the Stack by clearing it.

Modules Used

Carp (Carp).

AUTHOR

Top

Catalyst Group, <catalyst@u.washington.edu>

VERSION

Top

$Revision: 2065 $

COPYRIGHT

Top


Solstice documentation  | view source Contained in the Solstice distribution.