Class: Amor::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/amor/block.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBlock

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

#constraintsObject (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