class NTable::IndexedAxis

An axis in which the rows are numerically identified by a range of consecutive integers.

Attributes

start[R]

Retrieve the number of the first row

Public Class Methods

new(size_, start_=0) click to toggle source

Create an IndexedAxis with the given number of rows. The optional start parameter indicates the number of the first row (default 0).

# File lib/ntable/axis.rb, line 190
def initialize(size_, start_=0)
  @size = size_
  @start = start_
end

Public Instance Methods

==(obj_) click to toggle source
Alias for: eql?
eql?(obj_) click to toggle source

See NTable::EmptyAxis#eql?

# File lib/ntable/axis.rb, line 197
def eql?(obj_)
  obj_.is_a?(IndexedAxis) && obj_.size.eql?(@size) && obj_.start.eql?(@start)
end
Also aliased as: ==
from_json_object(json_obj_) click to toggle source

See NTable::EmptyAxis#from_json_object

# File lib/ntable/axis.rb, line 239
def from_json_object(json_obj_)
  initialize(json_obj_['size'], json_obj_['start'].to_i)
end
hash() click to toggle source

See NTable::EmptyAxis#hash

# File lib/ntable/axis.rb, line 203
def hash
  @size.hash ^ @start.hash
end
index(label_) click to toggle source

See NTable::EmptyAxis#index

# File lib/ntable/axis.rb, line 222
def index(label_)
  label_ >= @start && label_ < @size + @start ? label_ - @start : nil
end
inspect() click to toggle source

See NTable::EmptyAxis#inspect

# File lib/ntable/axis.rb, line 208
def inspect
  "#<#{self.class}:0x#{object_id.to_s(16)} size=#{@size} start=#{@start}>"
end
Also aliased as: to_s
label(index_) click to toggle source

See NTable::EmptyAxis#label

# File lib/ntable/axis.rb, line 227
def label(index_)
  index_ >= 0 && index_ < @size ? index_ + @start : nil
end
to_json_object(json_obj_) click to toggle source

See NTable::EmptyAxis#to_json_object

# File lib/ntable/axis.rb, line 233
def to_json_object(json_obj_)
  json_obj_['size'] = @size
  json_obj_['start'] = @start unless @start == 0
end
to_s() click to toggle source
Alias for: inspect