some variables

This commit is contained in:
Alexander Munch-Hansen 2019-10-17 11:03:11 +02:00
parent c324a4a0a0
commit 4e74b859a2

15
lol.rb
View File

@ -9,15 +9,20 @@ require_relative 'Filter'
# Hi! Steffan was here...
container_obj = "ferries"
name = "Ferry"
container_class = "Harbour"
to_string_template = "0 1 x 2 meter"
def construct_class(name_of_class, parameters, to_string_template)
sorting_one = Type.new("String", "Name")
sorting_two = Type.new("int", "Length")
sorting_three = Type.new("int", "Width")
sorting_two.comparator = ">"
sorting_three.comparator = ">"
sorting_string = compare_to_three_vars(sorting_one, sorting_two, sorting_three)
def construct_class(name_of_class, parameters, to_string_template, sorting_filters)
sorting_string = compare_to(sorting_filters)
fields = ""
parameters.each do |x|
@ -196,10 +201,9 @@ def construct_container(name, parameters, given_fields, methods, arraylist_name)
end
name = "Ferry"
file = File.open("#{name}.java", "w")
params = [{:type => "String", :name => "Name"}, {:type => "int", :name => "Length"}, {:type => "int", :name => "Width"}]
file.puts(construct_class name, params, "0 1 x 2 meter")
file.puts(construct_class name, params, to_string_template)
file.close
@ -258,7 +262,6 @@ container_methods = [
container_class = "Harbour"
another_another_file = File.open("#{container_class}.java", "w")
another_another_file.puts(construct_container(container_class, [{:type => "String", :name => "Name"}], [ {:type => "ArrayList<#{name}>", :name => container_obj}], container_methods, container_obj))
another_another_file.close
@ -270,7 +273,7 @@ another_file.puts(construct_driver name, params, [{:name => "smallFerries", :par
{:name => "longFerry", :parameters => [{:type => "String"}], :print => true},
{:name => "printHarbour", :parameters => [], :print => false},
{:name => "findFerries", :parameters => [{:type => "int"}, {:type => "int"}], :print => true },
{:name => "findLength", :parameters => [{:type => "String"}], :print => true}], "Harbour", [{:type => "String"}])
{:name => "findLength", :parameters => [{:type => "String"}], :print => true}], container_class, [{:type => "String"}])
another_file.close