Skip to content

DoubleStack

class DoubleStack<Type> < Object

Pair of stacks used for the implementation of other containers, such as Queue and Iterator.

Member Functions

Name Description
size Number of elements.
empty Is this empty?
clear Clear all elements.
topForward Get the top element on the forward stack.
topBackward Get the top element on the backward stack.
pushForward Push a new element on the forward stack.
pushBackward Push a new element on the backward stack.
popForward Pop the top element from the forward stack and return it.
popBackward Pop the top element from the backward stack and return it.
oneForward Move one element from the backward list to the forward list.
oneBackward Move one element from the forward list to the backward list.
allForward Move all elements from the backward list to the forward list.
allBackward Move all elements from the forward list to the backward list.

Member Function Details

allBackward

function allBackward()

Move all elements from the forward list to the backward list.

allForward

function allForward()

Move all elements from the backward list to the forward list.

clear

function clear()

Clear all elements.

empty

function empty() -> Boolean

Is this empty?

oneBackward

function oneBackward()

Move one element from the forward list to the backward list.

oneForward

function oneForward()

Move one element from the backward list to the forward list.

popBackward

function popBackward() -> Type

Pop the top element from the backward stack and return it.

popForward

function popForward() -> Type

Pop the top element from the forward stack and return it.

pushBackward

function pushBackward(x:Type)

Push a new element on the backward stack.

  • x: Value.

pushForward

function pushForward(x:Type)

Push a new element on the forward stack.

  • x: Value.

size

function size() -> Integer

Number of elements.

topBackward

function topBackward() -> Type

Get the top element on the backward stack.

topForward

function topForward() -> Type

Get the top element on the forward stack.