Class: Amor::Block
- Inherits:
-
Object
- Object
- Amor::Block
- Defined in:
- lib/amor/block.rb
Instance Attribute Summary collapse
-
#constraints ⇒ Object
readonly
Returns the value of attribute constraints.
Instance Method Summary collapse
- #add_constraint(constraint) ⇒ Object
-
#dec_string(index) ⇒ Object
Returns a representation for .dec file format of this block It assumes the block has the specified index.
-
#initialize ⇒ Block
constructor
A new instance of Block.
Constructor Details
#initialize ⇒ Block
Returns a new instance of Block.
5 6 7 |
# File 'lib/amor/block.rb', line 5 def initialize @constraints = Array.new end |
Instance Attribute Details
#constraints ⇒ Object (readonly)
Returns the value of attribute constraints.
3 4 5 |
# File 'lib/amor/block.rb', line 3 def constraints @constraints end |
Instance Method Details
#add_constraint(constraint) ⇒ Object
9 10 11 |
# File 'lib/amor/block.rb', line 9 def add_constraint constraint @constraints << constraint end |
#dec_string(index) ⇒ Object
Returns a representation for .dec file format of this block It assumes the block has the specified index
15 16 17 18 19 20 21 22 |
# File 'lib/amor/block.rb', line 15 def dec_string index result = ["BLOCK #{index}"] @constraints.each do | constraint | result << constraint.lp_name end result.join("\n") end |