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

#initialize ⇒ Alignment

Returns a new instance of Alignment.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/lib/coopy/alignment.rb', line 7

def initialize
  @map_a2b = {}
  @map_b2a = {}
  @ha = @hb = 0
  @map_count = 0
  @reference = nil
  @meta = nil
  @order_cache_has_reference = false
  @ia = -1
  @ib = -1
end

Instance Attribute Details

#meta ⇒ Object

Returns the value of attribute meta.



37
38
39
# File 'lib/lib/coopy/alignment.rb', line 37

def meta
  @meta
end

#reference ⇒ Object

Returns the value of attribute reference.



36
37
38
# File 'lib/lib/coopy/alignment.rb', line 36

def reference
  @reference
end

Instance Method Details

#a2b(a) ⇒ Object



72
73
74
# File 'lib/lib/coopy/alignment.rb', line 72

def a2b(a)
  @map_a2b[a]
end

#add_index_columns(unit) ⇒ Object



63
64
65
66
# File 'lib/lib/coopy/alignment.rb', line 63

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



101
102
103
104
105
# File 'lib/lib/coopy/alignment.rb', line 101

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



76
77
78
# File 'lib/lib/coopy/alignment.rb', line 76

def b2a(b)
  @map_b2a[b]
end

#count ⇒ Object



80
81
82
# File 'lib/lib/coopy/alignment.rb', line 80

def count 
  @map_count
end

#get_index_columns ⇒ Object



68
69
70
# File 'lib/lib/coopy/alignment.rb', line 68

def get_index_columns 
  @index_columns
end

#get_source ⇒ Object



107
108
109
# File 'lib/lib/coopy/alignment.rb', line 107

def get_source 
  @ta
end

#get_source_header ⇒ Object



115
116
117
# File 'lib/lib/coopy/alignment.rb', line 115

def get_source_header 
  @ia
end

#get_target ⇒ Object



111
112
113
# File 'lib/lib/coopy/alignment.rb', line 111

def get_target 
  @tb
end

#get_target_header ⇒ Object



119
120
121
# File 'lib/lib/coopy/alignment.rb', line 119

def get_target_header 
  @ib
end

#headers(ia, ib) ⇒ Object



49
50
51
52
# File 'lib/lib/coopy/alignment.rb', line 49

def headers(ia,ib)
  @ia = ia
  @ib = ib
end


57
58
59
60
61
# File 'lib/lib/coopy/alignment.rb', line 57

def link(a,b)
  @map_a2b[a] = b if a != -1
  @map_b2a[b] = a if b != -1
  @map_count+=1
end

#range(ha, hb) ⇒ Object



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

def range(ha,hb)
  @ha = ha
  @hb = hb
end

#set_rowlike(flag) ⇒ Object



54
55
# File 'lib/lib/coopy/alignment.rb', line 54

def set_rowlike(flag)
end

#tables(ta, tb) ⇒ Object



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

def tables(ta,tb)
  @ta = ta
  @tb = tb
end

#to_order ⇒ Object



90
91
92
93
94
95
96
97
98
99
# File 'lib/lib/coopy/alignment.rb', line 90

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



84
85
86
87
88
# File 'lib/lib/coopy/alignment.rb', line 84

def to_s 
  result = "" + "not implemented yet" + " // " + "not implemented yet"
  result += " (" + _hx_str(@reference.to_s) + ")" if @reference != nil
  result
end