Class: StatList

Inherits:
Object
  • Object
show all
Defined in:
lib/colt/stat_list.rb

Direct Known Subclasses

DoubleStatList

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#array_listObject (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

#add(element) ⇒ Object


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

#before_insert(index, element) ⇒ Object


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

#binary_search(key, from = 0, to = @array_list.size() - 1) ⇒ Object





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

#copyObject





61
62
63
# File 'lib/colt/stat_list.rb', line 61

def copy
  DoubleStatList.new(@array_list.copy)
end

#elementsObject


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

#get(index) ⇒ Object 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

#index_of(element, from = 0, to = @array_list.size() - 1) ⇒ Object





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

#last_index_of(element, from = 0, to = @array_list.size() - 1) ⇒ Object





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




138
139
140
# File 'lib/colt/stat_list.rb', line 138

def print
  puts @array_list.toString()
end

#reverseObject





104
105
106
# File 'lib/colt/stat_list.rb', line 104

def reverse
  @array_list.reverse()
end

#set(index, element) ⇒ Object Also known as: []=





112
113
114
# File 'lib/colt/stat_list.rb', line 112

def set(index, element)
  @array_list.set(index, element)
end

#shuffle(from = 0, to = @array_list.size() - 1) ⇒ Object





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

#to_sObject





146
147
148
# File 'lib/colt/stat_list.rb', line 146

def to_s
  print
end

#trim_to_sizeObject





130
131
132
# File 'lib/colt/stat_list.rb', line 130

def trim_to_size
  @array_list.trimToSize()
end