Sha256: 729a96b030d614d1baf6f28c847d45269955d3441e75ded7d53de84fd2807bab
Contents?: true
Size: 863 Bytes
Versions: 1
Compression:
Stored size: 863 Bytes
Contents
#!/usr/bin/ruby module ConstraintSolver # This class represents a list of constraints. class ConstraintList < Array # Returns the ConstraintList that contains all constraints that involve # variable and have values assigned to not all variables involved. def notAllAssignedWithVariable(variable) ConstraintList.new(self.select { |constraint| constraint.include?(variable) and not constraint.allAssigned? }) end # # Returns the ConstraintList that contains all constraints that involve # variable. def allWithVariable(variable) ConstraintList.new(self.select { |constraint| constraint.include?(variable) }) end def sort(&block) ConstraintList.new(self.sort!(&block)) end def -(element) new = self.to_a - (element.kind_of?(Array) ? element : [ element ]) return ConstraintList.new(new) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ConstraintSolver-0.1 | lib/ConstraintList.rb |