class Coopy::IndexPair

Attributes

flags[RW]
hdr[RW]
ia[RW]
ib[RW]
quality[RW]

Public Class Methods

new(flags) click to toggle source
# File lib/lib/coopy/index_pair.rb, line 7
def initialize(flags)
  @flags = flags
  @ia = ::Coopy::Index.new(flags)
  @ib = ::Coopy::Index.new(flags)
  @quality = 0
  @hdr = 0
end

Public Instance Methods

add_columns(ca,cb) click to toggle source
# File lib/lib/coopy/index_pair.rb, line 25
def add_columns(ca,cb)
  @ia.add_column(ca)
  @ib.add_column(cb)
end
get_quality() click to toggle source
# File lib/lib/coopy/index_pair.rb, line 89
def get_quality 
  @quality
end
get_top_freq() click to toggle source
# File lib/lib/coopy/index_pair.rb, line 84
def get_top_freq 
  return @ib.top_freq if @ib.top_freq > @ia.top_freq
  @ia.top_freq
end
index_tables(a,b,hdr) click to toggle source
# File lib/lib/coopy/index_pair.rb, line 30
def index_tables(a,b,hdr)
  @ia.index_table(a,hdr)
  @ib.index_table(b,hdr)
  @hdr = hdr
  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
local_key(row) click to toggle source
# File lib/lib/coopy/index_pair.rb, line 76
def local_key(row)
  @ia.to_key(@ia.get_table,row)
end
query_by_content(row) click to toggle source
# 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)
  self.query_by_key(ka)
end
query_local(row) click to toggle source
# File lib/lib/coopy/index_pair.rb, line 71
def query_local(row)
  ka = @ia.to_key(@ia.get_table,row)
  self.query_by_key(ka)
end
remote_key(row) click to toggle source
# File lib/lib/coopy/index_pair.rb, line 80
def remote_key(row)
  @ib.to_key(@ib.get_table,row)
end

Protected Instance Methods

query_by_key(ka) click to toggle source
# File lib/lib/coopy/index_pair.rb, line 51
def query_by_key(ka)
  result = ::Coopy::CrossMatch.new
  result.item_a = @ia.items[ka]
  result.item_b = @ib.items[ka]
  result.spot_a = result.spot_b = 0
  if ka != "" 
    result.spot_a = result.item_a.lst.length if result.item_a != nil
    result.spot_b = result.item_b.lst.length if result.item_b != nil
  end
  result
end