zadt 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ADT_requireables.rb +11 -5
- data/lib/helper_functions.rb +0 -0
- data/lib/zadt/AbstractDataTypes/ADT.rb +8 -1
- data/lib/zadt/AbstractDataTypes/Graph/edge.rb +29 -0
- data/lib/zadt/AbstractDataTypes/Graph/face.rb +84 -0
- data/lib/zadt/AbstractDataTypes/Graph/face_graph.rb +166 -0
- data/lib/zadt/AbstractDataTypes/Graph/graph.rb +98 -0
- data/lib/zadt/AbstractDataTypes/Graph/vertex.rb +66 -0
- data/lib/zadt/AbstractDataTypes/{MinMaxStack.rb → MinMaxStackQueue/MinMaxStack.rb} +9 -9
- data/lib/zadt/AbstractDataTypes/{MinMaxStackQueue.rb → MinMaxStackQueue/MinMaxStackQueue.rb} +7 -7
- data/lib/zadt/AbstractDataTypes/{Queue.rb → MinMaxStackQueue/Queue.rb} +5 -5
- data/lib/zadt/AbstractDataTypes/{Stack.rb → MinMaxStackQueue/Stack.rb} +5 -5
- data/lib/zadt/AbstractDataTypes/{StackQueue.rb → MinMaxStackQueue/StackQueue.rb} +5 -5
- data/lib/zadt/version.rb +1 -1
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f16f371f690982be0edc05ae1e5624cdcd812233
|
4
|
+
data.tar.gz: ce2efe26d5f47a2b670b73a679e8c5f5886fe4ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c118568e9464acbb25783cee710f56fb3776e1eae551363cc24430fb843c63d584ad0a99a80863940cc7db04333270b056df80a5e7feef0dc7c91346b546ff11
|
7
|
+
data.tar.gz: 8fe21e9f1f74b97b82711a9710bbe701523b3a64e977b7877460739642c8d45af45765b465665ec7b0aedbc14ebc97041e029094d37ebee1ee0162062cb1bb4f
|
data/lib/ADT_requireables.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
require_relative 'zadt/AbstractDataTypes/ADT.rb'
|
2
|
-
require_relative 'zadt/AbstractDataTypes/Stack.rb'
|
3
|
-
require_relative 'zadt/AbstractDataTypes/Queue.rb'
|
4
|
-
require_relative 'zadt/AbstractDataTypes/StackQueue.rb'
|
5
|
-
require_relative 'zadt/AbstractDataTypes/MinMaxStack.rb'
|
6
|
-
require_relative 'zadt/AbstractDataTypes/MinMaxStackQueue.rb'
|
2
|
+
require_relative 'zadt/AbstractDataTypes/MinMaxStackQueue/Stack.rb'
|
3
|
+
require_relative 'zadt/AbstractDataTypes/MinMaxStackQueue/Queue.rb'
|
4
|
+
require_relative 'zadt/AbstractDataTypes/MinMaxStackQueue/StackQueue.rb'
|
5
|
+
require_relative 'zadt/AbstractDataTypes/MinMaxStackQueue/MinMaxStack.rb'
|
6
|
+
require_relative 'zadt/AbstractDataTypes/MinMaxStackQueue/MinMaxStackQueue.rb'
|
7
|
+
|
8
|
+
require_relative 'zadt/AbstractDataTypes/Graph/vertex.rb'
|
9
|
+
require_relative 'zadt/AbstractDataTypes/Graph/edge.rb'
|
10
|
+
require_relative 'zadt/AbstractDataTypes/Graph/graph.rb'
|
11
|
+
require_relative 'zadt/AbstractDataTypes/Graph/face.rb'
|
12
|
+
require_relative 'zadt/AbstractDataTypes/Graph/face_graph.rb'
|
File without changes
|
@@ -2,12 +2,19 @@ module Zadt
|
|
2
2
|
class ADT
|
3
3
|
def self.help
|
4
4
|
puts "Thank you for using Zagorski Advanced Data Types!"
|
5
|
-
puts "This package contains the following
|
5
|
+
puts "This package contains the following Data Types:"
|
6
|
+
puts "Array-Like Data Types"
|
6
7
|
puts "-Stack, a LIFO array with functions push and pop"
|
7
8
|
puts "-Queue, a FIFO array with functions enqueue and dequeue"
|
8
9
|
puts "-StackQueue, a Queue that is Stack-based (no real difference)"
|
9
10
|
puts "-MinMaxStack, a Stack that can return Min and Max in constant time"
|
10
11
|
puts "-MinMaxStackQueue, a Queue that can return Min and Max in constant time"
|
12
|
+
puts "Graph Data Types"
|
13
|
+
puts "-Graph, consisting of Vertices connected by Edges"
|
14
|
+
puts "--Vertex, a 'spot' on the graph"
|
15
|
+
puts "--Edge, connects two vertices"
|
16
|
+
puts "-FaceGraph, a sub-class of Graph which includes Faces"
|
17
|
+
puts "--Face, a space surrounded by Edges. Consists of Vertices and the Edges connecting them"
|
11
18
|
puts ""
|
12
19
|
puts "Each data type also has a help function. Type Zadt::Stack::help for a list of Stack functions, and so on."
|
13
20
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Zadt
|
2
|
+
class Edge
|
3
|
+
attr_accessor :connection
|
4
|
+
def initialize(v1, v2)
|
5
|
+
@connection = [v1, v2]
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.help
|
9
|
+
puts "Edge has one method:"
|
10
|
+
puts "#connection, which returns the vertices the edge connects"
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.methods
|
14
|
+
self.help
|
15
|
+
end
|
16
|
+
|
17
|
+
def help
|
18
|
+
self.help
|
19
|
+
end
|
20
|
+
|
21
|
+
def methods
|
22
|
+
help
|
23
|
+
end
|
24
|
+
|
25
|
+
def inspect
|
26
|
+
@connection.to_s
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# require_relative 'vertex.rb'
|
2
|
+
# require_relative 'edge.rb'
|
3
|
+
module Zadt
|
4
|
+
class Face
|
5
|
+
attr_reader :edges, :vertices, :neighboring_faces
|
6
|
+
def initialize(edges_array, neighboring_faces = {})
|
7
|
+
raise "Not enough edges" if edges_array.length < 3
|
8
|
+
@edges = edges_array
|
9
|
+
vertices = edges_array.map{ |edge| edge.connection}.inject(:+).uniq
|
10
|
+
@vertices = ensure_cyclic(vertices)
|
11
|
+
@neighboring_faces = neighboring_faces
|
12
|
+
@neighbor_id = @neighboring_faces.length
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.help
|
16
|
+
puts "Here are the functions for Face:"
|
17
|
+
puts "#add_neighbor(face)"
|
18
|
+
puts "#remove_neighbor(neighbor)"
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.methods
|
22
|
+
self.help
|
23
|
+
end
|
24
|
+
|
25
|
+
def help
|
26
|
+
self.help
|
27
|
+
end
|
28
|
+
|
29
|
+
def methods
|
30
|
+
help
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_neighbor(face)
|
34
|
+
# face_info is a catalog of information about the face's neighbor
|
35
|
+
# It has three properties: face, which is the neighbor face itself,
|
36
|
+
# as well as "shared_vertices" and "shared_edges".
|
37
|
+
face_info = {}
|
38
|
+
face_info["face"] = face
|
39
|
+
face_info["shared_vertices"] = @vertices.select{|vertex| face.vertices.include?(vertex)}
|
40
|
+
face_info["shared_edges"] = @edges.select{|edge| face.edges.include?(edge)}
|
41
|
+
raise "No connecting edges or vertices" if face_info["shared_vertices"].empty? && face_info["shared_edges"].empty?
|
42
|
+
@neighboring_faces[@neighbor_id] = face_info
|
43
|
+
@neighbor_id += 1
|
44
|
+
end
|
45
|
+
|
46
|
+
def remove_neighbor(neighbor)
|
47
|
+
id_of_neighbor = -1
|
48
|
+
@neighboring_faces.each do |id, face_info|
|
49
|
+
id_of_neighbor = id if face_info["face"] == neighbor
|
50
|
+
end
|
51
|
+
raise "Not a neighbor" if id_of_neighbor == -1
|
52
|
+
@neighboring_faces.delete(id_of_neighbor)
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
def inspect
|
57
|
+
output = "This face contains the following vertices:"
|
58
|
+
output += @vertices.to_s
|
59
|
+
output = "This face contains the following edges:"
|
60
|
+
output += @edges.to_s
|
61
|
+
output
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
def ensure_cyclic(vertices)
|
66
|
+
connect_testers = vertices.dup
|
67
|
+
connected_vertices = []
|
68
|
+
connected_vertices << connect_testers.pop
|
69
|
+
until connected_vertices.length == vertices.length
|
70
|
+
continue = false
|
71
|
+
connect_testers.each do |vert|
|
72
|
+
if (connected_vertices.last).is_connected?(vert)
|
73
|
+
connected_vertices << vert
|
74
|
+
continue = true
|
75
|
+
break
|
76
|
+
end
|
77
|
+
end
|
78
|
+
connect_testers.delete(connected_vertices.last)
|
79
|
+
raise "Not cyclic edges" if continue == false
|
80
|
+
end
|
81
|
+
connected_vertices
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
require_relative 'face.rb'
|
2
|
+
require_relative 'graph.rb'
|
3
|
+
|
4
|
+
module Zadt
|
5
|
+
class FaceGraph < Graph
|
6
|
+
attr_reader :faces
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
#@faces is ALL faces on the graph
|
10
|
+
@faces = []
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.help
|
15
|
+
puts "Here are the functions for FaceGraph:"
|
16
|
+
puts "#add_face(edges_array)"
|
17
|
+
puts "#make_original_face(num_edges)"
|
18
|
+
puts "#add_attached_face(vertex_array, num_edges)"
|
19
|
+
puts "#add_attached_face(vertex_array, num_edges)"
|
20
|
+
puts "#find_neighbors(vertex_array)"
|
21
|
+
puts "#make_vertex_line(vertex_array)"
|
22
|
+
puts "#make_neighbors(face1, face2)"
|
23
|
+
puts "#remove_neighbors(face1, face2)"
|
24
|
+
puts "FaceGraph also inherits the following functions from Graph:"
|
25
|
+
puts "#add_vertex"
|
26
|
+
puts "#remove_vertex(vertex)"
|
27
|
+
puts "#make_connection(v1,v2)"
|
28
|
+
puts "#break_connection(v1,v2)"
|
29
|
+
puts "#find_connection(v1,v2)"
|
30
|
+
puts "#is_connected?(v1,v2)"
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.methods
|
34
|
+
self.help
|
35
|
+
end
|
36
|
+
|
37
|
+
def help
|
38
|
+
self.help
|
39
|
+
end
|
40
|
+
|
41
|
+
def methods
|
42
|
+
help
|
43
|
+
end
|
44
|
+
|
45
|
+
def add_face(edges_array)
|
46
|
+
face = Face.new(edges_array)
|
47
|
+
@faces << face
|
48
|
+
face
|
49
|
+
end
|
50
|
+
|
51
|
+
# Makes a face with num_edges edges, which will be attached to nothing.
|
52
|
+
def make_original_face(num_edges)
|
53
|
+
|
54
|
+
# Make the vertices
|
55
|
+
vert_ref = Array.new(num_edges) {Vertex.new}
|
56
|
+
edge_ref = []
|
57
|
+
|
58
|
+
# Connect each vertex to the one before it (including the first one :)
|
59
|
+
(num_edges).times do |vert_id|
|
60
|
+
edge_ref << make_connection(vert_ref[vert_id - 1], vert_ref[vert_id])
|
61
|
+
end
|
62
|
+
|
63
|
+
# Make the face and store it
|
64
|
+
face = add_face(edge_ref)
|
65
|
+
# Store the new vertices
|
66
|
+
@vertices += vert_ref
|
67
|
+
# Store the new edges
|
68
|
+
@edges += edge_ref
|
69
|
+
|
70
|
+
face
|
71
|
+
end
|
72
|
+
|
73
|
+
# This adds a face that will be attached to the given vertices
|
74
|
+
# Make sure the vertices are connected, or it will raise an error
|
75
|
+
# All new vertices and edges will be created
|
76
|
+
# This will automatically make_neighbors with any faces that share
|
77
|
+
# a vertex with the new face
|
78
|
+
def add_attached_face(vertex_array, num_edges)
|
79
|
+
# Make the vertices into a line
|
80
|
+
# p vertex_array
|
81
|
+
vertex_line = make_vertex_line(vertex_array)
|
82
|
+
# This finds the "ends" of the vertex line
|
83
|
+
end_vertices = [vertex_line.first, vertex_line.last]
|
84
|
+
# Find the neighbors that will be added later
|
85
|
+
new_neighbors = find_neighbors(vertex_array)
|
86
|
+
# How many vertices and edges to be made
|
87
|
+
vertices_to_make = num_edges - vertex_array.length
|
88
|
+
edges_to_make = vertices_to_make + 1
|
89
|
+
|
90
|
+
vert_ref = []
|
91
|
+
# Make new vertices
|
92
|
+
vert_ref = Array.new(vertices_to_make) {Vertex.new}
|
93
|
+
|
94
|
+
edge_ref = []
|
95
|
+
# Connect new vertices in a line
|
96
|
+
(edges_to_make - 2).times do |vert_id|
|
97
|
+
# Connect each vertex to the one after it
|
98
|
+
edge_ref << make_connection(vert_ref[vert_id], vert_ref[vert_id + 1])
|
99
|
+
end
|
100
|
+
# Connect "ends" of new vertices to "ends" of vertex line (making a circuit)
|
101
|
+
# Connect "first" of new vertices to "first end" of old ones
|
102
|
+
edge_ref << make_connection(vert_ref.first, end_vertices.first)
|
103
|
+
# Connect "last" of new vertices to "last end" of old ones
|
104
|
+
edge_ref << make_connection(vert_ref.last, end_vertices.last)
|
105
|
+
|
106
|
+
# Add edges from vertex_line to edge_ref
|
107
|
+
(vertex_line.length - 1).times do |vert_id|
|
108
|
+
edge_ref << find_connection(vertex_line[vert_id], vertex_line[vert_id + 1])
|
109
|
+
end
|
110
|
+
|
111
|
+
face_border = edge_ref
|
112
|
+
# Make a face out of the new circuit, and store it
|
113
|
+
face = add_face(face_border)
|
114
|
+
# Store the new vertices
|
115
|
+
@vertices += vert_ref
|
116
|
+
# Store the new edges
|
117
|
+
@edges += edge_ref
|
118
|
+
|
119
|
+
new_neighbors.each do |neighbor|
|
120
|
+
# Add all the new_neighbors
|
121
|
+
face.add_neighbor(neighbor)
|
122
|
+
# Make this a neighbor to all new_neighbors
|
123
|
+
neighbor.add_neighbor(face)
|
124
|
+
end
|
125
|
+
face
|
126
|
+
end
|
127
|
+
|
128
|
+
# Return all faces containing the given vertices
|
129
|
+
def find_neighbors(vertex_array)
|
130
|
+
neighbors = []
|
131
|
+
vertex_array.each do |vertex|
|
132
|
+
@faces.each do |face|
|
133
|
+
neighbors << face if face.vertices.include?(vertex)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
neighbors.uniq
|
137
|
+
end
|
138
|
+
|
139
|
+
def make_vertex_line(vertex_array)
|
140
|
+
connection_line = []
|
141
|
+
connection_line << vertex_array.first
|
142
|
+
continue = true
|
143
|
+
until connection_line.length == vertex_array.length || !continue
|
144
|
+
continue = false
|
145
|
+
vertex_array.each do |vertex|
|
146
|
+
if vertex.is_connected?(connection_line.last) && !connection_line.include?(vertex)
|
147
|
+
continue = true
|
148
|
+
connection_line << vertex
|
149
|
+
end
|
150
|
+
end
|
151
|
+
raise "Vertices not connected" if continue == false
|
152
|
+
end
|
153
|
+
connection_line
|
154
|
+
end
|
155
|
+
|
156
|
+
def make_neighbors(face1, face2)
|
157
|
+
face1.add_neighbor(face2)
|
158
|
+
face2.add_neighbor(face1)
|
159
|
+
end
|
160
|
+
|
161
|
+
def remove_neighbors(face1, face2)
|
162
|
+
face2.remove_neighbor(face1)
|
163
|
+
face1.remove_neighbor(face2)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require_relative 'vertex.rb'
|
2
|
+
|
3
|
+
module Zadt
|
4
|
+
class Graph
|
5
|
+
attr_reader :vertices, :edges
|
6
|
+
|
7
|
+
#init_v allows for initial vertices (not generally used)
|
8
|
+
def initialize
|
9
|
+
#@vertices is ALL vertices on the graph
|
10
|
+
@vertices = []
|
11
|
+
#@edges is ALL edges on the graph
|
12
|
+
@edges = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.help
|
16
|
+
puts "Here are the functions for Graph:"
|
17
|
+
puts "#add_vertex"
|
18
|
+
puts "#remove_vertex(vertex)"
|
19
|
+
puts "#make_connection(v1,v2)"
|
20
|
+
puts "#break_connection(v1,v2)"
|
21
|
+
puts "#find_connection(v1,v2)"
|
22
|
+
puts "#is_connected?(v1,v2)"
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.methods
|
26
|
+
self.help
|
27
|
+
end
|
28
|
+
|
29
|
+
def help
|
30
|
+
self.help
|
31
|
+
end
|
32
|
+
|
33
|
+
def methods
|
34
|
+
help
|
35
|
+
end
|
36
|
+
|
37
|
+
# Add a vertex
|
38
|
+
def add_vertex
|
39
|
+
vertex = Vertex.new
|
40
|
+
@vertices << vertex
|
41
|
+
vertex
|
42
|
+
end
|
43
|
+
|
44
|
+
# Remove a vertex
|
45
|
+
def remove_vertex(vertex)
|
46
|
+
# The vertex must exist
|
47
|
+
if !vertex
|
48
|
+
raise "Vertex does not exist"
|
49
|
+
# The vertex must not be connected to anything
|
50
|
+
elsif !vertex.connections.empty?
|
51
|
+
raise "Vertex has edges. Break them first."
|
52
|
+
# If it exists and isn't connected, delete it
|
53
|
+
else
|
54
|
+
@vertices.delete(vertex)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Make an edge between two vertices
|
59
|
+
def make_connection(v1, v2)
|
60
|
+
raise "already connected" if is_connected?(v1, v2)
|
61
|
+
# Connect the two using the vertex method "connect"
|
62
|
+
edge = v1.connect(v2)
|
63
|
+
# Add to edge catalog
|
64
|
+
@edges << edge
|
65
|
+
edge
|
66
|
+
end
|
67
|
+
|
68
|
+
def break_connection(v1, v2)
|
69
|
+
raise "First vertex does not exist" if !v1
|
70
|
+
raise "Second vertex does not exist" if !v2
|
71
|
+
|
72
|
+
if is_connected?(v1, v2)
|
73
|
+
# Find edge
|
74
|
+
edge = find_connection(v1, v2)
|
75
|
+
# Remove edge from edges catalog
|
76
|
+
@edges.delete(edge)
|
77
|
+
#Remove edge from vertices
|
78
|
+
v1.edges.delete(edge)
|
79
|
+
v2.edges.delete(edge)
|
80
|
+
v1.connections.delete(v2)
|
81
|
+
v2.connections.delete(v1)
|
82
|
+
else
|
83
|
+
raise "Vertices are not connected"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# Find the edge connecting two vertices
|
88
|
+
def find_connection(v1, v2)
|
89
|
+
connection = v1.edges.select {|edge| edge.connection.include?(v2)}
|
90
|
+
connection.first
|
91
|
+
end
|
92
|
+
|
93
|
+
# Returns whether two vertices are connected
|
94
|
+
def is_connected?(v1, v2)
|
95
|
+
v1.connections.include?(v2)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require_relative 'edge.rb'
|
2
|
+
module Zadt
|
3
|
+
class Vertex
|
4
|
+
attr_accessor :edges, :connections
|
5
|
+
def initialize
|
6
|
+
# List of edges attached to vertex
|
7
|
+
@edges = []
|
8
|
+
# List of vertices "connected" to this one
|
9
|
+
@connections = []
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.help
|
13
|
+
puts "Here are the functions for Vertex:"
|
14
|
+
puts "#connect(other_vertex)"
|
15
|
+
puts "#is_connected?(other_vertex)"
|
16
|
+
puts "#make_connection(v1,v2)"
|
17
|
+
puts "#break_connection(v1,v2)"
|
18
|
+
puts "#find_connection(v1,v2)"
|
19
|
+
puts "#is_connected?(v1,v2)"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.methods
|
23
|
+
self.help
|
24
|
+
end
|
25
|
+
|
26
|
+
def help
|
27
|
+
self.help
|
28
|
+
end
|
29
|
+
|
30
|
+
def methods
|
31
|
+
help
|
32
|
+
end
|
33
|
+
|
34
|
+
# Make an edge between this vertex and another
|
35
|
+
def connect(other_vertex)
|
36
|
+
return nil if !other_vertex
|
37
|
+
raise "already connected" if is_connected?(other_vertex)
|
38
|
+
|
39
|
+
edge = Edge.new(self, other_vertex)
|
40
|
+
# Store connection info in this vertex
|
41
|
+
@edges << edge
|
42
|
+
@connections << other_vertex
|
43
|
+
# Store connection info in other vertex
|
44
|
+
other_vertex.store_connection_info(self, edge)
|
45
|
+
edge
|
46
|
+
end
|
47
|
+
|
48
|
+
# Returns if another vertex is "connected" to this one
|
49
|
+
def is_connected?(other_vertex)
|
50
|
+
@connections.include?(other_vertex)
|
51
|
+
end
|
52
|
+
|
53
|
+
def inspect
|
54
|
+
"Vertex"
|
55
|
+
end
|
56
|
+
|
57
|
+
# Used to store connection info in the second vertex
|
58
|
+
# involved in a connection
|
59
|
+
# Must needs be public, since it's called by a different vertex
|
60
|
+
def store_connection_info(vertex, edge)
|
61
|
+
@edges << edge
|
62
|
+
@connections << vertex
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
@@ -9,14 +9,14 @@ module Zadt
|
|
9
9
|
|
10
10
|
def self.help
|
11
11
|
puts "Here are the functions for MinMaxStack:"
|
12
|
-
puts "push(value)"
|
13
|
-
puts "pop"
|
14
|
-
puts "peek"
|
15
|
-
puts "min"
|
16
|
-
puts "max"
|
17
|
-
puts "length"
|
18
|
-
puts "show"
|
19
|
-
puts "empty?"
|
12
|
+
puts "#push(value)"
|
13
|
+
puts "#pop"
|
14
|
+
puts "#peek"
|
15
|
+
puts "#min"
|
16
|
+
puts "#max"
|
17
|
+
puts "#length"
|
18
|
+
puts "#show"
|
19
|
+
puts "#empty?"
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.methods
|
@@ -24,7 +24,7 @@ module Zadt
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def help
|
27
|
-
|
27
|
+
self.help
|
28
28
|
end
|
29
29
|
|
30
30
|
def methods
|
data/lib/zadt/AbstractDataTypes/{MinMaxStackQueue.rb → MinMaxStackQueue/MinMaxStackQueue.rb}
RENAMED
@@ -12,13 +12,13 @@ module Zadt
|
|
12
12
|
|
13
13
|
def self.help
|
14
14
|
puts "Here are the functions for MinMaxStackQueue:"
|
15
|
-
puts "show"
|
16
|
-
puts "enqueue(value)"
|
17
|
-
puts "dequeue"
|
18
|
-
puts "min"
|
19
|
-
puts "max"
|
20
|
-
puts "length"
|
21
|
-
puts "empty?"
|
15
|
+
puts "#show"
|
16
|
+
puts "#enqueue(value)"
|
17
|
+
puts "#dequeue"
|
18
|
+
puts "#min"
|
19
|
+
puts "#max"
|
20
|
+
puts "#length"
|
21
|
+
puts "#empty?"
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.methods
|
@@ -6,11 +6,11 @@ module Zadt
|
|
6
6
|
|
7
7
|
def self.help
|
8
8
|
puts "Here are the functions for Queue:"
|
9
|
-
puts "show"
|
10
|
-
puts "enqueue(value)"
|
11
|
-
puts "dequeue"
|
12
|
-
puts "length"
|
13
|
-
puts "empty?"
|
9
|
+
puts "#show"
|
10
|
+
puts "#enqueue(value)"
|
11
|
+
puts "#dequeue"
|
12
|
+
puts "#length"
|
13
|
+
puts "#empty?"
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.methods
|
@@ -6,11 +6,11 @@ module Zadt
|
|
6
6
|
|
7
7
|
def self.help
|
8
8
|
puts "Here are the functions for Stack:"
|
9
|
-
puts "show"
|
10
|
-
puts "push(value)"
|
11
|
-
puts "pop"
|
12
|
-
puts "length"
|
13
|
-
puts "empty?"
|
9
|
+
puts "#show"
|
10
|
+
puts "#push(value)"
|
11
|
+
puts "#pop"
|
12
|
+
puts "#length"
|
13
|
+
puts "#empty?"
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.methods
|
@@ -11,11 +11,11 @@ module Zadt
|
|
11
11
|
|
12
12
|
def self.help
|
13
13
|
puts "Here are the functions for StackQueue:"
|
14
|
-
puts "show"
|
15
|
-
puts "enqueue(value)"
|
16
|
-
puts "dequeue"
|
17
|
-
puts "length"
|
18
|
-
puts "empty?"
|
14
|
+
puts "#show"
|
15
|
+
puts "#enqueue(value)"
|
16
|
+
puts "#dequeue"
|
17
|
+
puts "#length"
|
18
|
+
puts "#empty?"
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.methods
|
data/lib/zadt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zadt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Zagorski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,13 +73,19 @@ files:
|
|
73
73
|
- bin/console
|
74
74
|
- bin/setup
|
75
75
|
- lib/ADT_requireables.rb
|
76
|
+
- lib/helper_functions.rb
|
76
77
|
- lib/zadt.rb
|
77
78
|
- lib/zadt/AbstractDataTypes/ADT.rb
|
78
|
-
- lib/zadt/AbstractDataTypes/
|
79
|
-
- lib/zadt/AbstractDataTypes/
|
80
|
-
- lib/zadt/AbstractDataTypes/
|
81
|
-
- lib/zadt/AbstractDataTypes/
|
82
|
-
- lib/zadt/AbstractDataTypes/
|
79
|
+
- lib/zadt/AbstractDataTypes/Graph/edge.rb
|
80
|
+
- lib/zadt/AbstractDataTypes/Graph/face.rb
|
81
|
+
- lib/zadt/AbstractDataTypes/Graph/face_graph.rb
|
82
|
+
- lib/zadt/AbstractDataTypes/Graph/graph.rb
|
83
|
+
- lib/zadt/AbstractDataTypes/Graph/vertex.rb
|
84
|
+
- lib/zadt/AbstractDataTypes/MinMaxStackQueue/MinMaxStack.rb
|
85
|
+
- lib/zadt/AbstractDataTypes/MinMaxStackQueue/MinMaxStackQueue.rb
|
86
|
+
- lib/zadt/AbstractDataTypes/MinMaxStackQueue/Queue.rb
|
87
|
+
- lib/zadt/AbstractDataTypes/MinMaxStackQueue/Stack.rb
|
88
|
+
- lib/zadt/AbstractDataTypes/MinMaxStackQueue/StackQueue.rb
|
83
89
|
- lib/zadt/version.rb
|
84
90
|
- zadt.gemspec
|
85
91
|
homepage: https://github.com/MrMicrowaveOven/zadt.git
|