Interface

Class: LinkedListInt.

Constants

Attributes

size, undeclared

The list's element quantity, type Integer.

base, undeclared

The list's base NodeAdapter. base is either nil or a NodeAdapter instance.

Method Signatures

initialize(d_or_n = nil)

def initialize(d_or_n = nil)
end

Initializes a LinkedList instance. Takes a DataType type, Node, or NodeAdapter instance. Sets the instance's base the argument NodeAdapter, or, instantiates a NodeAdapter using the argument data or Node instance, and sets base the instantiation. Returns the LinkedList.

shallow_clone()

def shallow_clone()
end

Shallowly clones self. Attribute references are the same. Returns the LinkedList clone.

clone_df()

def clone_df()
end

Deeply clones. Returns the LinkedList clone. No NodeAdapter references are identical. The data references are identical.

size()

def size()
end

Gets size. Returns the Integer.

exists(n = nil)

def exists(n = nil)
end

Predicate. Verifies a list element exists. Takes an argument, n. Returns true in the case n is a list NodeAdapter. false otherwise.

empty()

def empty()
end

Predicate. Returns true in the case size is 0. false otherwise.

==(object = nil)

def ==(object = nil)
end

Attribute equality operator. Takes any instance, object. Returns true in the case the argument is a LinkedList and its attribute references are identical. false otherwise.

remove(n = nil)

def remove(n = nil)
end

Removes the list's NodeAdapter , n. Traverses the list, and in the case n exists in the list, removes the reference. In the case n is not a list element, raises an ArgumentError. Returns nil.

insert(n1 = nil, n2 = nil)

def insert(n1 = nil, n2 = nil)
end

Inserts a NodeAdapter after a list element. Takes a Node or NodeAdapter n1 and a NodeAdapter n2. n1 is an insertion Node or NodeAdapter. n2 is a NodeAdapter list element. Following the operation n1 is n2 's front reference, and n2 is n1's back reference. In the case n2 is not a list element, the list remains unchanged. Returns nil.

base() protected

def base()
end

Gets base's reference. Returns the NodeAdapter or NilClass instance.

size=(i = nil) protected

def size=(i = nil)
end

Sets size. Takes an Integer list size, i. Assigns size i. Returns the argument Integer.

initialize_node(dti = nil) private

def initialize_node(dti = nil)
end

In the case the public initialize receives a DataType type or Node instance, the argument becomes a NodeAdapter. The conversion then becomes base's setting. Returns the NodeAdapter instance.

base=(n = nil) private

def base=(n = nil)
end

Sets base. Takes a NodeAdapter argument, n. n becomes base's setting. Returns the NodeAdapter argument.

increment_s() private

def increment_s()
end

Increment operator. Increments size. Sets size the list's size plus one. Returns the list's size Integer.

decrement_s() private

def decrement_s()
end

Decrement operator. Decrements size. Sets size the list size less one. Returns the list's Integer size.

attach(n1 = nil, n2 = nil) private

def attach(n1 = nil, n2 = nil)
end

Attaches two NodeAdapters. Takes two NodeAdapter arguments, n1 and n2. n1 is a precession NodeAdapter. n1 precedes n2. n2 is a consequent NodeAdapter. n2 and n1 become doubly-linked. Returns nil.

detach(n1 = nil, n2 = nil) private

def detach(n1 = nil, n2 = nil)
end

Detaches two linked NodeAdapters. Takes two NodeAdapter arguments, n1 and n2. n1 is a precession NodeAdapter. n1 precedes n2. n2 is a consequent NodeAdapter. n2 follows n1. Following the operation n1's front reference is nil, and n2's back reference is nil. All other references remain unchanged. Returns nil.