cauldron 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. data/Gemfile +6 -0
  2. data/Gemfile.lock +63 -0
  3. data/History.md +5 -0
  4. data/Rakefile +62 -16
  5. data/VERSION +1 -1
  6. data/cauldron.gemspec +463 -0
  7. data/cauldron/lib/cauldron.rb +1 -1
  8. data/features/cauldron_generates_runtime_method.feature +7 -4
  9. data/features/cauldron_generates_single_paramter_methods.feature +25 -0
  10. data/features/cauldron_interactive_start_terminal.feature +17 -0
  11. data/features/cauldron_quit_terminal.feature +9 -0
  12. data/features/cauldron_start_terminal.feature +0 -1
  13. data/features/step_definitions/cauldron_steps.rb +10 -5
  14. data/features/step_definitions/terminal_steps.rb +27 -0
  15. data/features/support/env.rb +2 -0
  16. data/features/support/hooks.rb +15 -0
  17. data/lib/Chain.rb +3 -3
  18. data/lib/Mapping.rb +1 -0
  19. data/lib/PartialChain.rb +253 -0
  20. data/lib/Theory.rb +28 -4
  21. data/lib/UnifiedChain.rb +94 -125
  22. data/lib/cauldron.rb +3 -0
  23. data/lib/cauldron/demos.rb +4 -4
  24. data/lib/cauldron/env.rb +1 -0
  25. data/lib/cauldron/pot.rb +42 -38
  26. data/lib/cauldron/terminal.rb +19 -3
  27. data/lib/cauldron/util/home.rb +21 -0
  28. data/lib/cauldron/util/saver.rb +45 -0
  29. data/lib/core/Container.rb +1 -1
  30. data/lib/core/runtime_method/ActsAsRuntimeMethod.rb +28 -28
  31. data/lib/core/runtime_method/RuntimeMethod.rb +6 -23
  32. data/lib/core/statement/ActsAsStatement.rb +0 -96
  33. data/lib/core/statement/BlockStatement.rb +1 -1
  34. data/lib/core/statement/OpenStatement.rb +1 -1
  35. data/lib/core/statement/Statement.rb +39 -94
  36. data/lib/core/statement/TheoryStatement.rb +1 -1
  37. data/lib/core/syntax/BlockContainer.rb +0 -28
  38. data/lib/core/variable/MethodParameter.rb +1 -1
  39. data/lib/required.rb +2 -14
  40. data/lib/theories.rb +0 -1
  41. data/lib/theory/ActionImplementation.rb +1 -1
  42. data/lib/theory/TheoryAction.rb +2 -2
  43. data/lib/theory/TheoryConnector.rb +11 -14
  44. data/lib/theory/TheoryImplementation.rb +10 -9
  45. data/lib/util/MethodWriter.rb +10 -10
  46. data/sandbox.rb +23 -0
  47. data/spec/cauldron/pot_spec.rb +62 -10
  48. data/spec/cauldron/runtime_method_spec.rb +31 -17
  49. data/spec/cauldron/saver_spec.rb +45 -0
  50. data/spec/cauldron/terminal_spec.rb +10 -1
  51. data/spec/cauldron/theory_spec.rb +4 -4
  52. data/spec/cauldron/unified_chain_spec.rb +38 -0
  53. data/spec/spec_helper.rb +3 -1
  54. data/tasks/development_tasks.rake +4 -0
  55. data/tasks/theory_tasks.rake +16 -20
  56. data/test/fixtures/theories/0/desc +6 -6
  57. data/test/fixtures/theories/0/dump +0 -0
  58. data/test/fixtures/theories/1/desc +7 -7
  59. data/test/fixtures/theories/1/dump +0 -0
  60. data/test/fixtures/theories/10/desc +13 -13
  61. data/test/fixtures/theories/10/dump +0 -0
  62. data/test/fixtures/theories/11/desc +10 -10
  63. data/test/fixtures/theories/11/dump +0 -0
  64. data/test/fixtures/theories/12/desc +9 -9
  65. data/test/fixtures/theories/12/dump +0 -0
  66. data/test/fixtures/theories/13/desc +16 -16
  67. data/test/fixtures/theories/13/dump +0 -0
  68. data/test/fixtures/theories/14/desc +16 -16
  69. data/test/fixtures/theories/14/dump +0 -0
  70. data/test/fixtures/theories/15/desc +10 -10
  71. data/test/fixtures/theories/15/dump +0 -0
  72. data/test/fixtures/theories/16/desc +10 -10
  73. data/test/fixtures/theories/16/dump +0 -0
  74. data/test/fixtures/theories/17/desc +7 -7
  75. data/test/fixtures/theories/17/dump +0 -0
  76. data/test/fixtures/theories/18/desc +7 -7
  77. data/test/fixtures/theories/18/dump +0 -0
  78. data/test/fixtures/theories/19/desc +7 -7
  79. data/test/fixtures/theories/19/dump +0 -0
  80. data/test/fixtures/theories/2/desc +6 -6
  81. data/test/fixtures/theories/2/dump +0 -0
  82. data/test/fixtures/theories/20/desc +13 -13
  83. data/test/fixtures/theories/20/dump +0 -0
  84. data/test/fixtures/theories/3/desc +7 -7
  85. data/test/fixtures/theories/3/dump +0 -0
  86. data/test/fixtures/theories/4/desc +7 -7
  87. data/test/fixtures/theories/4/dump +0 -0
  88. data/test/fixtures/theories/5/desc +6 -6
  89. data/test/fixtures/theories/5/dump +0 -0
  90. data/test/fixtures/theories/6/desc +7 -7
  91. data/test/fixtures/theories/6/dump +0 -0
  92. data/test/fixtures/theories/7/desc +7 -7
  93. data/test/fixtures/theories/7/dump +0 -0
  94. data/test/fixtures/theories/8/desc +7 -7
  95. data/test/fixtures/theories/8/dump +0 -0
  96. data/test/fixtures/theories/9/desc +16 -16
  97. data/test/fixtures/theories/9/dump +0 -0
  98. data/test/fixtures/theory_implementations/0/dump +0 -0
  99. data/test/fixtures/theory_implementations/2/dump +0 -0
  100. data/test/ts_complete.rb +1 -10
  101. data/test/unit/core/runtime_method/tc_realised_runtime_method.rb +1 -0
  102. data/test/unit/core/runtime_method/tc_runtime_method.rb +16 -39
  103. data/test/unit/core/statement/tc_block_statement.rb +3 -3
  104. data/test/unit/core/statement/tc_open_statement.rb +4 -4
  105. data/test/unit/core/statement/tc_statement.rb +2 -147
  106. data/test/unit/core/statement/tc_theory_statement.rb +1 -1
  107. data/test/unit/theory/tc_theory_dependent.rb +3 -3
  108. data/test/unit/theory/tc_theory_result.rb +5 -5
  109. data/test/unit/util/tc_method_validation.rb +45 -45
  110. data/test/unit/util/tc_parser.rb +1 -1
  111. data/test/unit/util/tc_string_to_theory.rb +2 -2
  112. metadata +74 -48
  113. data/lib/ScopeDependencies.rb +0 -8
  114. data/lib/core/statement/StatementDependencies.rb +0 -271
  115. data/lib/core/structure/DeclareNewInstanceStructure.rb +0 -49
  116. data/lib/core/structure/DeclareRuntimeMethodStructure.rb +0 -34
  117. data/lib/core/structure/DeclareVariableAsLiteralStructure.rb +0 -31
  118. data/lib/core/structure/DeclareVariableAsVariableStructure.rb +0 -52
  119. data/lib/core/structure/FixnumAdditionStructure.rb +0 -56
  120. data/lib/core/structure/InstanceCallContainerStructure.rb +0 -50
  121. data/lib/core/structure/InstanceCallStructure.rb +0 -53
  122. data/lib/core/structure/InstanceMethodCallStructure.rb +0 -21
  123. data/lib/core/structure/ReturnStructure.rb +0 -20
  124. data/lib/core/structure/StatementStructure.rb +0 -11
  125. data/test/unit/core/statement/tc_statement_dependencies.rb +0 -147
  126. data/test/unit/core/structure/tc_declare_new_instance_structure.rb +0 -41
  127. data/test/unit/core/structure/tc_declare_variable_as_literal_structure.rb +0 -41
  128. data/test/unit/core/structure/tc_declare_variable_as_variable_structure.rb +0 -66
  129. data/test/unit/core/structure/tc_instance_call_container_structure.rb +0 -41
  130. data/test/unit/core/structure/tc_return_structure.rb +0 -32
  131. data/test/unit/tc_instance_call_structure.rb +0 -35
  132. data/test/unit/tc_statement_structure_2.rb +0 -43
