Class: StatList
- Inherits:
-
Object
- Object
- StatList
- Defined in:
- lib/colt/stat_list.rb
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (Object) array_list
readonly
Returns the value of attribute array_list.
Instance Method Summary (collapse)
-
- (Object) add(element)
Appends the specified element to the end of this list.
-
- (Object) before_insert(index, element)
Inserts the specified element before the specified position into the receiver.
-
- (Object) binary_search(key, from = 0, to = @array_list.size()-1)
????????????????????????????.
-
- (Object) copy
????????????????????????????.
-
- (Object) elements
Returns the elements currently stored.
-
- (Object) get(index)
(also: #[])
Returns the element at the specified position in the receiver.
-
- (Object) index_of(element, from = 0, to = @array_list.size()-1)
????????????????????????????.
-
- (Object) last_index_of(element, from = 0, to = @array_list.size()-1)
????????????????????????????.
-
- (Object) print
????????????????????????????.
-
- (Object) reverse
????????????????????????????.
-
- (Object) set(index, element)
(also: #[]=)
????????????????????????????.
-
- (Object) shuffle(from = 0, to = @array_list.size()-1)
????????????????????????????.
-
- (Object) to_s
????????????????????????????.
-
- (Object) trim_to_size
????????????????????????????.
Instance Attribute Details
- (Object) array_list (readonly)
Returns the value of attribute array_list
31 32 33 |
# File 'lib/colt/stat_list.rb', line 31 def array_list @array_list end |
Instance Method Details
- (Object) add(element)
Appends the specified element to the end of this list.
37 38 39 |
# File 'lib/colt/stat_list.rb', line 37 def add(element) @array_list.add(element) end |
- (Object) before_insert(index, element)
Inserts the specified element before the specified position into the receiver.
45 46 47 |
# File 'lib/colt/stat_list.rb', line 45 def before_insert(index, element) @array_list.beforeInsert(index, element) end |
- (Object) binary_search(key, from = 0, to = @array_list.size()-1)
53 54 55 |
# File 'lib/colt/stat_list.rb', line 53 def binary_search(key, from = 0, to = @array_list.size() - 1) sorted_data.binarySearchFromTo(key, from, to) end |
- (Object) copy
61 62 63 |
# File 'lib/colt/stat_list.rb', line 61 def copy DoubleStatList.new(@array_list.copy) end |
- (Object) elements
Returns the elements currently stored. Trims the list to the maximum size.
69 70 71 72 |
# File 'lib/colt/stat_list.rb', line 69 def elements @array_list.trimToSize @array_list.elements().to_a end |
- (Object) get(index) Also known as: []
Returns the element at the specified position in the receiver.
78 79 80 |
# File 'lib/colt/stat_list.rb', line 78 def get(index) @array_list.get(index) end |
- (Object) index_of(element, from = 0, to = @array_list.size()-1)
88 89 90 |
# File 'lib/colt/stat_list.rb', line 88 def index_of(element, from = 0, to = @array_list.size() - 1) @array_list.indexOfFromTo(element, from, to) end |
- (Object) last_index_of(element, from = 0, to = @array_list.size()-1)
96 97 98 |
# File 'lib/colt/stat_list.rb', line 96 def last_index_of(element, from = 0, to = @array_list.size() - 1) @array_list.lastIndexOfFromTo(element, from, to) end |
- (Object) print
138 139 140 |
# File 'lib/colt/stat_list.rb', line 138 def print puts @array_list.toString() end |
- (Object) reverse
104 105 106 |
# File 'lib/colt/stat_list.rb', line 104 def reverse @array_list.reverse() end |
- (Object) set(index, element) Also known as: []=
112 113 114 |
# File 'lib/colt/stat_list.rb', line 112 def set(index, element) @array_list.set(index, element) end |
- (Object) shuffle(from = 0, to = @array_list.size()-1)
122 123 124 |
# File 'lib/colt/stat_list.rb', line 122 def shuffle(from = 0, to = @array_list.size() - 1) @array_list.shuffleFromTo(from, to) end |
- (Object) to_s
146 147 148 |
# File 'lib/colt/stat_list.rb', line 146 def to_s print end |
- (Object) trim_to_size
130 131 132 |
# File 'lib/colt/stat_list.rb', line 130 def trim_to_size @array_list.trimToSize() end |