cauldron 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +6 -0
- data/Gemfile.lock +63 -0
- data/History.md +5 -0
- data/Rakefile +62 -16
- data/VERSION +1 -1
- data/cauldron.gemspec +463 -0
- data/cauldron/lib/cauldron.rb +1 -1
- data/features/cauldron_generates_runtime_method.feature +7 -4
- data/features/cauldron_generates_single_paramter_methods.feature +25 -0
- data/features/cauldron_interactive_start_terminal.feature +17 -0
- data/features/cauldron_quit_terminal.feature +9 -0
- data/features/cauldron_start_terminal.feature +0 -1
- data/features/step_definitions/cauldron_steps.rb +10 -5
- data/features/step_definitions/terminal_steps.rb +27 -0
- data/features/support/env.rb +2 -0
- data/features/support/hooks.rb +15 -0
- data/lib/Chain.rb +3 -3
- data/lib/Mapping.rb +1 -0
- data/lib/PartialChain.rb +253 -0
- data/lib/Theory.rb +28 -4
- data/lib/UnifiedChain.rb +94 -125
- data/lib/cauldron.rb +3 -0
- data/lib/cauldron/demos.rb +4 -4
- data/lib/cauldron/env.rb +1 -0
- data/lib/cauldron/pot.rb +42 -38
- data/lib/cauldron/terminal.rb +19 -3
- data/lib/cauldron/util/home.rb +21 -0
- data/lib/cauldron/util/saver.rb +45 -0
- data/lib/core/Container.rb +1 -1
- data/lib/core/runtime_method/ActsAsRuntimeMethod.rb +28 -28
- data/lib/core/runtime_method/RuntimeMethod.rb +6 -23
- data/lib/core/statement/ActsAsStatement.rb +0 -96
- data/lib/core/statement/BlockStatement.rb +1 -1
- data/lib/core/statement/OpenStatement.rb +1 -1
- data/lib/core/statement/Statement.rb +39 -94
- data/lib/core/statement/TheoryStatement.rb +1 -1
- data/lib/core/syntax/BlockContainer.rb +0 -28
- data/lib/core/variable/MethodParameter.rb +1 -1
- data/lib/required.rb +2 -14
- data/lib/theories.rb +0 -1
- data/lib/theory/ActionImplementation.rb +1 -1
- data/lib/theory/TheoryAction.rb +2 -2
- data/lib/theory/TheoryConnector.rb +11 -14
- data/lib/theory/TheoryImplementation.rb +10 -9
- data/lib/util/MethodWriter.rb +10 -10
- data/sandbox.rb +23 -0
- data/spec/cauldron/pot_spec.rb +62 -10
- data/spec/cauldron/runtime_method_spec.rb +31 -17
- data/spec/cauldron/saver_spec.rb +45 -0
- data/spec/cauldron/terminal_spec.rb +10 -1
- data/spec/cauldron/theory_spec.rb +4 -4
- data/spec/cauldron/unified_chain_spec.rb +38 -0
- data/spec/spec_helper.rb +3 -1
- data/tasks/development_tasks.rake +4 -0
- data/tasks/theory_tasks.rake +16 -20
- data/test/fixtures/theories/0/desc +6 -6
- data/test/fixtures/theories/0/dump +0 -0
- data/test/fixtures/theories/1/desc +7 -7
- data/test/fixtures/theories/1/dump +0 -0
- data/test/fixtures/theories/10/desc +13 -13
- data/test/fixtures/theories/10/dump +0 -0
- data/test/fixtures/theories/11/desc +10 -10
- data/test/fixtures/theories/11/dump +0 -0
- data/test/fixtures/theories/12/desc +9 -9
- data/test/fixtures/theories/12/dump +0 -0
- data/test/fixtures/theories/13/desc +16 -16
- data/test/fixtures/theories/13/dump +0 -0
- data/test/fixtures/theories/14/desc +16 -16
- data/test/fixtures/theories/14/dump +0 -0
- data/test/fixtures/theories/15/desc +10 -10
- data/test/fixtures/theories/15/dump +0 -0
- data/test/fixtures/theories/16/desc +10 -10
- data/test/fixtures/theories/16/dump +0 -0
- data/test/fixtures/theories/17/desc +7 -7
- data/test/fixtures/theories/17/dump +0 -0
- data/test/fixtures/theories/18/desc +7 -7
- data/test/fixtures/theories/18/dump +0 -0
- data/test/fixtures/theories/19/desc +7 -7
- data/test/fixtures/theories/19/dump +0 -0
- data/test/fixtures/theories/2/desc +6 -6
- data/test/fixtures/theories/2/dump +0 -0
- data/test/fixtures/theories/20/desc +13 -13
- data/test/fixtures/theories/20/dump +0 -0
- data/test/fixtures/theories/3/desc +7 -7
- data/test/fixtures/theories/3/dump +0 -0
- data/test/fixtures/theories/4/desc +7 -7
- data/test/fixtures/theories/4/dump +0 -0
- data/test/fixtures/theories/5/desc +6 -6
- data/test/fixtures/theories/5/dump +0 -0
- data/test/fixtures/theories/6/desc +7 -7
- data/test/fixtures/theories/6/dump +0 -0
- data/test/fixtures/theories/7/desc +7 -7
- data/test/fixtures/theories/7/dump +0 -0
- data/test/fixtures/theories/8/desc +7 -7
- data/test/fixtures/theories/8/dump +0 -0
- data/test/fixtures/theories/9/desc +16 -16
- data/test/fixtures/theories/9/dump +0 -0
- data/test/fixtures/theory_implementations/0/dump +0 -0
- data/test/fixtures/theory_implementations/2/dump +0 -0
- data/test/ts_complete.rb +1 -10
- data/test/unit/core/runtime_method/tc_realised_runtime_method.rb +1 -0
- data/test/unit/core/runtime_method/tc_runtime_method.rb +16 -39
- data/test/unit/core/statement/tc_block_statement.rb +3 -3
- data/test/unit/core/statement/tc_open_statement.rb +4 -4
- data/test/unit/core/statement/tc_statement.rb +2 -147
- data/test/unit/core/statement/tc_theory_statement.rb +1 -1
- data/test/unit/theory/tc_theory_dependent.rb +3 -3
- data/test/unit/theory/tc_theory_result.rb +5 -5
- data/test/unit/util/tc_method_validation.rb +45 -45
- data/test/unit/util/tc_parser.rb +1 -1
- data/test/unit/util/tc_string_to_theory.rb +2 -2
- metadata +74 -48
- data/lib/ScopeDependencies.rb +0 -8
- data/lib/core/statement/StatementDependencies.rb +0 -271
- data/lib/core/structure/DeclareNewInstanceStructure.rb +0 -49
- data/lib/core/structure/DeclareRuntimeMethodStructure.rb +0 -34
- data/lib/core/structure/DeclareVariableAsLiteralStructure.rb +0 -31
- data/lib/core/structure/DeclareVariableAsVariableStructure.rb +0 -52
- data/lib/core/structure/FixnumAdditionStructure.rb +0 -56
- data/lib/core/structure/InstanceCallContainerStructure.rb +0 -50
- data/lib/core/structure/InstanceCallStructure.rb +0 -53
- data/lib/core/structure/InstanceMethodCallStructure.rb +0 -21
- data/lib/core/structure/ReturnStructure.rb +0 -20
- data/lib/core/structure/StatementStructure.rb +0 -11
- data/test/unit/core/statement/tc_statement_dependencies.rb +0 -147
- data/test/unit/core/structure/tc_declare_new_instance_structure.rb +0 -41
- data/test/unit/core/structure/tc_declare_variable_as_literal_structure.rb +0 -41
- data/test/unit/core/structure/tc_declare_variable_as_variable_structure.rb +0 -66
- data/test/unit/core/structure/tc_instance_call_container_structure.rb +0 -41
- data/test/unit/core/structure/tc_return_structure.rb +0 -32
- data/test/unit/tc_instance_call_structure.rb +0 -35
- data/test/unit/tc_statement_structure_2.rb +0 -43
@@ -6,11 +6,7 @@ class Statement
|
|
6
6
|
attr_reader :statement_id, :scope, :statement_level, :statement_id
|
7
7
|
# TODO scope and statement level are confusing - not sure of the difference (I think it's legacy)
|
8
8
|
attr_writer :scope, :statement_level, :overrides, :statement_id
|
9
|
-
|
10
|
-
#alias :array_push :push
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
|
14
10
|
@@statement_id = 0
|
15
11
|
|
16
12
|
#
|
@@ -33,7 +29,6 @@ class Statement
|
|
33
29
|
|
34
30
|
# Add the parameters to the array
|
35
31
|
parameters.each do |code|
|
36
|
-
# self.push(code.copy)
|
37
32
|
@nodes.push(code.copy)
|
38
33
|
end
|
39
34
|
|
@@ -157,7 +152,7 @@ class Statement
|
|
157
152
|
raise StandardError.new('Unexpexted class "'+tab.class.to_s+'" for Fixnum (number of tabs)') unless tab.kind_of? Fixnum
|
158
153
|
|
159
154
|
line = ''
|
160
|
-
tab.times {line += "
|
155
|
+
tab.times {line += " " }
|
161
156
|
self.each do |code|
|
162
157
|
line += code.write
|
163
158
|
break if code.object_id == self.last.object_id
|
@@ -209,9 +204,6 @@ class Statement
|
|
209
204
|
if code.kind_of?(Variable)
|
210
205
|
|
211
206
|
line += code.write+'('+code.value.write+')'
|
212
|
-
# unless code == self.last
|
213
|
-
# line += ' '
|
214
|
-
# end
|
215
207
|
next
|
216
208
|
end
|
217
209
|
|
@@ -475,31 +467,32 @@ class Statement
|
|
475
467
|
end
|
476
468
|
|
477
469
|
# TODO I should have a realised statement class
|
478
|
-
|
479
|
-
#
|
480
|
-
#
|
481
|
-
#
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
#
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
470
|
+
|
471
|
+
# # Finds each element that satisfy the
|
472
|
+
# #
|
473
|
+
# # @param var The variable to replace any elements that match the block.
|
474
|
+
# #
|
475
|
+
# def replace_variable_if(var,&block)
|
476
|
+
# container = []
|
477
|
+
# @nodes.each do |x|
|
478
|
+
# if x.kind_of?(Variable)
|
479
|
+
# if block.call(x)
|
480
|
+
# container.push(var)
|
481
|
+
# next
|
482
|
+
# end
|
483
|
+
# end
|
484
|
+
# if x.kind_of?(InstanceCallContainer)
|
485
|
+
# container.push(x.replace_variable_if(var,&block))
|
486
|
+
# next
|
487
|
+
# end
|
488
|
+
# container.push(x.copy)
|
489
|
+
# end
|
490
|
+
# #return self.copy(*container)
|
491
|
+
# copied = self.copy().clear
|
492
|
+
# container.each {|x| copied.push(x) }
|
493
|
+
# return copied
|
494
|
+
#
|
495
|
+
# end
|
503
496
|
|
504
497
|
# Returns a variable instance with the contextual requirements for the statement.
|
505
498
|
# TODO Don't really need these contextual_variable calls
|
@@ -538,11 +531,11 @@ class Statement
|
|
538
531
|
return target[0] unless target.empty?
|
539
532
|
raise FailedToFindVariableError.new('Couldn\'t find a variable with the id '+uniq_id.to_s+' in "'+self.write+'"')
|
540
533
|
end
|
541
|
-
|
542
|
-
def replace_variable!(
|
534
|
+
|
535
|
+
def replace_variable!(uniq_id,var)
|
543
536
|
|
544
537
|
# Find the variable to be replaced
|
545
|
-
target = self.find_actual_variable(
|
538
|
+
target = self.find_actual_variable(uniq_id)
|
546
539
|
|
547
540
|
#raise StandardError.new('Both target and variable should be the same class('+target.class.to_s+' != '+var.class.to_s+')') unless(target.kind_of?(var.class))
|
548
541
|
# TODO Should check for two variable kinds to two instance call kinds
|
@@ -582,32 +575,6 @@ class Statement
|
|
582
575
|
self
|
583
576
|
end
|
584
577
|
|
585
|
-
# Returns a declaration for this statement. So it will look something
|
586
|
-
# like -
|
587
|
-
# Statement.new(StringVariable.new('test'),Equal.new,'test')
|
588
|
-
#
|
589
|
-
# @param except An array of variable ids indicating what variables not to convert to
|
590
|
-
# new declarations. This is useful when you don't want to redclare an
|
591
|
-
# exisitng variable.
|
592
|
-
#
|
593
|
-
# e.g.
|
594
|
-
# Statement.new(Unknown.new,Equal.new,var_12,Addition.new,Literal.new(9))
|
595
|
-
#
|
596
|
-
def to_declaration(except=[])
|
597
|
-
if except.empty? then return VariableDeclaration.new('Statement',*self.collect {|x| x.to_declaration}) end
|
598
|
-
results = []
|
599
|
-
self.each do |x|
|
600
|
-
if x.kind_of?(Variable)
|
601
|
-
if except.any? {|y| x.variable_id == y}
|
602
|
-
results.push Declaration.new(x.write)
|
603
|
-
next
|
604
|
-
end
|
605
|
-
end
|
606
|
-
results.push x.to_declaration
|
607
|
-
end
|
608
|
-
return VariableDeclaration.new('Statement',*results)
|
609
|
-
end
|
610
|
-
|
611
578
|
# Returns the id of the variable declared in this statement
|
612
579
|
#
|
613
580
|
def declared_variable_id
|
@@ -740,26 +707,26 @@ class Statement
|
|
740
707
|
result = self.copy
|
741
708
|
|
742
709
|
# Find value(s) for each unrealised variable.
|
743
|
-
|
710
|
+
realised_variables = []
|
744
711
|
each_unrealised_variable do |x|
|
745
712
|
if x.kind_of?(BlockVariable)
|
746
|
-
|
713
|
+
realised_variables.push(method_map.find_realised_variable(x.variable_id,x.uniq_id,'BlockVariable'))
|
747
714
|
else
|
748
|
-
|
715
|
+
realised_variables.push(method_map.find_realised_variable(x.variable_id,x.uniq_id))
|
749
716
|
end
|
750
717
|
# TODO Change to elsif x.kind_of?(Variable)
|
751
718
|
end
|
752
719
|
|
753
720
|
# Substitue the realised variables for the unrealised ones
|
754
|
-
self.each_unrealised_variable do |
|
721
|
+
self.each_unrealised_variable do |var|
|
755
722
|
catch(:variable_substituted) do
|
756
|
-
|
757
|
-
if z.uniq_id ==
|
758
|
-
result
|
723
|
+
realised_variables.each do |z|
|
724
|
+
if z.uniq_id == var.uniq_id
|
725
|
+
result.replace_variable!(var.uniq_id,z)
|
759
726
|
throw :variable_substituted
|
760
727
|
end
|
761
728
|
end
|
762
|
-
raise StandardError.new('Couldn\'t find realised value for variable with id '+
|
729
|
+
raise StandardError.new('Couldn\'t find realised value for variable with id '+var.variable_id.to_s+' in "'+self.write+'"')
|
763
730
|
end
|
764
731
|
end
|
765
732
|
return result
|
@@ -888,28 +855,6 @@ class Statement
|
|
888
855
|
return false
|
889
856
|
end
|
890
857
|
|
891
|
-
# Returns the statement with the any variables in the conversions
|
892
|
-
# table replaced with the supplied variables. This is used when
|
893
|
-
# a runtime method with parameters needs evaluated.
|
894
|
-
#
|
895
|
-
# @param conversions A hash that identifies the uniq id's of the variables
|
896
|
-
# that should be replaced.
|
897
|
-
# e.g. {:6 => <#Variable>,:8 => <#Variable>} where variables with id 6 would
|
898
|
-
# changed to indicated variable.
|
899
|
-
#
|
900
|
-
def exchange_variables(conversions)
|
901
|
-
copied_statement = self.copy
|
902
|
-
conversions.each do |x,y|
|
903
|
-
begin
|
904
|
-
#copied_statement = copied_statement.subst(x.to_s.to_i,y.copy)
|
905
|
-
copied_statement = copied_statement.replace_variable_if(y) {|a| a.uniq_id == x.to_s.to_i}
|
906
|
-
rescue FailedToFindVariableError
|
907
|
-
next
|
908
|
-
end
|
909
|
-
end
|
910
|
-
return copied_statement
|
911
|
-
end
|
912
|
-
|
913
858
|
def cauldron_method_calls
|
914
859
|
return ['.statement_id']
|
915
860
|
end
|
@@ -57,7 +57,7 @@ class TheoryStatement < Statement
|
|
57
57
|
# TODO Maybe use a opject to handle the output of the statement.
|
58
58
|
def describe(tab=0)
|
59
59
|
line = ''
|
60
|
-
tab.times {line += "
|
60
|
+
tab.times {line += " " }
|
61
61
|
self.each do |code|
|
62
62
|
line += code.describe
|
63
63
|
break if code.object_id == self.last.object_id
|
@@ -63,34 +63,6 @@ class BlockContainer < Array
|
|
63
63
|
|
64
64
|
end
|
65
65
|
|
66
|
-
# Returns a block container where all the block variables
|
67
|
-
# have been realised.
|
68
|
-
#
|
69
|
-
# I had previously intended to just work out the values for the block
|
70
|
-
# but this would create problems when I have blocks within blocks.
|
71
|
-
#
|
72
|
-
# NOTE I have copied code here from the history call in RuntimeMethod
|
73
|
-
#
|
74
|
-
def realise(statement,containing_method)
|
75
|
-
|
76
|
-
# Create the method to track the change in values of the block variable
|
77
|
-
# TODO I shouldn't need to redeclare this runtime method each time
|
78
|
-
#tracking_method = RuntimeMethod.new(MethodUsage.new(MethodParameter.new))
|
79
|
-
# Create the method that block values are logged to
|
80
|
-
instance_tracking_variable = ArrayVariable.new
|
81
|
-
instance_tracking_variable.instance_variable = true
|
82
|
-
tracking_method = RuntimeTrackingMethod.new(instance_tracking_variable)
|
83
|
-
|
84
|
-
raise StandardError.new('This should not be used')
|
85
|
-
# Create a method to call the method and return the results
|
86
|
-
#process_method = RuntimeMethod.new(MethodUsage.new)
|
87
|
-
#process_method << Statement.new( DefCall.new(NilVariable.new) )
|
88
|
-
#process_method << Statement.new( Return.new,instance_tracking_variable )
|
89
|
-
|
90
|
-
# CONTINUE Look up the tracking method
|
91
|
-
#exit
|
92
|
-
end
|
93
|
-
|
94
66
|
# Returns an updated block container where all the values for the block
|
95
67
|
# have been realised through the method map.
|
96
68
|
#
|
data/lib/required.rb
CHANGED
@@ -107,22 +107,9 @@ require $LOC+File.join(['core','statement','HashAccess'])
|
|
107
107
|
require $LOC+File.join(['core','statement','TopologicalStatements'])
|
108
108
|
require $LOC+File.join(['core','statement','TheoryStatement'])
|
109
109
|
|
110
|
-
require $LOC+File.join(['core','structure','StatementStructure'])
|
111
|
-
require $LOC+File.join(['core','structure','FixnumAdditionStructure'])
|
112
|
-
require $LOC+File.join(['core','statement','StatementStructure2'])
|
113
|
-
require $LOC+File.join(['core','structure','InstanceCallStructure'])
|
114
|
-
require $LOC+File.join(['core','structure','InstanceCallContainerStructure'])
|
115
|
-
require $LOC+File.join(['core','structure','DeclareRuntimeMethodStructure'])
|
116
|
-
require $LOC+File.join(['core','structure','DeclareNewInstanceStructure'])
|
117
|
-
require $LOC+File.join(['core','structure','DeclareVariableAsLiteralStructure'])
|
118
|
-
require $LOC+File.join(['core','structure','DeclareVariableAsVariableStructure'])
|
119
|
-
require $LOC+File.join(['core','structure','ReturnStructure'])
|
120
|
-
|
121
|
-
require $LOC+File.join(['ScopeDependencies'])
|
122
110
|
require $LOC+File.join(['MappingValues'])
|
123
111
|
require $LOC+File.join(['Mapping'])
|
124
112
|
|
125
|
-
require $LOC+File.join(['core','statement','StatementDependencies'])
|
126
113
|
require $LOC+File.join(['core','statement','BlockStatement'])
|
127
114
|
require $LOC+File.join(['core','statement','SingleLineBlockStatement'])
|
128
115
|
|
@@ -225,10 +212,11 @@ require $LOC+File.join(['core','ClassMethodCallContainer'])
|
|
225
212
|
require $LOC+File.join(['CodeHandler'])
|
226
213
|
require $LOC+File.join('Chain')
|
227
214
|
require $LOC+File.join('UnifiedChain')
|
215
|
+
require $LOC+File.join('PartialChain')
|
228
216
|
require $LOC+File.join('implemented_chain')
|
229
217
|
require $LOC+File.join('ChainMapping')
|
230
218
|
|
231
219
|
# TEST HELPERS
|
232
220
|
require $LOC+File.join(['theories'])
|
233
|
-
|
221
|
+
require $LOC+File.join(['cauldron','util','home'])
|
234
222
|
require $LOC+File.join(['cauldron','pot'])
|
data/lib/theories.rb
CHANGED
@@ -11,7 +11,7 @@ class ActionImplementation < TheoryAction
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def write(tab=0)
|
14
|
-
return ("
|
14
|
+
return (" "*tab)+"runtime_method.add_statement_at(#{@action.write},#{@target_id.write})"
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
data/lib/theory/TheoryAction.rb
CHANGED
@@ -27,11 +27,11 @@ class TheoryAction
|
|
27
27
|
#
|
28
28
|
def describe(tab=0)
|
29
29
|
# TODO That is nicer way to do tabs - I should make the other methods consistent with it
|
30
|
-
return ("
|
30
|
+
return (" "*tab)+"<runtime_method>.add_statement_at(#{@action.describe},#{@target_id.describe})"
|
31
31
|
end
|
32
32
|
|
33
33
|
def write(tab=0)
|
34
|
-
return (
|
34
|
+
return (' '*tab)+"<runtime_method>.add_statement_at(#{@action.write},#{@target_id.write})"
|
35
35
|
end
|
36
36
|
|
37
37
|
# Returns all the theory vairables in this theory action
|
@@ -64,13 +64,11 @@ class TheoryConnector
|
|
64
64
|
unless complete_chains.empty?
|
65
65
|
return complete_chains
|
66
66
|
end
|
67
|
-
|
68
67
|
possible_chains.each do |chain|
|
69
68
|
|
70
69
|
# Remove the head theory to avoid it being re-used
|
71
70
|
head_free_theories = theories.copy
|
72
71
|
head_free_theories.delete_if {|theory| theory.theory_id == chain.first.theory_id}
|
73
|
-
|
74
72
|
complete_chains += complete_chain(chain,head_free_theories)
|
75
73
|
end
|
76
74
|
return complete_chains
|
@@ -80,9 +78,9 @@ class TheoryConnector
|
|
80
78
|
def complete_chain(chain,theories)
|
81
79
|
res = catch(:complete) do
|
82
80
|
converge_chain(chain,theories)
|
81
|
+
#raise StandardError.new('Failed to generate a chain')
|
82
|
+
return []
|
83
83
|
end
|
84
|
-
|
85
|
-
#return chains
|
86
84
|
return [res]
|
87
85
|
|
88
86
|
end
|
@@ -94,19 +92,21 @@ class TheoryConnector
|
|
94
92
|
end
|
95
93
|
|
96
94
|
def converge_chain(chain,theories,step=0)
|
97
|
-
theories = remove_existing_theories(chain.copy,theories)
|
98
95
|
|
99
|
-
|
96
|
+
theories = remove_existing_theories(chain.copy,theories.copy)
|
97
|
+
|
98
|
+
extended_chains = add_to_chain(chain.copy,theories.copy,step)
|
100
99
|
|
101
100
|
if extended_chains.any? {|x| x.complete? }
|
102
101
|
res2 = extended_chains.select {|x| x.complete?}
|
103
|
-
|
102
|
+
raise StandardError.new('More than one complete chain found') if res2.length > 1
|
103
|
+
throw :complete, res2.first.freeze
|
104
104
|
end
|
105
|
-
|
105
|
+
closer = closer_chains(chain.copy,extended_chains)
|
106
106
|
|
107
107
|
complete_chains = []
|
108
|
-
unless
|
109
|
-
|
108
|
+
unless closer.empty?
|
109
|
+
closer.each do |x|
|
110
110
|
complete_chains += converge_chain(x,theories,step+1)
|
111
111
|
end
|
112
112
|
else
|
@@ -265,9 +265,7 @@ class TheoryConnector
|
|
265
265
|
# Returns a new chain so that they all use consistent theory variables ids
|
266
266
|
#
|
267
267
|
def unify_chain(chain)
|
268
|
-
|
269
|
-
#return unify_chain2(chain.reverse)
|
270
|
-
|
268
|
+
|
271
269
|
# TODO Break up this method and write tests for the individual parts
|
272
270
|
|
273
271
|
# Find all the ways the theory and results can connected
|
@@ -398,7 +396,6 @@ class TheoryConnector
|
|
398
396
|
# they should be considered equal.
|
399
397
|
#
|
400
398
|
def matching_variables(arrangements,uniq_chain)
|
401
|
-
#chains = []
|
402
399
|
mappings = []
|
403
400
|
arrangements.each do |arrangement|
|
404
401
|
map = {}
|
@@ -54,6 +54,7 @@ class TheoryImplementation < Theory
|
|
54
54
|
return true
|
55
55
|
|
56
56
|
end
|
57
|
+
|
57
58
|
# TODO If I remove the code from this method then tc_theory_implementation.rb still
|
58
59
|
# passes all the tests!
|
59
60
|
def evaluate_dependent(dependent,runtime_method,test_cases)
|
@@ -61,14 +62,14 @@ class TheoryImplementation < Theory
|
|
61
62
|
last_runtime_method = runtime_method.copy
|
62
63
|
eval dependent.statement.write
|
63
64
|
return false
|
64
|
-
end
|
65
|
-
|
66
|
-
# # Returns all the theory vairables in this theory
|
67
|
-
# # dependent.
|
68
|
-
# #
|
69
|
-
# # TODO What is the point in this - why only the actions?
|
70
|
-
# def theory_variables
|
71
|
-
# return @action.select_all {|x| x.kind_of?(TheoryVariable)}
|
72
|
-
# end
|
65
|
+
end
|
73
66
|
|
67
|
+
def hash
|
68
|
+
@theory_id
|
69
|
+
end
|
70
|
+
|
71
|
+
def eql?(value)
|
72
|
+
@theory_id == value.theory_id
|
73
|
+
end
|
74
|
+
|
74
75
|
end
|