@@ -80,7 +80,7 @@ class BlockStatement < OpenStatement
80
80
  self.each do |x|
81
81
  l += x.write(tab+1)+"\n"
82
82
  end
83
- tab.times {l += "\t" }
83
+ tab.times {l += " " }
84
84
  l += 'end'+"\n"
85
85
  return l
86
86
  end
@@ -21,7 +21,7 @@ class OpenStatement < StatementGroup
21
21
  def write(tab=0)
22
22
  line = @statement.write(tab)+"\n"
23
23
  line += super(tab+1)
24
- tab.times {line += "\t" }
24
+ tab.times {line += " " }
25
25
  line += "end"
26
26
  return line
27
27
  end
@@ -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 += "\t" }
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
- # Finds each element that satisfy the
479
- #
480
- # @param var The variable to replace any elements that match the block.
481
- #
482
- def replace_variable_if(var,&block)
483
- container = []
484
- @nodes.each do |x|
485
- if x.kind_of?(Variable)
486
- if block.call(x)
487
- container.push(var)
488
- next
489
- end
490
- end
491
- if x.kind_of?(InstanceCallContainer)
492
- container.push(x.replace_variable_if(var,&block))
493
- next
494
- end
495
- container.push(x.copy)
496
- end
497
- #return self.copy(*container)
498
- copied = self.copy().clear
499
- container.each {|x| copied.push(x) }
500
- return copied
501
-
502
- end
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!(id,var)
534
+
535
+ def replace_variable!(uniq_id,var)
543
536
 
