Class: RIO::Match::Record::SelRej
Instance Method Summary collapse
- #always? ⇒ Boolean
- #class_tail ⇒ Object
- #init_always(reset = false) ⇒ Object
-
#initialize(therio, sel_args, rej_args) ⇒ SelRej
constructor
A new instance of SelRej.
- #inspect ⇒ Object
- #match?(val, recno) ⇒ Boolean
- #never? ⇒ Boolean
- #only_one_fixnum? ⇒ Boolean
- #ranges ⇒ Object
- #rangetops ⇒ Object
- #remove_passed_ranges(n) ⇒ Object
Constructor Details
Instance Method Details
#always? ⇒ Boolean
263 264 265 |
# File 'lib/rio/matchrecord.rb', line 263 def always?() @always == true end |
#class_tail ⇒ Object
256 257 258 |
# File 'lib/rio/matchrecord.rb', line 256 def class_tail self.class.to_s.sub(/^.+::/,'') end |
#init_always(reset = false) ⇒ Object
230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/rio/matchrecord.rb', line 230 def init_always(reset=false) if @sel.nil? and @rej.nil? !reset elsif @rej.nil? and @sel.always? true elsif @sel.nil? false elsif !@rej.nil? and @rej.always? false else nil end end |
#inspect ⇒ Object
259 260 261 262 |
# File 'lib/rio/matchrecord.rb', line 259 def inspect sprintf("#<%s:0x%08x @always=%s @sel=%s @rej=%s>",self.class_tail,self.object_id,@always.inspect, @sel.inspect,@rej.inspect) end |
#match?(val, recno) ⇒ Boolean
269 270 271 272 273 274 275 |
# File 'lib/rio/matchrecord.rb', line 269 def match?(val,recno) #p "match?(#{val},#{recno}) #{self.inspect}" return @always unless @always.nil? as = nil ok = ((!@sel.nil? && (as = @sel.match?(val,recno))) && !(!@rej.nil? && @rej.match?(val,recno))) return (ok ? as : ok) end |
#never? ⇒ Boolean
266 267 268 |
# File 'lib/rio/matchrecord.rb', line 266 def never?() @always == false end |
#only_one_fixnum? ⇒ Boolean
227 228 229 |
# File 'lib/rio/matchrecord.rb', line 227 def only_one_fixnum?() @rej.nil? && @sel && @sel.only_one_fixnum? end |
#ranges ⇒ Object
253 254 255 |
# File 'lib/rio/matchrecord.rb', line 253 def ranges() (@sel.nil? ? [] : @sel.ranges) + (@rej.nil? ? [] : @rej.ranges) end |
#rangetops ⇒ Object
249 250 251 252 |
# File 'lib/rio/matchrecord.rb', line 249 def rangetops() rtops = ranges.map { |r| r.val.max }.sort.uniq rtops.empty? ? nil : rtops end |
#remove_passed_ranges(n) ⇒ Object
243 244 245 246 247 248 |
# File 'lib/rio/matchrecord.rb', line 243 def remove_passed_ranges(n) @sel = @sel.remove_passed_ranges(n) unless @sel.nil? @rej = @rej.remove_passed_ranges(n) unless @rej.nil? @always = init_always(true) self end |