Interface

The constants and method signatures.

Methods

initialize(data = nil)

def initialize(data = nil)
end

Constructor. Creates and returns a Stack. Takes an optional initial data object.

copy_constructor()

def copy_constructor()
end

Copy constructor. Creates a clean copy. self and the returned copy are different objects, and their attribute objects are different objects.

size()

def size()
end

Getter. Gets and returns the Integer Stack size.

empty?()

def empty?()
end

Boolean method. Returns true in the case the Stack size is 0. false otherwise.

top()

def top()
end

Getter. Gets the top's data. Returns the data's copy. copy is the top Node's data object copy. copy and the top's data are different objects, containing different attribute references.

==(stack = nil)

def ==(stack = nil)
end

Attribute equality operator. Returns true in the case self and stack share the same attribute values, and false otherwise. stack is a Stack instance or nil.

===(stack = nil)

def ===(stack = nil)
end

Case equality operator. Returns true in the case self's object_id and stack's object_id are equal. Returns false otherwise. stack is a Stack instance or nil.

push(data = nil)

def push(data = nil)
end

Pushes a data object on the Stack's top. Returns nil.

pop()

def pop()
end

Removes the top data object. Returns the removed data object's copy. The removed object and copy are different objects, and, if the data is an object, their object_ids differ.

inspect()

def inspect()
end

Returns a diagrammatic String representing the Stack.