544
537
  # Find the variable to be replaced
545
- target = self.find_actual_variable(id)
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
- y = []
710
+ realised_variables = []
744
711
  each_unrealised_variable do |x|
745
712
  if x.kind_of?(BlockVariable)
746
- y.push(method_map.find_realised_variable(x.variable_id,x.uniq_id,'BlockVariable'))
713
+ realised_variables.push(method_map.find_realised_variable(x.variable_id,x.uniq_id,'BlockVariable'))
747
714
  else
748
- y.push(method_map.find_realised_variable(x.variable_id,x.uniq_id))
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 |x|
721
+ self.each_unrealised_variable do |var|
755
722
  catch(:variable_substituted) do
756
- y.each do |z|
757
- if z.uniq_id == x.uniq_id
758
- result = result.replace_variable_if(z) {|a| a.uniq_id == x.uniq_id}
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 '+x.variable_id.to_s+' in "'+self.write+'"')
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 += "\t" }
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
  #
@@ -64,7 +64,7 @@ class MethodParameter < BaseVariable
64
64
  copied_var.each do |x|
65
65
  desc = x.describe(context)
66
66
  desc.each_line do |l|
67
- line += "\t"+l
67
+ line += " "+l
68
68
  end
69
69
  line += "\n" unless x == copied_var.last
70
70
  end
@@ -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'])
@@ -9,7 +9,6 @@ module ContainsTheories
9
9
  def setup
10
10
  @theory_1 = Theory.load_theory(1)
11
11
  @theory_2 = Theory.load_theory(2)
12
- #@theory_3 = Theory.load_theory(3)
13
12
  @theory_3 = theory_3
14
13
  end
15
14
 
@@ -11,7 +11,7 @@ class ActionImplementation < TheoryAction
11
11
  end
12
12
 
13
13
  def write(tab=0)
14
- return ("\t"*tab)+"runtime_method.add_statement_at(#{@action.write},#{@target_id.write})"
14
+ return (" "*tab)+"runtime_method.add_statement_at(#{@action.write},#{@target_id.write})"
15
15
  end
16
16
 
17
17
  end
@@ -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 ("\t"*tab)+"<runtime_method>.add_statement_at(#{@action.describe},#{@target_id.describe})"
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 ("\t"*tab)+"<runtime_method>.add_statement_at(#{@action.write},#{@target_id.write})"
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
- extended_chains = add_to_chain(chain.copy,theories,step)
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
- throw :complete, res2.first
102
+ raise StandardError.new('More than one complete chain found') if res2.length > 1
103
+ throw :complete, res2.first.freeze
104
104
  end
105
- closer_chains = closer_chains(chain.copy,extended_chains)
105
+ closer = closer_chains(chain.copy,extended_chains)
106
106
 
107
107
  complete_chains = []
108
- unless closer_chains.empty?
109
- closer_chains.each do |x|
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