Class: Coopy::IndexPair

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

Instance Method Summary collapse

Constructor Details

#initializeIndexPair

Returns a new instance of IndexPair.



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

def initialize
  @ia = ::Coopy::Index.new
  @ib = ::Coopy::Index.new
  @quality = 0
end

Instance Method Details

#add_column(i) ⇒ Object



21
22
23
24
# File 'lib/lib/coopy/index_pair.rb', line 21

def add_column(i)
  @ia.add_column(i)
  @ib.add_column(i)
end

#add_columns(ca, cb) ⇒ Object



26
27
28
29
# File 'lib/lib/coopy/index_pair.rb', line 26

def add_columns(ca,cb)
  @ia.add_column(ca)
  @ib.add_column(cb)
end

#get_qualityObject



81
82
83
# File 'lib/lib/coopy/index_pair.rb', line 81

def get_quality 
  return @quality
end

#get_top_freqObject



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

def get_top_freq 
  return @ib.top_freq if @ib.top_freq > @ia.top_freq
  return @ia.top_freq
end

#index_tables(a, b) ⇒ Object



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

def index_tables(a,b)
  @ia.index_table(a)
  @ib.index_table(b)
  good = 0
  _it = ::Rb::RubyIterator.new(@ia.items.keys)
  while(_it.has_next) do
    key = _it._next
    item_a = @ia.items[key]
    spot_a = item_a.lst.length
    item_b = @ib.items[key]
    spot_b = 0
    spot_b = item_b.lst.length if item_b != nil
    good+=1 if spot_a == 1 && spot_b == 1
  end
  @quality = good / lambda{|_this_| b1 = a.get_height
  _r2 = [1.0,b1].max}.call(self)
end

#query_by_content(row) ⇒ Object



65
66
67
68
69
# File 'lib/lib/coopy/index_pair.rb', line 65

def query_by_content(row)
  result = ::Coopy::CrossMatch.new
  ka = @ia.to_key_by_content(row)
  return self.query_by_key(ka)
end

#query_local(row) ⇒ Object



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

def query_local(row)
  ka = @ia.to_key(@ia.get_table,row)
  return self.query_by_key(ka)
end