Class: Coopy::Alignment

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAlignment

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
  @meta = nil
  @comp = nil
  @order_cache_has_reference = false
  @ia = -1
  @ib = -1
  @marked_as_identical = false
end

Instance Attribute Details

#compObject

Returns the value of attribute comp.



41
42
43
# File 'lib/lib/coopy/alignment.rb', line 41

def comp
  @comp
end

#has_additionObject

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_removalObject

Returns the value of attribute has_removal.



43
44
45
# File 'lib/lib/coopy/alignment.rb', line 43

def has_removal
  @has_removal
end

#metaObject

Returns the value of attribute meta.



40
41
42
# File 'lib/lib/coopy/alignment.rb', line 40

def meta
  @meta
end

#referenceObject

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

#countObject



94
95
96
# File 'lib/lib/coopy/alignment.rb', line 94

def count 
  @map_count
end

#get_index_columnsObject



82
83
84
# File 'lib/lib/coopy/alignment.rb', line 82

def get_index_columns 
  @index_columns
end

#get_sourceObject



121
122
123
# File 'lib/lib/coopy/alignment.rb', line 121

def get_source 
  @ta
end

#get_source_headerObject



129
130
131
# File 'lib/lib/coopy/alignment.rb', line 129

def get_source_header 
  @ia
end

#get_targetObject



125
126
127
# File 'lib/lib/coopy/alignment.rb', line 125

def get_target 
  @tb
end

#get_target_headerObject



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_identicalObject



300
301
302
# File 'lib/lib/coopy/alignment.rb', line 300

def is_marked_as_identical 
  @marked_as_identical
end


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_identicalObject



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_orderObject



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_sObject



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