Class: Coopy::Alignment
- Inherits:
-
Object
- Object
- Coopy::Alignment
- Defined in:
- lib/lib/coopy/alignment.rb
Instance Attribute Summary collapse
-
#comp ⇒ Object
Returns the value of attribute comp.
-
#has_addition ⇒ Object
Returns the value of attribute has_addition.
-
#has_removal ⇒ Object
Returns the value of attribute has_removal.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#reference ⇒ Object
Returns the value of attribute reference.
Instance Method Summary collapse
- #a2b(a) ⇒ Object
- #add_index_columns(unit) ⇒ Object
- #add_to_order(l, r, p = -2)) ⇒ Object
- #b2a(b) ⇒ Object
- #count ⇒ Object
- #get_index_columns ⇒ Object
- #get_source ⇒ Object
- #get_source_header ⇒ Object
- #get_target ⇒ Object
- #get_target_header ⇒ Object
- #headers(ia, ib) ⇒ Object
-
#initialize ⇒ Alignment
constructor
A new instance of Alignment.
- #is_marked_as_identical ⇒ Object
- #link(a, b) ⇒ Object
- #mark_identical ⇒ Object
- #range(ha, hb) ⇒ Object
- #set_rowlike(flag) ⇒ Object
- #tables(ta, tb) ⇒ Object
- #to_order ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Alignment
Returns a new instance of Alignment.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/lib/coopy/alignment.rb', line 7 def initialize @map_a2b = {} @map_b2a = {} @ha = @hb = 0 @map_count = 0 @reference = nil = nil @comp = nil @order_cache_has_reference = false @ia = -1 @ib = -1 @marked_as_identical = false end |
Instance Attribute Details
#comp ⇒ Object
Returns the value of attribute comp.
41 42 43 |
# File 'lib/lib/coopy/alignment.rb', line 41 def comp @comp end |
#has_addition ⇒ Object
Returns the value of attribute has_addition.
42 43 44 |
# File 'lib/lib/coopy/alignment.rb', line 42 def has_addition @has_addition end |
#has_removal ⇒ Object
Returns the value of attribute has_removal.
43 44 45 |
# File 'lib/lib/coopy/alignment.rb', line 43 def has_removal @has_removal end |
#meta ⇒ Object
Returns the value of attribute meta.
40 41 42 |
# File 'lib/lib/coopy/alignment.rb', line 40 def end |
#reference ⇒ Object
Returns the value of attribute reference.
39 40 41 |
# File 'lib/lib/coopy/alignment.rb', line 39 def reference @reference end |
Instance Method Details
#a2b(a) ⇒ Object
86 87 88 |
# File 'lib/lib/coopy/alignment.rb', line 86 def a2b(a) @map_a2b[a] end |
#add_index_columns(unit) ⇒ Object
77 78 79 80 |
# File 'lib/lib/coopy/alignment.rb', line 77 def add_index_columns(unit) @index_columns = Array.new if @index_columns == nil @index_columns.push(unit) end |
#add_to_order(l, r, p = -2)) ⇒ Object
115 116 117 118 119 |
# File 'lib/lib/coopy/alignment.rb', line 115 def add_to_order(l,r,p = -2) @order_cache = ::Coopy::Ordering.new if @order_cache == nil @order_cache.add(l,r,p) @order_cache_has_reference = p != -2 end |
#b2a(b) ⇒ Object
90 91 92 |
# File 'lib/lib/coopy/alignment.rb', line 90 def b2a(b) @map_b2a[b] end |
#count ⇒ Object
94 95 96 |
# File 'lib/lib/coopy/alignment.rb', line 94 def count @map_count end |
#get_index_columns ⇒ Object
82 83 84 |
# File 'lib/lib/coopy/alignment.rb', line 82 def get_index_columns @index_columns end |
#get_source ⇒ Object
121 122 123 |
# File 'lib/lib/coopy/alignment.rb', line 121 def get_source @ta end |
#get_source_header ⇒ Object
129 130 131 |
# File 'lib/lib/coopy/alignment.rb', line 129 def get_source_header @ia end |
#get_target ⇒ Object
125 126 127 |
# File 'lib/lib/coopy/alignment.rb', line 125 def get_target @tb end |
#get_target_header ⇒ Object
133 134 135 |
# File 'lib/lib/coopy/alignment.rb', line 133 def get_target_header @ib end |
#headers(ia, ib) ⇒ Object
55 56 57 58 |
# File 'lib/lib/coopy/alignment.rb', line 55 def headers(ia,ib) @ia = ia @ib = ib end |
#is_marked_as_identical ⇒ Object
300 301 302 |
# File 'lib/lib/coopy/alignment.rb', line 300 def is_marked_as_identical @marked_as_identical end |
#link(a, b) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/lib/coopy/alignment.rb', line 63 def link(a,b) if a != -1 @map_a2b[a] = b else @has_addition = true end if b != -1 @map_b2a[b] = a else @has_removal = true end @map_count+=1 end |
#mark_identical ⇒ Object
296 297 298 |
# File 'lib/lib/coopy/alignment.rb', line 296 def mark_identical @marked_as_identical = true end |
#range(ha, hb) ⇒ Object
45 46 47 48 |
# File 'lib/lib/coopy/alignment.rb', line 45 def range(ha,hb) @ha = ha @hb = hb end |
#set_rowlike(flag) ⇒ Object
60 61 |
# File 'lib/lib/coopy/alignment.rb', line 60 def set_rowlike(flag) end |
#tables(ta, tb) ⇒ Object
50 51 52 53 |
# File 'lib/lib/coopy/alignment.rb', line 50 def tables(ta,tb) @ta = ta @tb = tb end |
#to_order ⇒ Object
104 105 106 107 108 109 110 111 112 113 |
# File 'lib/lib/coopy/alignment.rb', line 104 def to_order if @order_cache != nil if @reference != nil @order_cache = nil if !@order_cache_has_reference end end @order_cache = self.to_order3 if @order_cache == nil @order_cache_has_reference = true if @reference != nil @order_cache end |
#to_s ⇒ Object
98 99 100 101 102 |
# File 'lib/lib/coopy/alignment.rb', line 98 def to_s result = "" + "not implemented yet" + " // " + "not implemented yet" result += " (" + _hx_str(@reference.to_s) + ")" if @reference != nil result end |