lib/solve/solver/variable_table.rb in solve-0.3.0 vs lib/solve/solver/variable_table.rb in solve-0.3.1
- old
+ new
@@ -7,44 +7,51 @@
def initialize
@rows = Array.new
end
- def add(package, source)
- row = rows.detect { |row| row.package == package }
+ # @param [String] artifact
+ # @param [String] source
+ def add(artifact, source)
+ row = rows.detect { |row| row.artifact == artifact }
if row.nil?
- @rows << Variable.new(package, source)
+ @rows << VariableRow.new(artifact, source)
else
row.add_source(source)
end
end
def first_unbound
@rows.detect { |row| row.bound? == false }
end
- def find_package(package)
- @rows.detect { |row| row.package == package }
+ # @param [String] artifact
+ def find_artifact(artifact)
+ @rows.detect { |row| row.artifact == artifact }
end
+ # @param [String] source
def remove_all_with_only_this_source!(source)
with_only_this_source, others = @rows.partition { |row| row.sources == [source] }
@rows = others
with_only_this_source
end
+ # @param [String] source
def all_from_source(source)
@rows.select { |row| row.sources.include?(source) }
end
- def before(package)
- package_index = @rows.index { |row| row.package == package }
- (package_index == 0) ? nil : @rows[package_index - 1]
+ # @param [String] artifact
+ def before(artifact)
+ artifact_index = @rows.index { |row| row.artifact == artifact }
+ (artifact_index == 0) ? nil : @rows[artifact_index - 1]
end
- def all_after(package)
- package_index = @rows.index { |row| row.package == package }
- @rows[(package_index+1)..-1]
+ # @param [String] artifact
+ def all_after(artifact)
+ artifact_index = @rows.index { |row| row.artifact == artifact }
+ @rows[(artifact_index+1)..-1]
end
end
end
end