Libraries
Search…
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)

1
def initialize(d_or_n = nil)
2
end
Copied!
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()

1
def shallow_clone()
2
end
Copied!
Shallowly clones self. Attribute references are the same. Returns the LinkedList clone.

clone_df()

1
def clone_df()
2
end
Copied!
Deeply clones. Returns the LinkedList clone. No NodeAdapter references are identical. The data references are identical.

size()

1
def size()
2
end
Copied!
Gets size. Returns the Integer.

exists(n = nil)

1
def exists(n = nil)
2
end
Copied!
Predicate. Verifies a list element exists. Takes an argument, n. Returns true in the case n is a list NodeAdapter. false otherwise.

empty()

1
def empty()
2
end
Copied!
Predicate. Returns true in the case size is 0. false otherwise.

==(object = nil)

1
def ==(object = nil)
2
end
Copied!
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)

1
def remove(n = nil)
2
end
Copied!
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)

1
def insert(n1 = nil, n2 = nil)
2
end
Copied!
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

1
def base()
2
end
Copied!
Gets base's reference. Returns the NodeAdapter or NilClass instance.

size=(i = nil) protected

1
def size=(i = nil)
2
end
Copied!
Sets size. Takes an Integer list size, i. Assigns size i. Returns the argument Integer.

initialize_node(dti = nil) private

1
def initialize_node(dti = nil)
2
end
Copied!
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

1
def base=(n = nil)
2
end
Copied!
Sets base. Takes a NodeAdapter argument, n. n becomes base's setting. Returns the NodeAdapter argument.

increment_s() private

1
def increment_s()
2
end
Copied!
Increment operator. Increments size. Sets size the list's size plus one. Returns the list's size Integer.

decrement_s() private

1
def decrement_s()
2
end
Copied!
Decrement operator. Decrements size. Sets size the list size less one. Returns the list's Integer size.

attach(n1 = nil, n2 = nil) private

1
def attach(n1 = nil, n2 = nil)
2
end
Copied!
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

1
def detach(n1 = nil, n2 = nil)
2
end
Copied!
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.
Last modified 1yr ago