Class: Ferret::Index::TermInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/ferret/index/term_info.rb,
ext/terminfo.c

Overview

A TermInfo is the record of information stored for a term.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ TermInfo

Returns a new instance of TermInfo.



47
48
49
# File 'ext/terminfo.c', line 47

def initialize(df=0, fp=0, pp=0, so=0)
  set_values!(df, fp, pp, so)
end

Instance Attribute Details

#doc_freqObject

Returns the value of attribute doc_freq.



74
75
76
# File 'ext/terminfo.c', line 74

def doc_freq
  @doc_freq
end

#freq_pointerObject

Returns the value of attribute freq_pointer.



81
82
83
# File 'ext/terminfo.c', line 81

def freq_pointer
  @freq_pointer
end

#prox_pointerObject

Returns the value of attribute prox_pointer.



88
89
90
# File 'ext/terminfo.c', line 88

def prox_pointer
  @prox_pointer
end

#skip_offsetObject

Returns the value of attribute skip_offset.



95
96
97
# File 'ext/terminfo.c', line 95

def skip_offset
  @skip_offset
end

Instance Method Details

#==(rother) ⇒ Object Also known as: eql?



64
65
66
67
68
69
70
# File 'ext/terminfo.c', line 64

def ==(o)
  return false if !o.instance_of?(TermInfo)
  @doc_freq == o.doc_freq &&
    @freq_pointer == o.freq_pointer &&
    @prox_pointer == o.prox_pointer &&
    @skip_offset == o.skip_offset
end

#initialize_copy(rother) ⇒ Object



54
55
56
57
58
59
60
61
62
# File 'ext/terminfo.c', line 54

static VALUE 
frt_ti_init_copy(VALUE self, VALUE rother)
{
  TermInfo *other_ti; 
  GET_TI;
  Data_Get_Struct(rother, TermInfo, other_ti);
  MEMCPY(ti, other_ti, TermInfo, 1);
  return self;
}

#set!(rother) ⇒ Object



54
55
56
57
58
59
# File 'ext/terminfo.c', line 54

def set!(ti)
  @doc_freq = ti.doc_freq
  @freq_pointer = ti.freq_pointer
  @prox_pointer = ti.prox_pointer
  @skip_offset = ti.skip_offset
end

#set_values!(*args) ⇒ Object



25
26
27
28
29
30
# File 'ext/terminfo.c', line 25

def set_values!(df=0, fp=0, pp=0, so=0)
  @doc_freq = df
  @freq_pointer = fp
  @prox_pointer = pp
  @skip_offset = so
end

#to_sObject



33
34
35
# File 'lib/ferret/index/term_info.rb', line 33

def to_s()
  "TermInfo:df=#{doc_freq}:fp=#{freq_pointer}:pp=#{prox_pointer}:so=#{skip_offset}"
end