class Bio::RestrictionEnzyme::SortedNumArray
a class to store sorted numerics.
Bio::RestrictionEnzyme
internal use only. Please do not create the instance outside Bio::RestrictionEnzyme
.
Public Class Methods
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 22 def self.[](*args) 23 a = self.new 24 args.each do |elem| 25 a.push elem 26 end 27 a 28 end
Same usage as Array.[]
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 31 def initialize 32 @hash = {} 33 #clear_cache 34 end
Creates a new object
Public Instance Methods
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 124 def +(other) 125 unless other.is_a?(self.class) then 126 raise TypeError, 'unsupported data type' 127 end 128 new_hash = @hash.merge(other.internal_data_hash) 129 result = self.class.new 130 result.internal_data_hash = new_hash 131 result 132 end
Same usage as Array#+, but accepts only the same classes instance.
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 168 def <<(elem) 169 push_element(elem) 170 self 171 end
Same usage as Array#<<
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 135 def ==(other) 136 if r = super(other) then 137 r 138 elsif other.is_a?(self.class) then 139 other.internal_data_hash == @hash 140 else 141 false 142 end 143 end
Same usage as Array#==
Calls superclass method
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 103 def [](*arg) 104 #$stderr.puts "SortedNumArray#[]" 105 sorted_keys[*arg] 106 end
Same usage as Array#[]
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 109 def []=(*arg) 110 raise NotImplementedError, 'SortedNumArray#[]= is not implemented.' 111 end
Not implemented
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 146 def concat(ary) 147 ary.each { |elem| push_element(elem) } 148 self 149 end
Same usage as Array#concat
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 195 def delete(elem) 196 #clear_cache 197 @hash.delete(elem) ? elem : nil 198 end
Same usage as Array#delete
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 114 def each(&block) 115 sorted_keys.each(&block) 116 end
Same usage as Array#each
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 179 def first 180 sorted_keys.first 181 end
Same usage as Array#first
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 174 def include?(elem) 175 @hash.has_key?(elem) 176 end
Same usage as Array#include?
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 37 def initialize_copy(other) 38 super(other) 39 @hash = @hash.dup 40 end
initialize copy
Calls superclass method
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 184 def last 185 sorted_keys.last 186 end
Same usage as Array#last
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 152 def push(*args) 153 args.each do |elem| 154 push_element(elem) 155 end 156 self 157 end
Same usage as Array#push
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 119 def reverse_each(&block) 120 sorted_keys.reverse_each(&block) 121 end
Same usage as Array#reverse_each
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 189 def size 190 @hash.size 191 end
Same usage as Array#size
Also aliased as: length
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 201 def sort!(&block) 202 # does nothing 203 self 204 end
Does nothing
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 213 def to_a 214 #sorted_keys.dup 215 sorted_keys 216 end
Converts to an array
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 207 def uniq! 208 # does nothing 209 self 210 end
Does nothing
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 160 def unshift(*arg) 161 arg.reverse_each do |elem| 162 unshift_element(elem) 163 end 164 self 165 end
Same usage as Array#unshift
Protected Instance Methods
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 51 def internal_data_hash 52 @hash 53 end
gets internal hash object
Source
# File lib/bio/util/restriction_enzyme/sorted_num_array.rb 43 def internal_data_hash=(h) 44 #clear_cache 45 @hash = h 46 self 47 end
sets internal hash object