a class to store sorted numerics.
Bio::RestrictionEnzyme internal use only. Please do not create the instance outside Bio::RestrictionEnzyme.
Same usage as Array#+, but accepts only the same classes instance.
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 124 def +(other) unless other.is_a?(self.class) then raise TypeError, 'unsupported data type' end new_hash = @hash.merge(other.internal_data_hash) result = self.class.new result.internal_data_hash = new_hash result end
Same usage as Array#<<
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 168 def <<(elem) push_element(elem) self end
Same usage as Array#==
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 135 def ==(other) if r = super(other) then r elsif other.is_a?(self.class) then other.internal_data_hash == @hash else false end end
Same usage as Array#[]
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 103 def [](*arg) #$stderr.puts "SortedNumArray#[]" sorted_keys[*arg] end
Not implemented
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 109 def []=(*arg) raise NotImplementedError, 'SortedNumArray#[]= is not implemented.' end
Same usage as Array#concat
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 146 def concat(ary) ary.each { |elem| push_element(elem) } self end
Same usage as Array#delete
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 195 def delete(elem) #clear_cache @hash.delete(elem) ? elem : nil end
Same usage as Array#each
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 114 def each(&block) sorted_keys.each(&block) end
Same usage as Array#first
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 179 def first sorted_keys.first end
Same usage as Array#include?
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 174 def include?(elem) @hash.has_key?(elem) end
initialize copy
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 37 def initialize_copy(other) super(other) @hash = @hash.dup end
Same usage as Array#last
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 184 def last sorted_keys.last end
Same usage as Array#push
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 152 def push(*args) args.each do |elem| push_element(elem) end self end
Same usage as Array#reverse_each
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 119 def reverse_each(&block) sorted_keys.reverse_each(&block) end
Same usage as Array#size
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 189 def size @hash.size end
Does nothing
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 201 def sort!(&block) # does nothing self end
Converts to an array
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb, line 213 def to_a #sorted_keys.dup sorted_keys end
Generated with the Darkfish Rdoc Generator 2.