Class: Coopy::Ordering

Inherits:
Object
  • Object
show all
Defined in:
lib/lib/coopy/ordering.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOrdering

Returns a new instance of Ordering.



7
8
9
10
# File 'lib/lib/coopy/ordering.rb', line 7

def initialize
  @order = Array.new
  @ignore_parent = false
end

Instance Attribute Details

#ignore_parentObject

Returns the value of attribute ignore_parent.



15
16
17
# File 'lib/lib/coopy/ordering.rb', line 15

def ignore_parent
  @ignore_parent
end

Instance Method Details

#add(l, r, p = -2)) ⇒ Object



19
20
21
22
# File 'lib/lib/coopy/ordering.rb', line 19

def add(l,r,p = -2)
  p = -2 if @ignore_parent
  @order.push(::Coopy::Unit.new(l,r,p))
end

#get_listObject



24
25
26
# File 'lib/lib/coopy/ordering.rb', line 24

def get_list 
  @order
end

#set_list(lst) ⇒ Object



28
29
30
# File 'lib/lib/coopy/ordering.rb', line 28

def set_list(lst)
  @order = lst
end

#to_sObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/lib/coopy/ordering.rb', line 32

def to_s 
  txt = ""
  begin
    _g1 = 0
    _g = @order.length
    while(_g1 < _g) 
      i = _g1
      _g1+=1
      txt += ", " if i > 0
      txt += @order[i].to_s
    end
  end
  txt
end